aboutsummaryrefslogtreecommitdiffstats
path: root/background_scripts
diff options
context:
space:
mode:
authorStephen Blott2015-04-25 07:50:31 +0100
committerStephen Blott2015-04-25 07:50:31 +0100
commite7ae8e0cc5aa5d4a8c7778c4a2f88b53d7cc4111 (patch)
treecd9396584b0433c686983af3cf8cc3026e2edf30 /background_scripts
parentf85c65bb664fdc29b7c45c579ead4481238a24e0 (diff)
parent8b7b4febdf8947b3a123e8dc2b289caa20976864 (diff)
downloadvimium-e7ae8e0cc5aa5d4a8c7778c4a2f88b53d7cc4111.tar.bz2
Merge remote-tracking branch 'origin/focus-main-frame' into focus-main-frame-merge
Conflicts: content_scripts/vimium_frontend.coffee Also rework to remove dependency on Chrome 41+ sendMessage API (specifically, relating to optional target frameId argument).
Diffstat (limited to 'background_scripts')
-rw-r--r--background_scripts/commands.coffee3
-rw-r--r--background_scripts/main.coffee4
2 files changed, 7 insertions, 0 deletions
diff --git a/background_scripts/commands.coffee b/background_scripts/commands.coffee
index 9aa90c45..bca1c3a4 100644
--- a/background_scripts/commands.coffee
+++ b/background_scripts/commands.coffee
@@ -129,6 +129,7 @@ Commands =
"goPrevious",
"goNext",
"nextFrame",
+ "mainFrame",
"Marks.activateCreateMode",
"Vomnibar.activateEditUrl",
"Vomnibar.activateEditUrlInNewTab",
@@ -255,6 +256,7 @@ defaultKeyMappings =
"gE": "Vomnibar.activateEditUrlInNewTab"
"gf": "nextFrame"
+ "gF": "mainFrame"
"m": "Marks.activateCreateMode"
"`": "Marks.activateGotoMode"
@@ -350,6 +352,7 @@ commandDescriptions =
"Vomnibar.activateEditUrlInNewTab": ["Edit the current URL and open in a new tab", { noRepeat: true }]
nextFrame: ["Cycle forward to the next frame on the page", { background: true, passCountToFunction: true }]
+ mainFrame: ["Select the tab's main/top frame", { background: true, noRepeat: true }]
"Marks.activateCreateMode": ["Create a new mark", { noRepeat: true }]
"Marks.activateGotoMode": ["Go to a mark", { noRepeat: true }]
diff --git a/background_scripts/main.coffee b/background_scripts/main.coffee
index 94cbb08e..642913a5 100644
--- a/background_scripts/main.coffee
+++ b/background_scripts/main.coffee
@@ -298,6 +298,10 @@ BackgroundCommands =
count = (count + Math.max 0, frameIdsForTab[tab.id].indexOf frameId) % frames.length
frames = frameIdsForTab[tab.id] = [frames[count..]..., frames[0...count]...]
chrome.tabs.sendMessage(tab.id, { name: "focusFrame", frameId: frames[0], highlight: true }))
+ mainFrame: ->
+ chrome.tabs.getSelected null, (tab) ->
+ # The front end interprets a frameId of 0 to mean the main/top from.
+ chrome.tabs.sendMessage tab.id, name: "focusFrame", frameId: 0, highlight: true
closeTabsOnLeft: -> removeTabsRelative "before"
closeTabsOnRight: -> removeTabsRelative "after"