diff options
| -rw-r--r-- | background_scripts/main.js | 7 | ||||
| -rw-r--r-- | content_scripts/vimium_frontend.coffee | 12 | 
2 files changed, 11 insertions, 8 deletions
| diff --git a/background_scripts/main.js b/background_scripts/main.js index 6e6a3978..8e75314e 100644 --- a/background_scripts/main.js +++ b/background_scripts/main.js @@ -23,6 +23,7 @@ var portHandlers = {  var sendRequestHandlers = {    getCompletionKeys: getCompletionKeysRequest,    getCurrentTabUrl: getCurrentTabUrl, +  getShowAdvancedCommands: getShowAdvancedCommands,    openUrlInNewTab: openUrlInNewTab,    openUrlInCurrentTab: openUrlInCurrentTab,    openOptionsPageInNewTab: openOptionsPageInNewTab, @@ -128,6 +129,10 @@ function addExcludedUrl(url) {    });  } +function getShowAdvancedCommands(request){ +  return Settings.get("helpDialog_showAdvancedCommands"); +} +  function saveHelpDialogSettings(request) {    Settings.set("helpDialog_showAdvancedCommands", request.showAdvancedCommands);  } @@ -155,8 +160,6 @@ function helpDialogHtml(showUnboundCommands, showCommandNames, customTitle) {                                        showUnboundCommands, showCommandNames));    dialogHtml = dialogHtml.replace("{{version}}", currentVersion);    dialogHtml = dialogHtml.replace("{{title}}", customTitle || "Help"); -  dialogHtml = dialogHtml.replace("{{showAdvancedCommands}}", -      Settings.get("helpDialog_showAdvancedCommands"));    return dialogHtml;  } diff --git a/content_scripts/vimium_frontend.coffee b/content_scripts/vimium_frontend.coffee index 548e9c6c..9accaa3b 100644 --- a/content_scripts/vimium_frontend.coffee +++ b/content_scripts/vimium_frontend.coffee @@ -854,25 +854,25 @@ window.showHelpDialog = (html, fid) ->    # scripts.forEach((script) -> eval(script.text))    VimiumHelpDialog =      # This setting is pulled out of local storage. It's false by default. -    advancedCommandsVisible: false      #chrome.extension.getBackgroundPage().Settings.get('helpDialog_showAdvancedCommands') +    getShowAdvancedCommands: (callback) -> +      chrome.extension.sendRequest({ handler: "getShowAdvancedCommands"}, callback)      init: () ->        this.dialogElement = document.getElementById("vimiumHelpDialog")        this.dialogElement.getElementsByClassName("toggleAdvancedCommands")[0].addEventListener("click",          VimiumHelpDialog.toggleAdvancedCommands, false)        this.dialogElement.style.maxHeight = window.innerHeight - 80 -      this.showAdvancedCommands(this.advancedCommandsVisible) +      this.getShowAdvancedCommands(this.showAdvancedCommands)      #       # Advanced commands are hidden by default so they don't overwhelm new and casual users.      #       toggleAdvancedCommands: (event) ->        event.preventDefault() -      VimiumHelpDialog.advancedCommandsVisible = !VimiumHelpDialog.advancedCommandsVisible -      chrome.extension.sendRequest( -        { handler: "saveHelpDialogSettings", showAdvancedCommands: VimiumHelpDialog.advancedCommandsVisible }) -      VimiumHelpDialog.showAdvancedCommands(VimiumHelpDialog.advancedCommandsVisible) +      VimiumHelpDialog.getShowAdvancedCommands((value) -> +        VimiumHelpDialog.showAdvancedCommands(!value) +        chrome.extension.sendRequest({ handler: "saveHelpDialogSettings", showAdvancedCommands: !value }))      showAdvancedCommands: (visible) ->        VimiumHelpDialog.dialogElement.getElementsByClassName("toggleAdvancedCommands")[0].innerHTML = | 
