Fixed: Undefined variable in badge text (#301)
This commit is contained in:
parent
0866f56ddd
commit
fe1e42bf0a
|
@ -85,15 +85,14 @@ interceptor._handleMissingCandidate = function (requestUrl, tabIdentifier) {
|
||||||
let requestUrlSegments, injectionCount, missingCount;
|
let requestUrlSegments, injectionCount, missingCount;
|
||||||
|
|
||||||
if (stateManager.showIconBadge === true) {
|
if (stateManager.showIconBadge === true) {
|
||||||
|
injectionCount = Object.keys(stateManager.tabs[tabIdentifier].injections).length || 0;
|
||||||
if (stateManager.changeBadgeColorMissingResources === true) {
|
if (stateManager.changeBadgeColorMissingResources === true) {
|
||||||
missingCount = stateManager.tabs[tabIdentifier].missing || 0;
|
missingCount = stateManager.tabs[tabIdentifier].missing || 0;
|
||||||
injectionCount = Object.keys(stateManager.tabs[tabIdentifier].injections).length || 0;
|
|
||||||
|
|
||||||
if (missingCount > 0 && injectionCount === 0) {
|
if (missingCount > 0 && injectionCount === 0) {
|
||||||
wrappers.setBadgeMissing(tabIdentifier, injectionCount);
|
wrappers.setBadgeMissing(tabIdentifier, injectionCount);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
wrappers.defaultBadge(tabIdentifier);
|
wrappers.defaultBadge(tabIdentifier, injectionCount);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -31,7 +31,7 @@ var stateManager = {};
|
||||||
*/
|
*/
|
||||||
|
|
||||||
stateManager.registerInjection = function (tabIdentifier, injection) {
|
stateManager.registerInjection = function (tabIdentifier, injection) {
|
||||||
let injectionIdentifier, registeredTab, injectionCount, missingCount, badgeText;
|
let injectionIdentifier, registeredTab, injectionCount, missingCount;
|
||||||
|
|
||||||
injectionIdentifier = injection.source + injection.path + injection.version;
|
injectionIdentifier = injection.source + injection.path + injection.version;
|
||||||
registeredTab = stateManager.tabs[tabIdentifier];
|
registeredTab = stateManager.tabs[tabIdentifier];
|
||||||
|
@ -39,20 +39,12 @@ stateManager.registerInjection = function (tabIdentifier, injection) {
|
||||||
|
|
||||||
injectionCount = Object.keys(registeredTab.injections).length || 0;
|
injectionCount = Object.keys(registeredTab.injections).length || 0;
|
||||||
missingCount = registeredTab.missing || 0;
|
missingCount = registeredTab.missing || 0;
|
||||||
badgeText = `${injectionCount}`;
|
|
||||||
|
|
||||||
if (injectionCount > 0) {
|
if (injectionCount > 0) {
|
||||||
chrome.browserAction.setTitle({
|
chrome.browserAction.setTitle({
|
||||||
'tabId': tabIdentifier,
|
'tabId': tabIdentifier,
|
||||||
'title': `LocalCDN (${injectionCount})`
|
'title': `LocalCDN (${injectionCount})`
|
||||||
});
|
});
|
||||||
|
|
||||||
if (stateManager.showIconBadge === true) {
|
|
||||||
wrappers.setBadgeText({
|
|
||||||
'tabId': tabIdentifier,
|
|
||||||
'text': badgeText
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if (stateManager.showIconBadge === true) {
|
if (stateManager.showIconBadge === true) {
|
||||||
if (missingCount > 0 && stateManager.changeBadgeColorMissingResources) {
|
if (missingCount > 0 && stateManager.changeBadgeColorMissingResources) {
|
||||||
|
|
Loading…
Reference in New Issue