mirror of
https://gitlab.com/magnolia1234/bypass-paywalls-firefox-clean.git
synced 2024-11-10 06:37:47 +01:00
Update Ad.nl (regional)
This commit is contained in:
parent
3cb82e8581
commit
b6749668b8
2 changed files with 19 additions and 30 deletions
|
@ -84,16 +84,22 @@ const remove_cookies_select_hold = {
|
||||||
'wsj.com': ['wsjregion']
|
'wsj.com': ['wsjregion']
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// list of regional ad.nl sites
|
||||||
|
const ad_region_domains = ['bd.nl', 'ed.nl', 'tubantia.nl', 'bndestem.nl', 'pzc.nl', 'destentor.nl', 'gelderlander.nl'];
|
||||||
|
|
||||||
// select only specific cookie(s) to drop from remove_cookies domains
|
// select only specific cookie(s) to drop from remove_cookies domains
|
||||||
const remove_cookies_select_drop = {
|
var remove_cookies_select_drop = {
|
||||||
'ad.nl': ['temptationTrackingId'],
|
'ad.nl': ['temptationTrackingId'],
|
||||||
'caixinglobal.com': ['CAIXINGLB_LOGIN_UUID'],
|
'caixinglobal.com': ['CAIXINGLB_LOGIN_UUID'],
|
||||||
'demorgen.be': ['TID_ID'],
|
|
||||||
'dn.se': ['randomSplusId'],
|
'dn.se': ['randomSplusId'],
|
||||||
'fd.nl': ['socialread'],
|
'fd.nl': ['socialread'],
|
||||||
'nrc.nl': ['counter'],
|
'nrc.nl': ['counter'],
|
||||||
'theatlantic.com': ['articleViews']
|
'theatlantic.com': ['articleViews']
|
||||||
}
|
}
|
||||||
|
for (var domainIndex in ad_region_domains) {
|
||||||
|
let domain = ad_region_domains[domainIndex];
|
||||||
|
remove_cookies_select_drop[domain] = ['temptationTrackingId'];
|
||||||
|
}
|
||||||
|
|
||||||
// Override User-Agent with Googlebot
|
// Override User-Agent with Googlebot
|
||||||
const use_google_bot_default = [
|
const use_google_bot_default = [
|
||||||
|
@ -152,10 +158,10 @@ var blockedRegexes = {
|
||||||
'elpais.com': /.+\.epimg\.net\/js\/.+\/noticia\.min\.js/,
|
'elpais.com': /.+\.epimg\.net\/js\/.+\/noticia\.min\.js/,
|
||||||
'exame.abril.com.br': /.+\.tinypass\.com\/.+/,
|
'exame.abril.com.br': /.+\.tinypass\.com\/.+/,
|
||||||
'folha.uol.com.br': /.+\.folha\.uol\.com\.br\/paywall\/js\/.+\/publicidade\.ads\.js/,
|
'folha.uol.com.br': /.+\.folha\.uol\.com\.br\/paywall\/js\/.+\/publicidade\.ads\.js/,
|
||||||
'gestion.pe': /gestion\.pe\/pf\/dist\/template\/gestion-noticia\/default.js/,
|
|
||||||
'globo.com': /.+\.tinypass\.com\/.+/,
|
'globo.com': /.+\.tinypass\.com\/.+/,
|
||||||
'foreignpolicy.com': /.+\.tinypass\.com\/.+/,
|
'foreignpolicy.com': /.+\.tinypass\.com\/.+/,
|
||||||
'fortune.com': /.+\.tinypass\.com\/.+/,
|
'fortune.com': /.+\.tinypass\.com\/.+/,
|
||||||
|
'gestion.pe': /gestion\.pe\/pf\/dist\/template\/gestion-noticia\/default.js/,
|
||||||
'haaretz.co.il': /haaretz\.co\.il\/htz\/js\/inter\.js/,
|
'haaretz.co.il': /haaretz\.co\.il\/htz\/js\/inter\.js/,
|
||||||
'haaretz.com': /haaretz\.com\/hdc\/web\/js\/minified\/header-scripts-int.js.+/,
|
'haaretz.com': /haaretz\.com\/hdc\/web\/js\/minified\/header-scripts-int.js.+/,
|
||||||
'inquirer.com': /.+\.tinypass\.com\/.+/,
|
'inquirer.com': /.+\.tinypass\.com\/.+/,
|
||||||
|
@ -231,6 +237,9 @@ ext_api.storage.sync.get({
|
||||||
}).map(function (key) {
|
}).map(function (key) {
|
||||||
return sites[key].toLowerCase();
|
return sites[key].toLowerCase();
|
||||||
});
|
});
|
||||||
|
if (enabledSites.includes('ad.nl')) {
|
||||||
|
enabledSites = enabledSites.concat(ad_region_domains);
|
||||||
|
}
|
||||||
|
|
||||||
for (var domainIndex in enabledSites) {
|
for (var domainIndex in enabledSites) {
|
||||||
var domainVar = enabledSites[domainIndex];
|
var domainVar = enabledSites[domainIndex];
|
||||||
|
@ -260,13 +269,15 @@ ext_api.storage.onChanged.addListener(function (changes, namespace) {
|
||||||
}).map(function (key) {
|
}).map(function (key) {
|
||||||
return sites[key];
|
return sites[key];
|
||||||
});
|
});
|
||||||
|
if (enabledSites.includes('ad.nl')) {
|
||||||
|
enabledSites = enabledSites.concat(ad_region_domains);
|
||||||
|
}
|
||||||
// reset disableJavascriptOnListedSites eventListener
|
// reset disableJavascriptOnListedSites eventListener
|
||||||
ext_api.webRequest.onBeforeRequest.removeListener(disableJavascriptOnListedSites);
|
ext_api.webRequest.onBeforeRequest.removeListener(disableJavascriptOnListedSites);
|
||||||
ext_api.webRequest.handlerBehaviorChanged();
|
ext_api.webRequest.handlerBehaviorChanged();
|
||||||
}
|
}
|
||||||
if (key === 'sites_custom') {
|
if (key === 'sites_custom') {
|
||||||
var sites_custom = storageChange.newValue;
|
var sites_custom = storageChange.newValue;
|
||||||
|
|
||||||
use_google_bot_custom = Object.keys(sites_custom).filter(function (key) {
|
use_google_bot_custom = Object.keys(sites_custom).filter(function (key) {
|
||||||
return sites_custom[key]['googlebot'] > 0;
|
return sites_custom[key]['googlebot'] > 0;
|
||||||
}).map(function (key) {
|
}).map(function (key) {
|
||||||
|
@ -279,7 +290,6 @@ ext_api.storage.onChanged.addListener(function (changes, namespace) {
|
||||||
use_google_bot.push(domainVar);
|
use_google_bot.push(domainVar);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
block_js_custom = Object.keys(sites_custom).filter(function (key) {
|
block_js_custom = Object.keys(sites_custom).filter(function (key) {
|
||||||
return sites_custom[key]['block_javascript'] > 0;
|
return sites_custom[key]['block_javascript'] > 0;
|
||||||
}).map(function (key) {
|
}).map(function (key) {
|
||||||
|
@ -345,8 +355,6 @@ var extraInfoSpec = ['blocking', 'requestHeaders'];
|
||||||
if (ext_api.webRequest.OnBeforeSendHeadersOptions.hasOwnProperty('EXTRA_HEADERS'))
|
if (ext_api.webRequest.OnBeforeSendHeadersOptions.hasOwnProperty('EXTRA_HEADERS'))
|
||||||
extraInfoSpec.push('extraHeaders');
|
extraInfoSpec.push('extraHeaders');
|
||||||
|
|
||||||
// list of regional ad.nl sites
|
|
||||||
const ad_region_domains = ['bd.nl', 'ed.nl', 'tubantia.nl', 'bndestem.nl', 'pzc.nl', 'destentor.nl', 'gelderlander.nl'];
|
|
||||||
ext_api.webRequest.onBeforeSendHeaders.addListener(function(details) {
|
ext_api.webRequest.onBeforeSendHeaders.addListener(function(details) {
|
||||||
var requestHeaders = details.requestHeaders;
|
var requestHeaders = details.requestHeaders;
|
||||||
|
|
||||||
|
@ -368,20 +376,6 @@ ext_api.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'})) {
|
|
||||||
var domainVar = new URL(details.url).hostname.replace('www.', '');
|
|
||||||
if (ad_region_domains.includes(domainVar)) {
|
|
||||||
ext_api.cookies.getAll({domain: domainVar}, function(cookies) {
|
|
||||||
for (var i=0; i<cookies.length; i++) {
|
|
||||||
if (remove_cookies_select_drop['ad.nl'].includes(cookies[i].name)){
|
|
||||||
ext_api.cookies.remove({url: (cookies[i].secure ? "https://" : "http://") + cookies[i].domain + cookies[i].path, name: cookies[i].name});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// check for blocked regular expression: domain enabled, match regex, block on an internal or external regex
|
// check for blocked regular expression: domain enabled, match regex, block on an internal or external regex
|
||||||
for (var domain in blockedRegexes) {
|
for (var domain in blockedRegexes) {
|
||||||
if ((isSiteEnabled({url: '.'+ domain}) || isSiteEnabled({url: header_referer})) && details.url.match(blockedRegexes[domain])) {
|
if ((isSiteEnabled({url: '.'+ domain}) || isSiteEnabled({url: header_referer})) && details.url.match(blockedRegexes[domain])) {
|
||||||
|
@ -513,13 +507,7 @@ function updateBadge() {
|
||||||
}
|
}
|
||||||
|
|
||||||
function getTextB(currentUrl) {
|
function getTextB(currentUrl) {
|
||||||
// check regional ad.nl site
|
return currentUrl && isSiteEnabled({url: currentUrl}) ? 'ON' : '';
|
||||||
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
|
// remove cookies after page load
|
||||||
|
|
|
@ -96,9 +96,10 @@ else if (matchDomain('telegraaf.nl')) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
else if (matchDomain('ad.nl')) {
|
else if (matchDomain(['ad.nl', 'bd.nl', 'ed.nl', 'tubantia.nl', 'bndestem.nl', 'pzc.nl', 'destentor.nl', 'gelderlander.nl'])) {
|
||||||
let paywall = document.querySelector('.article__component.article__component--paywall-module-notification');
|
let paywall = document.querySelector('.article__component.article__component--paywall-module-notification');
|
||||||
removeDOMElement(paywall);
|
let modal_login = document.querySelector('.modal--login');
|
||||||
|
removeDOMElement(paywall, modal_login);
|
||||||
}
|
}
|
||||||
|
|
||||||
else if (matchDomain("washingtonpost.com")) {
|
else if (matchDomain("washingtonpost.com")) {
|
||||||
|
|
Loading…
Reference in a new issue