diff options
| -rw-r--r-- | content_scripts/vimium_frontend.coffee | 12 | ||||
| -rw-r--r-- | content_scripts/vomnibar.coffee | 10 |
2 files changed, 6 insertions, 16 deletions
diff --git a/content_scripts/vimium_frontend.coffee b/content_scripts/vimium_frontend.coffee index 312c6bbe..a80093f9 100644 --- a/content_scripts/vimium_frontend.coffee +++ b/content_scripts/vimium_frontend.coffee @@ -141,9 +141,6 @@ installModes = -> initializeOnEnabledStateKnown = Utils.makeIdempotent -> installModes() -initializeUIComponents = Utils.makeIdempotent -> DomUtils.documentReady -> - Vomnibar.init() if DomUtils.isTopFrame() - # # Complete initialization work that should be done prior to DOMReady. # @@ -455,13 +452,8 @@ checkIfEnabledForUrl = do -> {isEnabledForUrl, passKeys, frameIsFocused} = response initializeOnEnabledStateKnown() normalMode.setPassKeys passKeys - # Initialize UI components, if necessary. We only initialize these once we know that Vimium is enabled; - # see #1838. We need to check this every time so that we can change state from disabled to enabled. - if isEnabledForUrl - initializeUIComponents() if frameIsFocused - else - # Hide the HUD if we're not enabled. - HUD.hide true, false # Immediate, do not update indicator. + # Hide the HUD if we're not enabled. + HUD.hide true, false unless isEnabledForUrl (frameIsFocused = windowIsFocused()) -> Frame.postMessage "isEnabledForUrl", {frameIsFocused, url: window.location.toString()} diff --git a/content_scripts/vomnibar.coffee b/content_scripts/vomnibar.coffee index 66494fc2..cbd2892c 100644 --- a/content_scripts/vomnibar.coffee +++ b/content_scripts/vomnibar.coffee @@ -48,8 +48,7 @@ Vomnibar = } init: -> - unless @vomnibarUI? - @vomnibarUI = new UIComponent "pages/vomnibar.html", "vomnibarFrame", -> + @vomnibarUI ?= new UIComponent "pages/vomnibar.html", "vomnibarFrame", -> # This function opens the vomnibar. It accepts options, a map with the values: # completer - The completer to fetch results from. @@ -58,10 +57,9 @@ Vomnibar = # newTab - Optional, boolean. Whether to open the result in a new tab. open: (sourceFrameId, options) -> @init() - if @vomnibarUI?.uiComponentIsReady - # The Vomnibar cannot coexist with the help dialog (it causes focus issues). - HelpDialog.abort() - @vomnibarUI.activate extend options, { name: "activate", sourceFrameId, focus: true } + # The Vomnibar cannot coexist with the help dialog (it causes focus issues). + HelpDialog.abort() + @vomnibarUI.activate extend options, { name: "activate", sourceFrameId, focus: true } root = exports ? window root.Vomnibar = Vomnibar |
