diff options
Diffstat (limited to 'js/background.js')
-rw-r--r-- | js/background.js | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/js/background.js b/js/background.js index b6260d7..35b1243 100644 --- a/js/background.js +++ b/js/background.js @@ -23,3 +23,28 @@ var isFirefox = !!navigator.userAgent.match(/Firefox\//); var ev = isFirefox ? chrome.webRequest.onBeforeSendHeaders : chrome.webRequest.onBeforeRequest; ev.addListener(checkForRedirect, filter, ["blocking"]); + +var storage = chrome.storage.local; //TODO: Change to sync when Firefox supports it... + + +//Icon updating code below + +function updateIcon() { + storage.get({disabled:false}, function(obj) { + chrome.browserAction.setIcon({ + path: { + 19: obj.disabled ? "images/icon19disabled.png" : "images/icon19active.png", + 38: obj.disabled ? "images/icon38disabled.png" : "images/icon38active.png" + } + }); + }); +} + +updateIcon(); + +chrome.storage.onChanged.addListener(function(changes, namespace) { + if (changes.disabled) { + updateIcon(); + } +}); +
\ No newline at end of file |