diff options
| author | Stephen Blott | 2015-01-04 09:29:36 +0000 |
|---|---|---|
| committer | Stephen Blott | 2015-01-04 13:00:50 +0000 |
| commit | 9ae4b6c10d53153929d905f28bc7de57c0ba6dfe (patch) | |
| tree | e6243e08f2f4e0925c3960dd68381d917d46a510 /background_scripts | |
| parent | 615f8a79f91f1d868465a6dae903c6710103515f (diff) | |
| download | vimium-9ae4b6c10d53153929d905f28bc7de57c0ba6dfe.tar.bz2 | |
Modes; various improvements.
- Add StateMode.
- PasskeysMode is a StateMode.
- BadgeUpdateMode is a StateMode.
- Improve badge handling.
- Add push method to Mode.
- Document how modes work.
- Cache badge on background page to reduce the number of updates.
- Remove badge restriction on document.body?.tagName.toLowerCase() == "frameset".
- Add ExitOnEscape mode, use it for ConstrainedMode and FindMode.
- Move PostFindMode to its own file.
Diffstat (limited to 'background_scripts')
| -rw-r--r-- | background_scripts/main.coffee | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/background_scripts/main.coffee b/background_scripts/main.coffee index fc0a792f..008eb89f 100644 --- a/background_scripts/main.coffee +++ b/background_scripts/main.coffee @@ -342,8 +342,13 @@ setBrowserActionIcon = (tabId,path) -> # This color should match the blue of the Vimium browser popup (although it looks a little darker, to me?). chrome.browserAction.setBadgeBackgroundColor {color: [102, 176, 226, 255]} -setBadge = (request) -> - chrome.browserAction.setBadgeText {text: request.badge || ""} +setBadge = do -> + current = "" + (request) -> + badge = request.badge + if badge? and badge != current + chrome.browserAction.setBadgeText {text: badge || ""} + current = badge # Updates the browserAction icon to indicate whether Vimium is enabled or disabled on the current page. # Also propagates new enabled/disabled/passkeys state to active window, if necessary. |
