aboutsummaryrefslogtreecommitdiffstats
path: root/content_scripts
diff options
context:
space:
mode:
authormrmr19932016-02-03 04:14:01 +0000
committermrmr19932016-02-03 04:14:01 +0000
commit22db0d6191d1dba42b206327d1f1d58323314199 (patch)
tree802126666597afec86482232e4d335b2cee30d66 /content_scripts
parentfe71d59bcdedf970d5b6eaaf206b85175b82f33f (diff)
downloadvimium-22db0d6191d1dba42b206327d1f1d58323314199.tar.bz2
Remove redundant functions show/hideHelpDialog
Diffstat (limited to 'content_scripts')
-rw-r--r--content_scripts/vimium_frontend.coffee22
1 files changed, 9 insertions, 13 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