diff options
| author | Stephen Blott | 2016-04-17 14:12:46 +0100 | 
|---|---|---|
| committer | Stephen Blott | 2016-04-17 14:15:08 +0100 | 
| commit | 10982f57bbbbe802ecc59173ce8a60582f8b34ff (patch) | |
| tree | 88676dd3d2c6e540347fb83a2419472f73c370aa | |
| parent | 27385e81debd5fcd9000c718d73e296d6723e83a (diff) | |
| download | vimium-10982f57bbbbe802ecc59173ce8a60582f8b34ff.tar.bz2 | |
Make showHelp not a background command.
| -rw-r--r-- | background_scripts/commands.coffee | 2 | ||||
| -rw-r--r-- | background_scripts/main.coffee | 6 | ||||
| -rw-r--r-- | content_scripts/vimium_frontend.coffee | 4 | ||||
| -rw-r--r-- | pages/options.coffee | 3 | 
4 files changed, 8 insertions, 7 deletions
| diff --git a/background_scripts/commands.coffee b/background_scripts/commands.coffee index 2d901b15..30ea6c39 100644 --- a/background_scripts/commands.coffee +++ b/background_scripts/commands.coffee @@ -295,7 +295,7 @@ defaultKeyMappings =  # If the noRepeat and repeatLimit options are both specified, then noRepeat takes precedence.  commandDescriptions =    # Navigating the current page -  showHelp: ["Show help", { background: true, noRepeat: true }] +  showHelp: ["Show help", { noRepeat: true }]    scrollDown: ["Scroll down"]    scrollUp: ["Scroll up"]    scrollLeft: ["Scroll left"] diff --git a/background_scripts/main.coffee b/background_scripts/main.coffee index 5c6e8e19..4aa2fc41 100644 --- a/background_scripts/main.coffee +++ b/background_scripts/main.coffee @@ -82,8 +82,7 @@ chrome.webNavigation.onHistoryStateUpdated.addListener onURLChange # history.pus  chrome.webNavigation.onReferenceFragmentUpdated.addListener onURLChange # Hash changed.  # Retrieves the help dialog HTML template from a file, and populates it with the latest keybindings. -# This is called by options.coffee. -root.helpDialogHtml = (showUnboundCommands, showCommandNames, customTitle) -> +getHelpDialogHtml = ({showUnboundCommands, showCommandNames, customTitle}) ->    commandsToKey = {}    for own key of Commands.keyToCommandRegistry      command = Commands.keyToCommandRegistry[key].command @@ -209,8 +208,6 @@ BackgroundCommands =    openCopiedUrlInCurrentTab: (request) -> TabOperations.openUrlInCurrentTab extend request, url: Clipboard.paste()    openCopiedUrlInNewTab: (request) -> @createTab extend request, url: Clipboard.paste()    togglePinTab: ({tab}) -> chrome.tabs.update tab.id, {pinned: !tab.pinned} -  showHelp: ({tab, frameId}) -> -    chrome.tabs.sendMessage tab.id, {name: "toggleHelpDialog", dialogHtml: helpDialogHtml(), frameId}    moveTabLeft: moveTab    moveTabRight: moveTab    nextFrame: ({count, frameId, tabId}) -> @@ -402,6 +399,7 @@ portHandlers =  sendRequestHandlers =    runBackgroundCommand: (request) -> BackgroundCommands[request.registryEntry.command] request +  getHelpDialogHtml: getHelpDialogHtml    # getCurrentTabUrl is used by the content scripts to get their full URL, because window.location cannot help    # with Chrome-specific URLs like "view-source:http:..".    getCurrentTabUrl: ({tab}) -> tab.url diff --git a/content_scripts/vimium_frontend.coffee b/content_scripts/vimium_frontend.coffee index 92145303..9f7d9d52 100644 --- a/content_scripts/vimium_frontend.coffee +++ b/content_scripts/vimium_frontend.coffee @@ -155,7 +155,6 @@ initializePreDomReady = ->    checkIfEnabledForUrl document.hasFocus()    requestHandlers = -    toggleHelpDialog: (request) -> if frameId == request.frameId then HelpDialog.toggle request.dialogHtml      focusFrame: (request) -> if (frameId == request.frameId) then focusThisFrame request      getScrollPosition: (ignoredA, ignoredB, sendResponse) ->        sendResponse scrollX: window.scrollX, scrollY: window.scrollY if frameId == 0 @@ -626,6 +625,9 @@ enterFindMode = ->    Marks.setPreviousPosition()    new FindMode() +window.showHelp = -> +  chrome.runtime.sendMessage handler: "getHelpDialogHtml", HelpDialog.toggle.bind HelpDialog +  # If we are in the help dialog iframe, HelpDialog is already defined with the necessary functions.  window.HelpDialog ?=    helpUI: null diff --git a/pages/options.coffee b/pages/options.coffee index 3e1843a7..3487c52f 100644 --- a/pages/options.coffee +++ b/pages/options.coffee @@ -234,7 +234,8 @@ initOptionsPage = ->      event.preventDefault()    activateHelpDialog = -> -    HelpDialog.toggle chrome.extension.getBackgroundPage().helpDialogHtml true, true, "Command Listing" +    request = showUnboundCommands: true, showCommandNames: true, customTitle: "Command Listing" +    chrome.runtime.sendMessage extend(request, handler: "getHelpDialogHtml"), HelpDialog.toggle.bind HelpDialog    saveOptions = ->      Option.saveOptions() | 
