aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormrmr19932016-02-03 03:12:58 +0000
committermrmr19932016-02-03 03:12:58 +0000
commit559666229c87ed6668a8182d5793fa03b81b53bc (patch)
treebe5d09f6d1ff1def56b15a904b483a2bae241cc2
parentf9561276204ea8b3770600cfd2f7b268e28d8717 (diff)
downloadvimium-559666229c87ed6668a8182d5793fa03b81b53bc.tar.bz2
Store help dialog injected strings together, inject all at once
-rw-r--r--background_scripts/main.coffee15
1 files changed, 10 insertions, 5 deletions
diff --git a/background_scripts/main.coffee b/background_scripts/main.coffee
index 63729b8f..5c056fc9 100644
--- a/background_scripts/main.coffee
+++ b/background_scripts/main.coffee
@@ -144,13 +144,18 @@ root.helpDialogHtml = (showUnboundCommands, showCommandNames, customTitle) ->
command = Commands.keyToCommandRegistry[key].command
commandsToKey[command] = (commandsToKey[command] || []).concat(key)
- dialogHtml = fetchFileContents("pages/help_dialog.html")
+ replacementStrings =
+ version: currentVersion
+ title: customTitle || "Help"
+
for group of Commands.commandGroups
- dialogHtml = dialogHtml.replace("{{#{group}}}",
+ replacementStrings[group] =
helpDialogHtmlForCommandGroup(group, commandsToKey, Commands.availableCommands,
- showUnboundCommands, showCommandNames))
- dialogHtml = dialogHtml.replace("{{version}}", currentVersion)
- dialogHtml = dialogHtml.replace("{{title}}", customTitle || "Help")
+ showUnboundCommands, showCommandNames)
+
+ dialogHtml = fetchFileContents("pages/help_dialog.html")
+ for placeholder, replacementString of replacementStrings
+ dialogHtml = dialogHtml.replace "{{#{placeholder}}}", replacementString
dialogHtml
#