From ce5300b88a968104231ffa679e7f71da320de1fa Mon Sep 17 00:00:00 2001
From: mrmr1993
Date: Wed, 3 Feb 2016 03:49:06 +0000
Subject: Update only help dialog contents when showing
---
background_scripts/main.coffee | 5 +----
content_scripts/vimium.css | 8 ++++++++
content_scripts/vimium_frontend.coffee | 36 +++++++++++++++++++---------------
pages/help_dialog.html | 29 +++++++++++++++++----------
4 files changed, 48 insertions(+), 30 deletions(-)
diff --git a/background_scripts/main.coffee b/background_scripts/main.coffee
index a027154a..ad47c399 100644
--- a/background_scripts/main.coffee
+++ b/background_scripts/main.coffee
@@ -153,10 +153,7 @@ root.helpDialogHtml = (showUnboundCommands, showCommandNames, customTitle) ->
helpDialogHtmlForCommandGroup(group, commandsToKey, Commands.availableCommands,
showUnboundCommands, showCommandNames)
- dialogHtml = fetchFileContents("pages/help_dialog.html")
- for placeholder, replacementString of replacementStrings
- dialogHtml = dialogHtml.replace "", replacementString
- dialogHtml
+ replacementStrings
#
# Generates HTML for a given set of commands. commandGroups are defined in commands.js
diff --git a/content_scripts/vimium.css b/content_scripts/vimium.css
index 6e262f32..f9c80abc 100644
--- a/content_scripts/vimium.css
+++ b/content_scripts/vimium.css
@@ -61,6 +61,14 @@ tr.vimiumReset {
z-index: 2147483648;
}
+thead.vimiumReset, tbody.vimiumReset {
+ display: table-header-group;
+}
+
+tbody.vimiumReset {
+ display: table-row-group;
+}
+
/* Linkhints CSS */
div.internalVimiumHintMarker {
diff --git a/content_scripts/vimium_frontend.coffee b/content_scripts/vimium_frontend.coffee
index e54c5c75..30d6e4b8 100644
--- a/content_scripts/vimium_frontend.coffee
+++ b/content_scripts/vimium_frontend.coffee
@@ -220,6 +220,7 @@ initializeOnDomReady = ->
# We only initialize the vomnibar in the tab's main frame, because it's only ever opened there.
Vomnibar.init() if DomUtils.isTopFrame()
HUD.init()
+ VimiumHelpDialog.init()
registerFrame = ->
# Don't register frameset containers; focusing them is no use.
@@ -776,24 +777,28 @@ VimiumHelpDialog =
getShowAdvancedCommands: -> Settings.get("helpDialog_showAdvancedCommands")
init: ->
- unless @container?
- @container = DomUtils.createElement "div"
- @container.id = "vimiumHelpDialogContainer"
- @container.className = "vimiumReset"
+ return if @container?
+ @container = DomUtils.createElement "div"
+ @container.id = "vimiumHelpDialogContainer"
+ @container.className = "vimiumReset"
+ chrome.runtime.sendMessage {handler: "fetchFileContents", fileName: "pages/help_dialog.html"}, (html) =>
+ @container.innerHTML = html
+
+ @dialogElement = @container.querySelector "#vimiumHelpDialog"
+
+ @dialogElement.getElementsByClassName("closeButton")[0].addEventListener("click", hideHelpDialog, false)
+ @dialogElement.getElementsByClassName("optionsPage")[0].addEventListener("click", (clickEvent) ->
+ clickEvent.preventDefault()
+ chrome.runtime.sendMessage({handler: "openOptionsPageInNewTab"})
+ false)
+ @dialogElement.getElementsByClassName("toggleAdvancedCommands")[0].addEventListener("click",
+ VimiumHelpDialog.toggleAdvancedCommands, false)
show: (html) ->
- document.body.appendChild @container
-
- @container.innerHTML = html
- @container.getElementsByClassName("closeButton")[0].addEventListener("click", hideHelpDialog, false)
- @container.getElementsByClassName("optionsPage")[0].addEventListener("click", (clickEvent) ->
- clickEvent.preventDefault()
- chrome.runtime.sendMessage({handler: "openOptionsPageInNewTab"})
- false)
+ for placeholder, htmlString of html
+ @dialogElement.querySelector("#help-dialog-#{placeholder}").innerHTML = htmlString
- @dialogElement = @container.querySelector "#VimiumHelpDialog"
- @dialogElement.getElementsByClassName("toggleAdvancedCommands")[0].addEventListener("click",
- VimiumHelpDialog.toggleAdvancedCommands, false)
+ document.body.appendChild @container
@showAdvancedCommands(@getShowAdvancedCommands())
# Simulating a click on the help dialog makes it the active element for scrolling.
@@ -822,7 +827,6 @@ window.showHelpDialog = (html, fid) ->
return if (isShowingHelpDialog || !document.body || fid != frameId)
isShowingHelpDialog = true
- VimiumHelpDialog.init()
VimiumHelpDialog.show html
hideHelpDialog = (clickEvent) ->
diff --git a/pages/help_dialog.html b/pages/help_dialog.html
index 1e743899..6b05f1d7 100644
--- a/pages/help_dialog.html
+++ b/pages/help_dialog.html
@@ -12,26 +12,35 @@
Vimium
-
- | | Navigating the page |
-
+
+ | | Navigating the page |
+
+
-
+
| | Using the vomnibar |
-
+
+
+
| | Using find |
-
+
+
+
| | Navigating history |
-
+
+
+
| | Manipulating tabs |
-
+
+
+
| | Miscellaneous |
-
-
+
+
--
cgit v1.2.3