diff options
| author | Stephen Blott | 2015-06-04 15:14:10 +0100 | 
|---|---|---|
| committer | Stephen Blott | 2015-06-04 15:15:13 +0100 | 
| commit | bc4f3ecac81fd8f174b8c3ad92a0998ada8f7992 (patch) | |
| tree | 47fdd5a6415b2fa0c96fc4cd7e06d7729e8655a0 | |
| parent | fea6e507761e6870d9c240d0718cb96711891a3a (diff) | |
| download | vimium-bc4f3ecac81fd8f174b8c3ad92a0998ada8f7992.tar.bz2 | |
Global marks; focus and only scroll in the main frame.
| -rw-r--r-- | background_scripts/marks.coffee | 1 | ||||
| -rw-r--r-- | content_scripts/vimium_frontend.coffee | 16 | 
2 files changed, 10 insertions, 7 deletions
| diff --git a/background_scripts/marks.coffee b/background_scripts/marks.coffee index 45697ac4..3a5af130 100644 --- a/background_scripts/marks.coffee +++ b/background_scripts/marks.coffee @@ -81,6 +81,5 @@ Marks =        tabsInWindow = tabs.filter (tab) -> tab.windowId == id        continuation tabsInWindow[0] ? tabs[0] -  root = exports ? window  root.Marks = Marks diff --git a/content_scripts/vimium_frontend.coffee b/content_scripts/vimium_frontend.coffee index f644ea35..dc083e6c 100644 --- a/content_scripts/vimium_frontend.coffee +++ b/content_scripts/vimium_frontend.coffee @@ -147,7 +147,7 @@ initializePreDomReady = ->      focusFrame: (request) -> if (frameId == request.frameId) then focusThisFrame request      refreshCompletionKeys: refreshCompletionKeys      getScrollPosition: -> scrollX: window.scrollX, scrollY: window.scrollY -    setScrollPosition: (request) -> setScrollPosition request.scrollX, request.scrollY +    setScrollPosition: setScrollPosition      executePageCommand: executePageCommand      currentKeyQueue: (request) ->        keyQueue = request.keyQueue @@ -264,11 +264,15 @@ executePageCommand = (request) ->    refreshCompletionKeys(request) -setScrollPosition = (scrollX, scrollY) -> -  if (scrollX > 0 || scrollY > 0) -    DomUtils.documentReady -> -      Marks.setPreviousPosition() -      window.scrollTo scrollX, scrollY +# Set the scroll position (but only in the main frame).  Some pages (like Facebook) get confused if you set +# the scroll position in all frames. +setScrollPosition = ({ scrollX, scrollY }) -> +  if DomUtils.isTopFrame() +    if scrollX > 0 or scrollY > 0 +      DomUtils.documentReady -> +        window.focus() +        Marks.setPreviousPosition() +        window.scrollTo scrollX, scrollY  #  # Called from the backend in order to change frame focus. | 
