aboutsummaryrefslogtreecommitdiffstats
path: root/content_scripts/marks.coffee
diff options
context:
space:
mode:
authorStephen Blott2015-06-05 07:07:02 +0100
committerStephen Blott2015-06-05 07:07:04 +0100
commit8eda31fb236b9506d577a25908d4e5334d3289d5 (patch)
tree85cfc27b6156d3833c9fd21f7177097a7f6d054e /content_scripts/marks.coffee
parenta143d2c81a9faaf383a05b0dae2f232db85959a2 (diff)
downloadvimium-8eda31fb236b9506d577a25908d4e5334d3289d5.tar.bz2
Global marks; global marks are always recorded for the top frame only.
With global marks, we may later create a new tab when the mark is used. When doing so, we should always be using the URL and scroll position of the top frame within the tab. For example, if a global mark is created from within the Hangouts frame of Google's Inbox and the mark is later used, then we should create a new tab for Inbox's URL and scroll position, not for the Hangout's URL and scroll position.
Diffstat (limited to 'content_scripts/marks.coffee')
-rw-r--r--content_scripts/marks.coffee7
1 files changed, 5 insertions, 2 deletions
diff --git a/content_scripts/marks.coffee b/content_scripts/marks.coffee
index 3b5814da..f569e1ea 100644
--- a/content_scripts/marks.coffee
+++ b/content_scripts/marks.coffee
@@ -36,11 +36,14 @@ Marks =
# characters.
@exit =>
if event.shiftKey
+ # We record the current scroll position, but only if this is the top frame within the tab.
+ # Otherwise, we'll fetch the scroll position of the top frame from the background page later.
+ [ scrollX, scrollY ] = [ window.scrollX, window.scrollY ] if DomUtils.isTopFrame()
chrome.runtime.sendMessage
handler: 'createMark'
markName: keyChar
- scrollX: window.scrollX
- scrollY: window.scrollY
+ scrollX: scrollX
+ scrollY: scrollY
, => @showMessage "Created global mark", keyChar
else
localStorage[@getLocationKey keyChar] = @getMarkString()