Browse Source

Make vAPI.setIcon less Chromium specific

pull/2/head
Deathamns 10 years ago
committed by gorhill
parent
commit
847f86f947
  1. 14
      platform/chromium/vapi-background.js

14
platform/chromium/vapi-background.js

@ -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);
};
/******************************************************************************/

Loading…
Cancel
Save