aboutsummaryrefslogtreecommitdiffstats
path: root/background_scripts/main.coffee
diff options
context:
space:
mode:
authorStephen Blott2015-04-21 13:23:03 +0100
committerStephen Blott2015-04-21 13:23:03 +0100
commitc64cc382aec1ef500d50417b5214854e28e4b952 (patch)
tree1baca47abf4e94168980c500bb6892682d858c52 /background_scripts/main.coffee
parentf2a89e0bb9ef72ffe893e45c78df3740612ceb27 (diff)
downloadvimium-c64cc382aec1ef500d50417b5214854e28e4b952.tar.bz2
Implement mainFrame command.
Fixes #426.
Diffstat (limited to 'background_scripts/main.coffee')
-rw-r--r--background_scripts/main.coffee6
1 files changed, 6 insertions, 0 deletions
diff --git a/background_scripts/main.coffee b/background_scripts/main.coffee
index 31ada357..c47abd66 100644
--- a/background_scripts/main.coffee
+++ b/background_scripts/main.coffee
@@ -298,6 +298,11 @@ 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) ->
+ # Messages sent with a frameId of zero in the options argument (as below) are delivered only to the
+ # tab's main frame.
+ chrome.tabs.sendMessage tab.id, { name: "focusFrame", frameId: 0, highlight: true }, frameId: 0
closeTabsOnLeft: -> removeTabsRelative "before"
closeTabsOnRight: -> removeTabsRelative "after"
@@ -618,6 +623,7 @@ sendRequestHandlers =
unregisterFrame: unregisterFrame
frameFocused: handleFrameFocused
nextFrame: (request) -> BackgroundCommands.nextFrame 1, request.frameId
+ mainFrame: BackgroundCommands.mainFrame
updateScrollPosition: handleUpdateScrollPosition
copyToClipboard: copyToClipboard
pasteFromClipboard: pasteFromClipboard