Fix updateBadge (custom sites disabled)
parent
a7414841b1
commit
1b5e965e2f
|
@ -761,6 +761,7 @@ function updateBadge (activeTab) {
|
||||||
let currentUrl = activeTab.url;
|
let currentUrl = activeTab.url;
|
||||||
if (currentUrl) {
|
if (currentUrl) {
|
||||||
let isDefaultSite = matchUrlDomain(defaultSites_domains, currentUrl);
|
let isDefaultSite = matchUrlDomain(defaultSites_domains, currentUrl);
|
||||||
|
let isCustomSite = matchUrlDomain(customSites_domains, currentUrl);
|
||||||
if (isSiteEnabled({url: currentUrl})) {
|
if (isSiteEnabled({url: currentUrl})) {
|
||||||
badgeText = 'ON';
|
badgeText = 'ON';
|
||||||
color = 'red';
|
color = 'red';
|
||||||
|
@ -771,10 +772,27 @@ function updateBadge (activeTab) {
|
||||||
badgeText = 'OFF';
|
badgeText = 'OFF';
|
||||||
color = 'blue';
|
color = 'blue';
|
||||||
}
|
}
|
||||||
|
if (!isDefaultSite) {
|
||||||
|
if (isCustomSite) {
|
||||||
|
ext_api.permissions.contains({
|
||||||
|
origins: ["<all_urls>"]
|
||||||
|
}, function (result) {
|
||||||
|
if (!result)
|
||||||
|
badgeText = '';
|
||||||
|
if (color && badgeText)
|
||||||
|
ext_api.browserAction.setBadgeBackgroundColor({color: color});
|
||||||
|
ext_api.browserAction.setBadgeText({text: badgeText});
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
ext_api.browserAction.setBadgeText({text: ''});
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
ext_api.browserAction.setBadgeBackgroundColor({color: color});
|
ext_api.browserAction.setBadgeBackgroundColor({color: color});
|
||||||
ext_api.browserAction.setBadgeText({text: badgeText});
|
ext_api.browserAction.setBadgeText({text: badgeText});
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
function site_switch() {
|
function site_switch() {
|
||||||
ext_api.tabs.query({
|
ext_api.tabs.query({
|
||||||
|
|
|
@ -6,6 +6,7 @@ Add Deutsche Wirtschafts Nachrichten
|
||||||
Add WirtschaftsWoche (Germany)
|
Add WirtschaftsWoche (Germany)
|
||||||
Fix-update Quartz (newsletter)
|
Fix-update Quartz (newsletter)
|
||||||
Fix-update Sueddeutsche Zeitung (+ magazine)
|
Fix-update Sueddeutsche Zeitung (+ magazine)
|
||||||
|
Fix updateBadge (custom site disabled)
|
||||||
Icon for dark/incognito mode (Chrome)
|
Icon for dark/incognito mode (Chrome)
|
||||||
Save options to storage.local (quota exceeded)
|
Save options to storage.local (quota exceeded)
|
||||||
|
|
||||||
|
|
|
@ -321,6 +321,7 @@
|
||||||
"*://*.destentor.nl/*",
|
"*://*.destentor.nl/*",
|
||||||
"*://*.tubantia.nl/*",
|
"*://*.tubantia.nl/*",
|
||||||
"storage",
|
"storage",
|
||||||
|
"tabs",
|
||||||
"webRequest",
|
"webRequest",
|
||||||
"webRequestBlocking"
|
"webRequestBlocking"
|
||||||
],
|
],
|
||||||
|
|
Loading…
Reference in New Issue