aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--content_scripts/vimium_frontend.coffee8
-rw-r--r--pages/help_dialog.coffee6
2 files changed, 9 insertions, 5 deletions
diff --git a/content_scripts/vimium_frontend.coffee b/content_scripts/vimium_frontend.coffee
index fdfef910..bfc09980 100644
--- a/content_scripts/vimium_frontend.coffee
+++ b/content_scripts/vimium_frontend.coffee
@@ -768,19 +768,17 @@ window.enterFindMode = ->
Marks.setPreviousPosition()
new FindMode()
-window.HelpDialog =
+# If we are in the help dialog iframe, HelpDialog is already defined with the necessary functions.
+window.HelpDialog ?=
helpUI: null
container: null
showing: false
- # This setting is pulled out of local storage. It's false by default.
- getShowAdvancedCommands: -> Settings.get("helpDialog_showAdvancedCommands")
-
init: ->
return if @helpUI?
@helpUI = new UIComponent "pages/help_dialog.html", "vimiumHelpDialogFrame", (event) =>
- @helpUI.hide() if event.data == "hide"
+ @hide() if event.data == "hide"
isReady: -> @helpUI?
diff --git a/pages/help_dialog.coffee b/pages/help_dialog.coffee
index 5bff5e33..a75bd143 100644
--- a/pages/help_dialog.coffee
+++ b/pages/help_dialog.coffee
@@ -1,5 +1,6 @@
HelpDialog =
dialogElement: null
+ showing: true
# This setting is pulled out of local storage. It's false by default.
getShowAdvancedCommands: -> Settings.get("helpDialog_showAdvancedCommands")
@@ -19,6 +20,8 @@ HelpDialog =
@dialogElement.getElementsByClassName("toggleAdvancedCommands")[0].addEventListener("click",
HelpDialog.toggleAdvancedCommands, false)
+ isReady: -> true
+
show: (html) ->
for placeholder, htmlString of html
@dialogElement.querySelector("#help-dialog-#{placeholder}").innerHTML = htmlString
@@ -30,6 +33,9 @@ HelpDialog =
hide: -> UIComponentServer.postMessage "hide"
+ toggle: (html) ->
+ if @showing then @hide() else @show html
+
#
# Advanced commands are hidden by default so they don't overwhelm new and casual users.
#