diff options
| author | Stephen Blott | 2016-03-01 13:13:08 +0000 | 
|---|---|---|
| committer | Stephen Blott | 2016-03-05 05:40:11 +0000 | 
| commit | 201451d94edefa8c873d417f5f6190d993204b5e (patch) | |
| tree | ea92cc27965758a611c505d1ac1660a5ef485083 | |
| parent | ff6d4b92df924b93de4366b1f0e3cc7411ac8065 (diff) | |
| download | vimium-201451d94edefa8c873d417f5f6190d993204b5e.tar.bz2 | |
Key bindings; move Vomnibar commands back to content scripts.
| -rw-r--r-- | background_scripts/commands.coffee | 14 | ||||
| -rw-r--r-- | background_scripts/main.coffee | 5 | ||||
| -rw-r--r-- | content_scripts/vimium_frontend.coffee | 6 | 
3 files changed, 13 insertions, 12 deletions
| diff --git a/background_scripts/commands.coffee b/background_scripts/commands.coffee index 25acdc03..4dbcd1cd 100644 --- a/background_scripts/commands.coffee +++ b/background_scripts/commands.coffee @@ -381,13 +381,13 @@ commandDescriptions =    moveTabRight: ["Move tab to the right", { background: true, passCountToFunction: true  }]    # These are background-page commands because all requests go via the background page. -  "Vomnibar.activate": ["Open URL, bookmark, or history entry", { background: true, noRepeat: true }] -  "Vomnibar.activateInNewTab": ["Open URL, bookmark, history entry, in a new tab", { background: true, noRepeat: true }] -  "Vomnibar.activateTabSelection": ["Search through your open tabs", { background: true, noRepeat: true }] -  "Vomnibar.activateBookmarks": ["Open a bookmark", { background: true, noRepeat: true }] -  "Vomnibar.activateBookmarksInNewTab": ["Open a bookmark in a new tab", { background: true, noRepeat: true }] -  "Vomnibar.activateEditUrl": ["Edit the current URL", { background: true, noRepeat: true }] -  "Vomnibar.activateEditUrlInNewTab": ["Edit the current URL and open in a new tab", { background: true, noRepeat: true }] +  "Vomnibar.activate": ["Open URL, bookmark, or history entry", { noRepeat: true }] +  "Vomnibar.activateInNewTab": ["Open URL, bookmark, history entry, in a new tab", { noRepeat: true }] +  "Vomnibar.activateTabSelection": ["Search through your open tabs", { noRepeat: true }] +  "Vomnibar.activateBookmarks": ["Open a bookmark", { noRepeat: true }] +  "Vomnibar.activateBookmarksInNewTab": ["Open a bookmark in a new tab", { noRepeat: true }] +  "Vomnibar.activateEditUrl": ["Edit the current URL", { noRepeat: true }] +  "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 }] diff --git a/background_scripts/main.coffee b/background_scripts/main.coffee index 614b74c0..49199cae 100644 --- a/background_scripts/main.coffee +++ b/background_scripts/main.coffee @@ -370,10 +370,7 @@ chrome.tabs.onUpdated.addListener (tabId, changeInfo, tab) ->  # End action functions  runBackgroundCommand = ({frameId, registryEntry, count}, sender) -> -  if registryEntry.command.startsWith "Vomnibar." -    chrome.tabs.sendMessage sender.tab.id, -      name: "openVomnibar", sourceFrameId: frameId, registryEntry: registryEntry -  else if registryEntry.passCountToFunction +  if registryEntry.passCountToFunction      BackgroundCommands[registryEntry.command] count, frameId    else if registryEntry.noRepeat      BackgroundCommands[registryEntry.command] frameId diff --git a/content_scripts/vimium_frontend.coffee b/content_scripts/vimium_frontend.coffee index 01b02985..72be5510 100644 --- a/content_scripts/vimium_frontend.coffee +++ b/content_scripts/vimium_frontend.coffee @@ -116,7 +116,11 @@ class NormalMode extends KeyHandlerMode          You have asked Vimium to perform #{count} repetitions of the command: #{registryEntry.description}.\n          Are you sure you want to continue?""" -    if registryEntry.isBackgroundCommand +    # The Vomnibar needs special handling because it is always activated in the tab's main frame. +    if registryEntry.command.startsWith "Vomnibar." +      chrome.runtime.sendMessage +        handler: "sendMessageToFrames", message: {name: "openVomnibar", sourceFrameId: frameId, registryEntry} +    else if registryEntry.isBackgroundCommand        chrome.runtime.sendMessage {handler: "runBackgroundCommand", frameId, registryEntry, count}      else if registryEntry.passCountToFunction        Utils.invokeCommandString registryEntry.command, [count] | 
