Add TownNews sites (local USA; opt-in to custom sites)

This commit is contained in:
magnolia1234 2022-01-15 12:08:31 +01:00
parent 0ef0eae7d3
commit 0517949e6b
5 changed files with 34 additions and 19 deletions

View File

@ -241,6 +241,7 @@ Grouped in options:\
[The Denver Post](https://www.denverpost.com) -
[The Mercury News](https://www.mercurynews.com) -
[The Press-Enterprise](https://www.pe.com)\
*TownNews sites (Blox CMS)* sites (opt-in to custom sites)\
*Tribune Publishing Company* sites like\
[Baltimore Sun](https://www.baltimoresun.com) -
[Capital Gazette](https://www.capitalgazette.com) -

View File

@ -740,7 +740,7 @@ ext_api.webRequest.onBeforeSendHeaders.addListener(function(details) {
// block script for additional Lee Enterprises sites (opt-in to custom sites)
var usa_lee_ent_domains = grouped_sites['###_usa_lee_ent'];
var usa_lee_ent_domain = (details.url.match(/\.townnews\.com\/central\.leetemplates\.com\//) && ['image'].includes(details.type) &&
var usa_lee_ent_domain = (details.url.match(/\.townnews\.com\/(central\.)?leetemplates\.com\//) && ['image', 'script'].includes(details.type) &&
!matchUrlDomain(usa_lee_ent_domains, header_referer) && enabledSites.includes('###_usa_lee_ent'));
if (usa_lee_ent_domain) {
let lee_ent_domain = urlHost(header_referer).replace(/^(www|m)\./, '');
@ -750,6 +750,18 @@ ext_api.webRequest.onBeforeSendHeaders.addListener(function(details) {
enabledSites.push(lee_ent_domain);
}
// block script for TownNews sites (Blox CMS; opt-in to custom sites)
var usa_townnews_domains = [];
var usa_townnews_domain = (details.url.match(/\.townnews\.com\/.+\/tncms\//) && ['image', 'script'].includes(details.type) &&
!matchUrlDomain(usa_townnews_domains.concat(usa_lee_ent_domains, 'townnews.com'), header_referer) && enabledSites.includes('###_usa_townnews'));
if (usa_townnews_domain) {
let townnews_domain = urlHost(header_referer).replace(/^(www|m)\./, '');
blockedRegexes[townnews_domain] = /\.com\/shared-content\/art\/tncms\/user\/user\.js/;
usa_townnews_domains.push(townnews_domain);
if (!enabledSites.includes(townnews_domain))
enabledSites.push(townnews_domain);
}
// block script for additional McClatchy sites (opt-in to custom sites)
var usa_mcc_domains = grouped_sites['###_usa_mcc'];
var usa_mcc_domain = (((matchUrlDomain('mcclatchyinteractive.com', details.url) && ['script'].includes(details.type)) ||
@ -780,21 +792,20 @@ ext_api.webRequest.onBeforeSendHeaders.addListener(function(details) {
var de_rnd_domain = (matchUrlDomain('rndtech.de', details.url) && ['script'].includes(details.type) && !matchUrlDomain(de_madsack_domains.concat(['madsack.de', 'madsack-medien-campus.de', 'rnd.de']), header_referer) && enabledSites.includes('###_de_madsack'));
if (de_rnd_domain) {
let rnd_domain = urlHost(header_referer).replace(/^(www|m)\./, '');
if (!de_madsack_domains.includes(rnd_domain)) {
if (!allow_cookies.includes(rnd_domain))
allow_cookies.push(rnd_domain);
blockedRegexes[rnd_domain] = blockedRegexes['haz.de'];
de_madsack_domains.push(rnd_domain);
if (!enabledSites.includes(rnd_domain))
enabledSites.push(rnd_domain);
}
}
// set user-agent to GoogleBot for additional Snamoma Media Finland (opt-in to custom sites)
var fi_sanoma_domains = grouped_sites['###_fi_sanoma'];
var fi_sanoma_sndp_domain = (matchUrlDomain('sanoma-sndp.fi', details.url) && ['xmlhttprequest'].includes(details.type) && !matchUrlDomain(fi_sanoma_domains, header_referer) && enabledSites.includes('###_fi_sanoma'));
if (fi_sanoma_sndp_domain) {
let sanoma_domain = urlHost(header_referer).replace(/^www\./, '');
if (!fi_sanoma_domains.includes(sanoma_domain)) {
if (!allow_cookies.includes(sanoma_domain))
allow_cookies.push(sanoma_domain);
if (!use_google_bot.includes(sanoma_domain)) {
use_google_bot.push(sanoma_domain);
@ -804,7 +815,6 @@ ext_api.webRequest.onBeforeSendHeaders.addListener(function(details) {
if (!enabledSites.includes(sanoma_domain))
enabledSites.push(sanoma_domain);
}
}
// block external javascript for custom sites (optional)
var domain_blockjs_ext = matchUrlDomain(block_js_custom_ext, header_referer);

View File

@ -3,6 +3,7 @@ Changelog Bypass Paywalls Clean - Firefox
Post-release
Add Mainichi Shimbun (Japan)
Add TownNews sites (local USA; opt-in to custom sites)
Remove De Tijd & L'Echo (obsolete)
Fix Bloomberg (quotes)
Fix McClatchy Group (amp-redirect & disable)

View File

@ -605,5 +605,5 @@
"*://*.wsj.net/*",
"*://*.zephr.com/*"
],
"version": "2.5.1.5"
"version": "2.5.1.6"
}

View File

@ -171,7 +171,7 @@ var defaultSites = {
domain: "historyextra.com",
block_regex: /\.evolok\.net\//
},
"Belfast Telegraph (opt-in)": {
"Belfast Telegraph (setCookie opt-in)": {
domain: "belfasttelegraph.co.uk",
allow_cookies: 1,
block_regex: /(cdn\.flip-pay\.com\/clients\/inm\/flip-pay\.js)/
@ -759,7 +759,7 @@ var defaultSites = {
allow_cookies: 1,
block_regex: /\.internazionale\.it\/assets\/js\/main\.\d{2,}\.js/
},
"Irish Independent (opt-in)": {
"Irish Independent (setCookie opt-in)": {
domain: "independent.ie",
allow_cookies: 1,
block_regex: /(cdn\.flip-pay\.com\/clients\/inm\/flip-pay\.js)/
@ -1667,6 +1667,9 @@ var defaultSites = {
allow_cookies: 1,
referer: "twitter"
},
"TownNews sites (Blox CMS)": {
domain: "###_usa_townnews"
},
"Tribune Publishing Company": {
domain: "###_usa_tribune",
group: [