diff options
| author | Daniel MacDougall | 2012-03-28 02:01:24 -0700 |
|---|---|---|
| committer | Daniel MacDougall | 2012-03-28 02:13:42 -0700 |
| commit | 2d92b45b28146e1ea46f87038827027ce1e00b51 (patch) | |
| tree | cf6dbf075e64e92c2e67a8715d33218e4286d6f5 /background_page.html | |
| parent | a26c50d33493782ec6cb19cbec9c12e5e48a0f8f (diff) | |
| download | vimium-2d92b45b28146e1ea46f87038827027ce1e00b51.tar.bz2 | |
Add browser icon that displays enabled/disabled state
Diffstat (limited to 'background_page.html')
| -rw-r--r-- | background_page.html | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/background_page.html b/background_page.html index aed9617b..881024c3 100644 --- a/background_page.html +++ b/background_page.html @@ -332,6 +332,14 @@ delete framesForTab[tab.id]; } + function updateIconState(tabId) { + if (openTabs[tabId]) { + var isEnabled = isEnabledForUrl({url: openTabs[tabId].url}).isEnabledForUrl; + var iconPath = isEnabled ? "icons/icon48.png" : "icons/icon48disabled.png"; + chrome.browserAction.setIcon({path: iconPath}); + } + } + function handleUpdateScrollPosition(request, sender) { updateScrollPosition(sender.tab, request.scrollX, request.scrollY); } @@ -345,6 +353,7 @@ chrome.tabs.onUpdated.addListener(function(tabId, changeInfo, tab) { if (changeInfo.status != "loading") { return; } // only do this once per URL change updateOpenTabs(tab); + updateIconState(tabId); }); chrome.tabs.onAttached.addListener(function(tabId, attachedInfo) { @@ -383,6 +392,10 @@ delete framesForTab[tabId]; }); + chrome.tabs.onActiveChanged.addListener(function(tabId, selectInfo) { + updateIconState(tabId); + }); + chrome.windows.onRemoved.addListener(function(windowId) { delete tabQueue[windowId]; }); |
