aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormrmr19932016-02-03 04:14:01 +0000
committermrmr19932016-02-03 04:14:01 +0000
commit22db0d6191d1dba42b206327d1f1d58323314199 (patch)
tree802126666597afec86482232e4d335b2cee30d66
parentfe71d59bcdedf970d5b6eaaf206b85175b82f33f (diff)
downloadvimium-22db0d6191d1dba42b206327d1f1d58323314199.tar.bz2
Remove redundant functions show/hideHelpDialog
-rw-r--r--content_scripts/vimium_frontend.coffee22
-rw-r--r--pages/options.coffee2
2 files changed, 10 insertions, 14 deletions
diff --git a/content_scripts/vimium_frontend.coffee b/content_scripts/vimium_frontend.coffee
index 126a07f1..a1affc50 100644
--- a/content_scripts/vimium_frontend.coffee
+++ b/content_scripts/vimium_frontend.coffee
@@ -534,7 +534,7 @@ onKeydown = (event) ->
keyChar = "<" + keyChar + ">"
if (isShowingHelpDialog && KeyboardUtils.isEscape(event))
- hideHelpDialog()
+ VimiumHelpDialog.hide()
DomUtils.suppressEvent event
KeydownEvents.push event
return @stopBubblingAndTrue
@@ -769,7 +769,7 @@ window.enterFindMode = ->
Marks.setPreviousPosition()
new FindMode()
-VimiumHelpDialog =
+window.VimiumHelpDialog =
container: null
dialogElement: null
@@ -786,7 +786,10 @@ VimiumHelpDialog =
@dialogElement = @container.querySelector "#vimiumHelpDialog"
- @dialogElement.getElementsByClassName("closeButton")[0].addEventListener("click", hideHelpDialog, false)
+ @dialogElement.getElementsByClassName("closeButton")[0].addEventListener("click", (clickEvent) =>
+ clickEvent.preventDefault()
+ @hide()
+ false)
@dialogElement.getElementsByClassName("optionsPage")[0].addEventListener("click", (clickEvent) ->
clickEvent.preventDefault()
chrome.runtime.sendMessage({handler: "openOptionsPageInNewTab"})
@@ -797,6 +800,7 @@ VimiumHelpDialog =
isReady: -> document.body? and @container?
show: (html) ->
+ return if isShowingHelpDialog or !@isReady()
isShowingHelpDialog = true
for placeholder, htmlString of html
@dialogElement.querySelector("#help-dialog-#{placeholder}").innerHTML = htmlString
@@ -828,20 +832,12 @@ VimiumHelpDialog =
addOrRemove = if visible then "add" else "remove"
VimiumHelpDialog.dialogElement.classList[addOrRemove] "showAdvanced"
-window.showHelpDialog = (html) ->
- return if isShowingHelpDialog or !VimiumHelpDialog.isReady()
- VimiumHelpDialog.show html
-
-hideHelpDialog = (clickEvent) ->
- VimiumHelpDialog.hide()
- clickEvent?.preventDefault()
-
toggleHelpDialog = (html, fid) ->
return unless fid == frameId
if isShowingHelpDialog
- hideHelpDialog()
+ VimiumHelpDialog.hide()
else
- showHelpDialog html
+ VimiumHelpDialog.show html
initializePreDomReady()
DomUtils.documentReady initializeOnDomReady
diff --git a/pages/options.coffee b/pages/options.coffee
index 1cbe88fa..4cc451ff 100644
--- a/pages/options.coffee
+++ b/pages/options.coffee
@@ -231,7 +231,7 @@ initOptionsPage = ->
event.preventDefault()
activateHelpDialog = ->
- showHelpDialog chrome.extension.getBackgroundPage().helpDialogHtml(true, true, "Command Listing"), frameId
+ VimiumHelpDialog.show chrome.extension.getBackgroundPage().helpDialogHtml(true, true, "Command Listing"), frameId
# Prevent the "show help" link from retaining the focus when clicked.
document.activeElement.blur()