aboutsummaryrefslogtreecommitdiffstats
path: root/pages
diff options
context:
space:
mode:
authorStephen Blott2015-03-06 11:50:55 +0000
committerStephen Blott2015-03-06 11:50:55 +0000
commit52c06b16325968289890dab2133f2ec33540fcb4 (patch)
tree9b0ec819f64b8fdfe91dbb06f5b4ec4bc776dba7 /pages
parent29eb444f2fb519a0cae32363d8462aa06ef133a7 (diff)
parentbc7a12dc74eaea06bcad23d89fb81643bd8b1625 (diff)
downloadvimium-52c06b16325968289890dab2133f2ec33540fcb4.tar.bz2
Merge branch 'hide-vomnibar-on-focus'
Diffstat (limited to 'pages')
-rw-r--r--pages/vomnibar.coffee11
1 files changed, 10 insertions, 1 deletions
diff --git a/pages/vomnibar.coffee b/pages/vomnibar.coffee
index 18a72a37..d0b7a7dd 100644
--- a/pages/vomnibar.coffee
+++ b/pages/vomnibar.coffee
@@ -38,6 +38,8 @@ Vomnibar =
@vomnibarUI.setQuery(options.query)
@vomnibarUI.update()
+ hide: -> @vomnibarUI?.hide()
+
class VomnibarUI
constructor: ->
@refreshInterval = 0
@@ -180,6 +182,12 @@ class VomnibarUI
@completionList.style.display = ""
window.addEventListener "focus", => @input.focus()
+ # A click in the vomnibar itself refocuses the input.
+ @box.addEventListener "click", (event) =>
+ @input.focus()
+ event.stopImmediatePropagation()
+ # A click anywhere else hides the vomnibar.
+ document.body.addEventListener "click", => @hide()
#
# Sends filter and refresh requests to a Vomnibox completer on the background page.
@@ -225,7 +233,8 @@ extend BackgroundCompleter,
switchToTab: (tabId) -> chrome.runtime.sendMessage({ handler: "selectSpecificTab", id: tabId })
-UIComponentServer.registerHandler (event) -> Vomnibar.activate event.data
+UIComponentServer.registerHandler (event) ->
+ if event.data == "hide" then Vomnibar.hide() else Vomnibar.activate event.data
root = exports ? window
root.Vomnibar = Vomnibar