aboutsummaryrefslogtreecommitdiffstats
path: root/content_scripts/mode.coffee
diff options
context:
space:
mode:
authorStephen Blott2015-01-02 14:21:20 +0000
committerStephen Blott2015-01-02 14:21:20 +0000
commit425eb0dd84c1d3bf3eb854bda68140db8c46cb7a (patch)
treecf549b4aa373070af6da0444b90a0d59f1d5b11e /content_scripts/mode.coffee
parentb179d80ac9c35eb85de3995e4c4fb7dc9945ed75 (diff)
downloadvimium-425eb0dd84c1d3bf3eb854bda68140db8c46cb7a.tar.bz2
Modes; better frame handling.
Diffstat (limited to 'content_scripts/mode.coffee')
-rw-r--r--content_scripts/mode.coffee11
1 files changed, 8 insertions, 3 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) ->