mirror of
https://github.com/gorhill/uMatrix.git
synced 2024-09-29 08:41:11 +13:00
no badge when count is zero
This commit is contained in:
parent
1908504895
commit
b42fd99bd0
1 changed files with 3 additions and 5 deletions
|
@ -568,20 +568,18 @@ PageStore.prototype.recordRequest = function(type, url, block) {
|
||||||
PageStore.prototype.updateBadge = function(tabId) {
|
PageStore.prototype.updateBadge = function(tabId) {
|
||||||
// Icon
|
// Icon
|
||||||
var iconPath;
|
var iconPath;
|
||||||
|
var badgeStr = '';
|
||||||
var total = this.perLoadAllowedRequestCount + this.perLoadBlockedRequestCount;
|
var total = this.perLoadAllowedRequestCount + this.perLoadBlockedRequestCount;
|
||||||
if ( total ) {
|
if ( total ) {
|
||||||
var squareSize = 19;
|
var squareSize = 19;
|
||||||
var greenSize = squareSize * Math.sqrt(this.perLoadAllowedRequestCount / total);
|
var greenSize = squareSize * Math.sqrt(this.perLoadAllowedRequestCount / total);
|
||||||
greenSize = greenSize < squareSize/2 ? Math.ceil(greenSize) : Math.floor(greenSize);
|
greenSize = greenSize < squareSize/2 ? Math.ceil(greenSize) : Math.floor(greenSize);
|
||||||
iconPath = 'img/browsericons/icon19-' + greenSize + '.png';
|
iconPath = 'img/browsericons/icon19-' + greenSize + '.png';
|
||||||
|
badgeStr = µm.formatCount(this.distinctRequestCount);
|
||||||
} else {
|
} else {
|
||||||
iconPath = 'img/browsericons/icon19.png';
|
iconPath = 'img/browsericons/icon19.png';
|
||||||
}
|
}
|
||||||
µm.XAL.setIcon(
|
µm.XAL.setIcon(tabId, iconPath, badgeStr);
|
||||||
tabId,
|
|
||||||
iconPath,
|
|
||||||
µm.formatCount(this.distinctRequestCount)
|
|
||||||
);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/******************************************************************************/
|
/******************************************************************************/
|
||||||
|
|
Loading…
Reference in a new issue