Added setBadgeError function.

This commit is contained in:
Kerrick Long
2011-07-15 10:24:42 -05:00
parent b7543ffccc
commit 0787fd0cff
+19
View File
@@ -171,6 +171,25 @@ BrowserAction.prototype.setBadgeLoading = function (tabId) {
return true;
};
/**
* Set the browser icon badge to its error state.
* @alias BrowserAction.setBadgeError(tabId, text)
* @param {Number} tabId If given, only sets loading state for this tab.
* @param {String} text Sets the badge's hover text.
* @return {Boolean} Returns true.
* @method
*/
BrowserAction.prototype.setBadgeError = function (tabId, text) {
chrome.browserAction.setBadgeText({'text': '×', 'tabId': tabId});
chrome.browserAction.setTitle({'title': text, 'tabId': tabId});
chrome.browserAction.setBadgeBackgroundColor({'color': [255, 0, 255, 255], 'tabId': tabId});
chrome.browserAction.setPopup({popup: '', tabId: tabId});
chrome.browserAction.onClicked.addListener(function(tab) {
reddit.getInfo(tab.url, tab.id);
});
return true;
};
/**
* Set the browser icon badge for a page.
* @alias BrowserAction.setBadgeFor(url, tabId)