diff options
| author | Phil Crosby | 2011-02-09 23:06:41 -0800 |
|---|---|---|
| committer | Phil Crosby | 2011-02-09 23:06:41 -0800 |
| commit | a036d2dac281b2528c2087b08839e118e3f449ae (patch) | |
| tree | 68fcd1b415fd14d21505bca3ce3d9e9a14d837e8 /helpDialog.html | |
| parent | 1edb16a47eb8a35fc3ea7991bfdfc8434d1d3bff (diff) | |
| download | vimium-a036d2dac281b2528c2087b08839e118e3f449ae.tar.bz2 | |
Preserve the "show advanced commands" setting after you close the vimium help dialog.
Diffstat (limited to 'helpDialog.html')
| -rw-r--r-- | helpDialog.html | 21 |
1 files changed, 16 insertions, 5 deletions
diff --git a/helpDialog.html b/helpDialog.html index c21c8b7b..ae78d149 100644 --- a/helpDialog.html +++ b/helpDialog.html @@ -132,10 +132,14 @@ <script> VimiumHelpDialog = { + // This setting is pulled out of local storage. It's false by default. + advancedCommandsVisible: {{showAdvancedCommands}}, + init: function() { this.dialogElement = document.getElementById("vimiumHelpDialog"); this.dialogElement.getElementsByClassName("toggleAdvancedCommands")[0].addEventListener("click", VimiumHelpDialog.toggleAdvancedCommands, false); + this.showAdvancedCommands(this.advancedCommandsVisible); }, /* @@ -143,13 +147,20 @@ */ toggleAdvancedCommands: function(event) { event.preventDefault(); - var advanced = VimiumHelpDialog.dialogElement.getElementsByClassName("advanced"); - var shouldShow = (advanced[0].style.display == "" || advanced[0].style.display == "none"); + VimiumHelpDialog.advancedCommandsVisible = !VimiumHelpDialog.advancedCommandsVisible; + chrome.extension.sendRequest({ handler: "saveHelpDialogSettings", + showAdvancedCommands: VimiumHelpDialog.advancedCommandsVisible }); + VimiumHelpDialog.showAdvancedCommands(VimiumHelpDialog.advancedCommandsVisible); + }, + + showAdvancedCommands: function(visible) { VimiumHelpDialog.dialogElement.getElementsByClassName("toggleAdvancedCommands")[0].innerHTML = - shouldShow ? "Hide advanced commands" : "Show advanced commands"; + visible ? "Hide advanced commands" : "Show advanced commands"; + var advanced = VimiumHelpDialog.dialogElement.getElementsByClassName("advanced"); for (var i = 0; i < advanced.length; i++) - advanced[i].style.display = (shouldShow ? "table-row" : "none"); - } + advanced[i].style.display = (visible ? "table-row" : "none"); + }, + }; VimiumHelpDialog.init(); |
