mirror of
https://github.com/gorhill/uMatrix.git
synced 2024-09-29 16:51:13 +13:00
code review
This commit is contained in:
parent
eb42375215
commit
dbe14694c8
2 changed files with 12 additions and 13 deletions
|
@ -10,7 +10,7 @@
|
||||||
},
|
},
|
||||||
"browser_action": {
|
"browser_action": {
|
||||||
"default_icon": {
|
"default_icon": {
|
||||||
"19": "img/browsericons/icon19-off.png"
|
"19": "img/browsericons/icon19-19.png"
|
||||||
},
|
},
|
||||||
"default_title": "µMatrix",
|
"default_title": "µMatrix",
|
||||||
"default_popup": "popup.html"
|
"default_popup": "popup.html"
|
||||||
|
|
|
@ -142,20 +142,19 @@ return asyncJobManager;
|
||||||
var updateBadge = function(tabId) {
|
var updateBadge = function(tabId) {
|
||||||
delete tabIdToTimer[tabId];
|
delete tabIdToTimer[tabId];
|
||||||
|
|
||||||
var pageStore = this.pageStoreFromTabId(tabId);
|
|
||||||
if ( pageStore === null ) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
var iconId = null;
|
var iconId = null;
|
||||||
var badgeStr = '';
|
var badgeStr = '';
|
||||||
var total = pageStore.perLoadAllowedRequestCount +
|
|
||||||
pageStore.perLoadBlockedRequestCount;
|
var pageStore = this.pageStoreFromTabId(tabId);
|
||||||
if ( total ) {
|
if ( pageStore !== null ) {
|
||||||
var squareSize = 19;
|
var total = pageStore.perLoadAllowedRequestCount +
|
||||||
var greenSize = squareSize * Math.sqrt(pageStore.perLoadAllowedRequestCount / total);
|
pageStore.perLoadBlockedRequestCount;
|
||||||
iconId = greenSize < squareSize/2 ? Math.ceil(greenSize) : Math.floor(greenSize);
|
if ( total ) {
|
||||||
badgeStr = this.formatCount(pageStore.distinctRequestCount);
|
var squareSize = 19;
|
||||||
|
var greenSize = squareSize * Math.sqrt(pageStore.perLoadAllowedRequestCount / total);
|
||||||
|
iconId = greenSize < squareSize/2 ? Math.ceil(greenSize) : Math.floor(greenSize);
|
||||||
|
badgeStr = this.formatCount(pageStore.distinctRequestCount);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
vAPI.setIcon(tabId, iconId, badgeStr);
|
vAPI.setIcon(tabId, iconId, badgeStr);
|
||||||
|
|
Loading…
Reference in a new issue