Show badge-notification for regional Ad.nl sites
Only Ad.nl option for regional sites (and therefore in enabledSites).
This commit is contained in:
parent
f4e2e26434
commit
53aaf16f5a
@ -313,6 +313,8 @@ chrome.webRequest.onBeforeRequest.addListener(function (details) {
|
||||
},
|
||||
["blocking"]);
|
||||
|
||||
// list of regional ad.nl sites
|
||||
const ad_region_domains = ['bd.nl', 'ed.nl', 'tubantia.nl', 'bndestem.nl', 'pzc.nl', 'destentor.nl', 'gelderlander.nl'];
|
||||
chrome.webRequest.onBeforeSendHeaders.addListener(function(details) {
|
||||
var requestHeaders = details.requestHeaders;
|
||||
|
||||
@ -336,7 +338,6 @@ chrome.webRequest.onBeforeSendHeaders.addListener(function(details) {
|
||||
|
||||
// remove cookies for regional ADR sites of ad.nl (mainfest.json needs in permissions: <all_urls>)
|
||||
if (isSiteEnabled({url: '.ad.nl'})) {
|
||||
const ad_region_domains = ['bd.nl', 'ed.nl', 'tubantia.nl', 'bndestem.nl', 'pzc.nl', 'destentor.nl', 'gelderlander.nl'];
|
||||
var domainVar = new URL(details.url).hostname.replace('www.', '');
|
||||
if (ad_region_domains.includes(domainVar)) {
|
||||
chrome.cookies.getAll({domain: domainVar}, function(cookies) {
|
||||
@ -476,7 +477,13 @@ function updateBadge() {
|
||||
}
|
||||
|
||||
function getTextB(currentUrl) {
|
||||
return currentUrl && isSiteEnabled({url: currentUrl}) ? 'ON' : '';
|
||||
// check regional ad.nl site
|
||||
let is_adr_site = false;
|
||||
if (currentUrl && isSiteEnabled({url: '.ad.nl'})) {
|
||||
let domainVar = new URL(currentUrl).hostname.replace('www.', '');
|
||||
is_adr_site = ad_region_domains.includes(domainVar);
|
||||
}
|
||||
return currentUrl && (isSiteEnabled({url: currentUrl}) || is_adr_site) ? 'ON' : '';
|
||||
}
|
||||
|
||||
// remove cookies after page load
|
||||
|
Loading…
x
Reference in New Issue
Block a user