diff --git a/html/background.html b/html/background.html index 29fd089..bd15bb3 100644 --- a/html/background.html +++ b/html/background.html @@ -15,7 +15,7 @@ background.clearCache(); chrome.tabs.onUpdated.addListener(background.prepareBrowserAction); background.watchMail(); - window.setInterval(background.clearCache, settings.cacheTime * 60 * 1000); + window.setInterval(background.clearCache, (settings.get('cacheTime') * 60 * 1000)); reddit.getReddits(); } diff --git a/js/common.js b/js/common.js index 579ed29..10bb8fe 100644 --- a/js/common.js +++ b/js/common.js @@ -216,13 +216,32 @@ BrowserAction.prototype.handleManualClick = function (tab) { * @method */ BrowserAction.prototype.setBadgeDefaults = function (tabId) { - chrome.browserAction.setIcon({'path': '/pix/alien-fade.png', 'tabId': tabId}); - chrome.browserAction.setBadgeText({'text': '?', 'tabId': tabId}); - chrome.browserAction.setTitle({'title': 'Click to load data.', 'tabId': tabId}); - chrome.browserAction.setBadgeBackgroundColor({'color': [192, 192, 192, 255], 'tabId': tabId}); - chrome.browserAction.setPopup({popup: '', tabId: tabId}); - chrome.browserAction.onClicked.addListener(this.handleManualClick); - return true; + var tabArray; + + function setTheseBadgeDefaults (tabArray) { + utils.forEach(tabArray, function (tab) { + chrome.browserAction.setIcon({'path': '/pix/alien-fade.png', 'tabId': tab.id}); + chrome.browserAction.setBadgeText({'text': '?', 'tabId': tab.id}); + chrome.browserAction.setTitle({'title': 'Click to load data.', 'tabId': tab.id}); + chrome.browserAction.setBadgeBackgroundColor({'color': [192, 192, 192, 255], 'tabId': tab.id}); + chrome.browserAction.setPopup({popup: '', tabId: tab.id}); + }); + } + + if (typeof tabId !== 'undefined') { + chrome.tabs.get(tabId, function (tabs) { + tabArray = tabs; + setTheseBadgeDefaults(tabArray); + }); + } else { + chrome.tabs.query({}, function (tabs) { + tabArray = tabs; + setTheseBadgeDefaults(tabArray); + }); + } + + chrome.browserAction.onClicked.addListener(this.handleManualClick); + return true; }; /** diff --git a/manifest.json b/manifest.json index 7d94c4b..b675cd7 100644 --- a/manifest.json +++ b/manifest.json @@ -1,6 +1,6 @@ { "name": "Mostly Harmless", - "version": "1.4.0", + "version": "1.4.1", "description": "Find, vote on, save, hide, and report links on reddit; submit new links; These and more! http://kerrick.github.com/Mostly-Harmless", "browser_action": { "default_icon": "pix/alien.png",