diff options
| -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. |
