diff options
| author | Stephen Blott | 2015-04-23 11:07:36 +0100 |
|---|---|---|
| committer | Stephen Blott | 2015-04-23 11:07:36 +0100 |
| commit | bfa6c88b41acac4c98d06f324f25f8bb7b328614 (patch) | |
| tree | c624300290dfa3d9506e40e17a2b8fddf5f2c407 /content_scripts/vomnibar.coffee | |
| parent | 9eaa7330b1e4952e171cf53db855cf447c8e1e49 (diff) | |
| download | vimium-bfa6c88b41acac4c98d06f324f25f8bb7b328614.tar.bz2 | |
Activate vomnibar in window.top; no flicker and tidy up.
1. Rework event handling to eliminate frame flicker (a la #1485).
2. Tidy up logic. Which should make this more robust.
Diffstat (limited to 'content_scripts/vomnibar.coffee')
| -rw-r--r-- | content_scripts/vomnibar.coffee | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/content_scripts/vomnibar.coffee b/content_scripts/vomnibar.coffee index 3d54e643..2529c077 100644 --- a/content_scripts/vomnibar.coffee +++ b/content_scripts/vomnibar.coffee @@ -40,9 +40,11 @@ Vomnibar = init: -> unless @vomnibarUI? @vomnibarUI = new UIComponent "pages/vomnibar.html", "vomnibarFrame", (event) => - if event.data == "hide" - @vomnibarUI.hide() - @vomnibarUI.postMessage "hidden" + @vomnibarUI.hide() if event.data == "hide" + # Whenever the window receives the focus, we tell the Vomnibar UI that it has been hidden (regardless of + # whether it was previously visible). + window.addEventListener "focus", (event) => + @vomnibarUI.postMessage "hidden" if event.target == window; true # This function opens the vomnibar. It accepts options, a map with the values: |
