mirror of
https://gitlab.com/magnolia1234/bypass-paywalls-firefox-clean.git
synced 2024-09-20 05:33:40 +02: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']
|
||||
}
|
||||
|
||||
// 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
|
||||
const remove_cookies_select_drop = {
|
||||
var remove_cookies_select_drop = {
|
||||
'ad.nl': ['temptationTrackingId'],
|
||||
'caixinglobal.com': ['CAIXINGLB_LOGIN_UUID'],
|
||||
'demorgen.be': ['TID_ID'],
|
||||
'dn.se': ['randomSplusId'],
|
||||
'fd.nl': ['socialread'],
|
||||
'nrc.nl': ['counter'],
|
||||
'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
|
||||
const use_google_bot_default = [
|
||||
|
@ -152,10 +158,10 @@ var blockedRegexes = {
|
|||
'elpais.com': /.+\.epimg\.net\/js\/.+\/noticia\.min\.js/,
|
||||
'exame.abril.com.br': /.+\.tinypass\.com\/.+/,
|
||||
'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\/.+/,
|
||||
'foreignpolicy.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.com': /haaretz\.com\/hdc\/web\/js\/minified\/header-scripts-int.js.+/,
|
||||
'inquirer.com': /.+\.tinypass\.com\/.+/,
|
||||
|
@ -231,6 +237,9 @@ ext_api.storage.sync.get({
|
|||
}).map(function (key) {
|
||||
return sites[key].toLowerCase();
|
||||
});
|
||||
if (enabledSites.includes('ad.nl')) {
|
||||
enabledSites = enabledSites.concat(ad_region_domains);
|
||||
}
|
||||
|
||||
for (var domainIndex in enabledSites) {
|
||||
var domainVar = enabledSites[domainIndex];
|
||||
|
@ -260,13 +269,15 @@ ext_api.storage.onChanged.addListener(function (changes, namespace) {
|
|||
}).map(function (key) {
|
||||
return sites[key];
|
||||
});
|
||||
if (enabledSites.includes('ad.nl')) {
|
||||
enabledSites = enabledSites.concat(ad_region_domains);
|
||||
}
|
||||
// reset disableJavascriptOnListedSites eventListener
|
||||
ext_api.webRequest.onBeforeRequest.removeListener(disableJavascriptOnListedSites);
|
||||
ext_api.webRequest.handlerBehaviorChanged();
|
||||
}
|
||||
if (key === 'sites_custom') {
|
||||
var sites_custom = storageChange.newValue;
|
||||
|
||||
use_google_bot_custom = Object.keys(sites_custom).filter(function (key) {
|
||||
return sites_custom[key]['googlebot'] > 0;
|
||||
}).map(function (key) {
|
||||
|
@ -279,7 +290,6 @@ ext_api.storage.onChanged.addListener(function (changes, namespace) {
|
|||
use_google_bot.push(domainVar);
|
||||
}
|
||||
}
|
||||
|
||||
block_js_custom = Object.keys(sites_custom).filter(function (key) {
|
||||
return sites_custom[key]['block_javascript'] > 0;
|
||||
}).map(function (key) {
|
||||
|
@ -345,8 +355,6 @@ var extraInfoSpec = ['blocking', 'requestHeaders'];
|
|||
if (ext_api.webRequest.OnBeforeSendHeadersOptions.hasOwnProperty('EXTRA_HEADERS'))
|
||||
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) {
|
||||
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
|
||||
for (var domain in blockedRegexes) {
|
||||
if ((isSiteEnabled({url: '.'+ domain}) || isSiteEnabled({url: header_referer})) && details.url.match(blockedRegexes[domain])) {
|
||||
|
@ -513,13 +507,7 @@ function updateBadge() {
|
|||
}
|
||||
|
||||
function getTextB(currentUrl) {
|
||||
// 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' : '';
|
||||
return currentUrl && isSiteEnabled({url: currentUrl}) ? 'ON' : '';
|
||||
}
|
||||
|
||||
// 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');
|
||||
removeDOMElement(paywall);
|
||||
let modal_login = document.querySelector('.modal--login');
|
||||
removeDOMElement(paywall, modal_login);
|
||||
}
|
||||
|
||||
else if (matchDomain("washingtonpost.com")) {
|
||||
|
|
Loading…
Reference in a new issue