|
|
|
@ -245,7 +245,7 @@ vAPI.tabs.injectScript = function(tabId, details, callback) {
|
|
|
|
|
// Since we may be called asynchronously, the tab id may not exist
|
|
|
|
|
// anymore, so this ensures it does still exist.
|
|
|
|
|
|
|
|
|
|
vAPI.setIcon = function(tabId, img, badge) {
|
|
|
|
|
vAPI.setIcon = function(tabId, iconStatus, badge) {
|
|
|
|
|
tabId = parseInt(tabId, 10);
|
|
|
|
|
var onIconReady = function() {
|
|
|
|
|
if ( vAPI.lastError() ) {
|
|
|
|
@ -253,10 +253,18 @@ vAPI.setIcon = function(tabId, img, badge) {
|
|
|
|
|
}
|
|
|
|
|
chrome.browserAction.setBadgeText({ tabId: tabId, text: badge });
|
|
|
|
|
if ( badge !== '' ) {
|
|
|
|
|
chrome.browserAction.setBadgeBackgroundColor({ tabId: tabId, color: '#666' });
|
|
|
|
|
chrome.browserAction.setBadgeBackgroundColor({
|
|
|
|
|
tabId: tabId,
|
|
|
|
|
color: '#666'
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
chrome.browserAction.setIcon({ tabId: tabId, path: img }, onIconReady);
|
|
|
|
|
|
|
|
|
|
var iconPaths = iconStatus === 'on' ?
|
|
|
|
|
{ '19': 'img/browsericons/icon19.png', '38': 'img/browsericons/icon38.png' } :
|
|
|
|
|
{ '19': 'img/browsericons/icon19-off.png', '38': 'img/browsericons/icon38-off.png' };
|
|
|
|
|
|
|
|
|
|
chrome.browserAction.setIcon({ tabId: tabId, path: iconPaths }, onIconReady);
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
/******************************************************************************/
|
|
|
|
|