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 /content_scripts | |
| parent | fea6e507761e6870d9c240d0718cb96711891a3a (diff) | |
| download | vimium-bc4f3ecac81fd8f174b8c3ad92a0998ada8f7992.tar.bz2 | |
Global marks; focus and only scroll in the main frame.
Diffstat (limited to 'content_scripts')
| -rw-r--r-- | content_scripts/vimium_frontend.coffee | 16 |
1 files changed, 10 insertions, 6 deletions
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. |
