aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStephen Blott2015-01-02 14:21:20 +0000
committerStephen Blott2015-01-02 14:21:20 +0000
commit425eb0dd84c1d3bf3eb854bda68140db8c46cb7a (patch)
treecf549b4aa373070af6da0444b90a0d59f1d5b11e
parentb179d80ac9c35eb85de3995e4c4fb7dc9945ed75 (diff)
downloadvimium-425eb0dd84c1d3bf3eb854bda68140db8c46cb7a.tar.bz2
Modes; better frame handling.
-rw-r--r--content_scripts/mode.coffee11
-rw-r--r--content_scripts/vimium_frontend.coffee3
2 files changed, 10 insertions, 4 deletions
diff --git a/content_scripts/mode.coffee b/content_scripts/mode.coffee
index 9016caa2..7ca818b4 100644
--- a/content_scripts/mode.coffee
+++ b/content_scripts/mode.coffee
@@ -59,10 +59,15 @@ class Mode
handlerStack.alwaysPropagate => badge.badge ||= @badge
# Static method. Used externally and internally to initiate bubbling of an updateBadgeForMode event.
+ # Do not update the badge:
+ # - if this document does not have the focus, or
+ # - if the document's body is a frameset
@updateBadge: ->
- badge = {badge: ""}
- handlerStack.bubbleEvent "updateBadgeForMode", badge
- Mode.sendBadge badge.badge
+ if document.hasFocus()
+ unless document.body?.tagName.toLowerCase() == "frameset"
+ badge = {badge: ""}
+ handlerStack.bubbleEvent "updateBadgeForMode", badge
+ Mode.sendBadge badge.badge
# Static utility to update the browser-popup badge.
@sendBadge: (badge) ->
diff --git a/content_scripts/vimium_frontend.coffee b/content_scripts/vimium_frontend.coffee
index 6d63b24a..7ce3e988 100644
--- a/content_scripts/vimium_frontend.coffee
+++ b/content_scripts/vimium_frontend.coffee
@@ -201,7 +201,7 @@ initializeWhenEnabled = (newPassKeys) ->
# installListener document, "focus", onFocusCapturePhase # No longer needed.
installListener document, "blur", onBlurCapturePhase
installListener document, "DOMActivate", onDOMActivate
- installListener document, "focus", onFocus
+ installListener document, "focusin", onFocus
installListener document, "blur", onBlur
enterInsertModeIfElementIsFocused()
installedListeners = true
@@ -281,6 +281,7 @@ window.focusThisFrame = (shouldHighlight) ->
chrome.runtime.sendMessage({ handler: "nextFrame", frameId: frameId })
return
window.focus()
+ Mode.updateBadge()
if (document.body && shouldHighlight)
borderWas = document.body.style.border
document.body.style.border = '5px solid yellow'