Fix Australian Community Media

merge-requests/7/head
magnolia1234 2 years ago
parent 3e9b301ae6
commit 65cdd436fb

@ -658,7 +658,7 @@ Grouped in options:\
[The Mercury Tasmania](https://www.themercury.com.au) -
[The Weekly Times](https://www.weeklytimesnow.com.au) -
[Townsville Bulletin](https://www.townsvillebulletin.com.au)\
*Australian Community Media (daily)* sites like (add to custom sites for unlisted & block general paywall-script Piano)\
*Australian Community Media (daily)* sites like (opt-in to custom sites for unlisted)\
[Bendigo Advertiser](https://www.bendigoadvertiser.com.au) -
[Central Western Daily](https://www.centralwesterndaily.com.au) -
[Daily Liberal](https://www.dailyliberal.com.au) -
@ -671,7 +671,6 @@ Grouped in options:\
[The Daily Advertiser](https://www.dailyadvertiser.com.au) -
[The Examiner](https://www.examiner.com.au) -
[The Northern Daily Leader](https://www.northerndailyleader.com.au) -
[The Port Macquarie News](https://www.portnews.com.au) -
[The Standard](https://www.standard.net.au) -
[Western Advocate](https://www.westernadvocate.com.au)

@ -6,7 +6,7 @@ var ext_name = manifestData.name;
var ext_version = manifestData.version;
const cs_limit_except = ['elespanol.com', 'faz.net', 'nation.africa', 'nationalgeographic.com', 'thetimes.co.uk'];
const dompurify_sites = ['asiatimes.com', 'bloomberg.com', 'cicero.de', 'economictimes.com', 'hs.fi', 'iltalehti.fi', 'ipolitics.ca', 'italiaoggi.it', 'lesechos.fr', 'marianne.net', 'newleftreview.org', 'nzherald.co.nz', 'prospectmagazine.co.uk', 'stratfor.com', 'techinasia.com', 'timesofindia.com', 'valor.globo.com', 'vn.nl'].concat(au_comm_media_domains, fr_groupe_sud_ouest_domains, nl_mediahuis_region_domains, no_nhst_media_domains, usa_theathletic_domains);
const dompurify_sites = ['asiatimes.com', 'bloomberg.com', 'cicero.de', 'economictimes.com', 'hs.fi', 'iltalehti.fi', 'ipolitics.ca', 'italiaoggi.it', 'lesechos.fr', 'marianne.net', 'newleftreview.org', 'nzherald.co.nz', 'prospectmagazine.co.uk', 'stratfor.com', 'techinasia.com', 'timesofindia.com', 'valor.globo.com', 'vn.nl'].concat(fr_groupe_sud_ouest_domains, nl_mediahuis_region_domains, no_nhst_media_domains, usa_theathletic_domains);
var currentTabUrl = '';
var csDone = false;
var optin_setcookie = false;
@ -770,13 +770,19 @@ ext_api.webRequest.onBeforeSendHeaders.addListener(function(details) {
medium_custom_domains = customAddRules(medium_custom_domains);
else {
let header_referer_hostname = urlHost(header_referer);
if (header_referer_hostname.endsWith('.com.au')) {
// enable regional The West Australian sites (opt-in to custom sites)
var au_thewest_domains = ['thewest.com.au'];
var au_thewest_domain = (details.url.startsWith('https://images.thewest.com.au/') && ['image'].includes(details.type) &&
!matchUrlDomain(au_thewest_domains, header_referer) && enabledSites.includes('thewest.com.au'));
if (au_thewest_domain)
au_thewest_domains = customAddRules(au_thewest_domains, true);
if (header_referer_hostname.match(/\.(com|net)\.au$/)) {
// block Piano.io for regional Australian Community Media sites (opt-in to custom sites)
var au_comm_media_domain = (details.url.startsWith('https://' + header_referer_hostname + '/promotions/website_content_esov/') && ['xmlhttprequest'].includes(details.type) && !matchUrlDomain(au_comm_media_domains, header_referer) && enabledSites.includes('###_au_comm_media'));
if (au_comm_media_domain)
au_comm_media_domains = customAddRules(au_comm_media_domains, true, blockedRegexes['canberratimes.com.au']);
else if (header_referer_hostname.endsWith('.com.au')) {
// enable regional The West Australian sites (opt-in to custom sites)
var au_thewest_domains = ['thewest.com.au'];
var au_thewest_domain = (details.url.startsWith('https://images.thewest.com.au/') && ['image'].includes(details.type) &&
!matchUrlDomain(au_thewest_domains, header_referer) && enabledSites.includes('thewest.com.au'));
if (au_thewest_domain)
au_thewest_domains = customAddRules(au_thewest_domains, true);
}
} else if (header_referer_hostname.endsWith('.ch')) {
// set googlebot-useragent for regional nzz.ch sites (opt-in to custom sites)
var ch_media_domains = [];

@ -5,6 +5,7 @@ Post-release
Add De Tijd & L'Echo
Add group Mediahuis Noord (opt-in to custom sites for unlisted)
Add The Daily Wire
Fix Australian Community Media
Fix DealStreetAsia (free articles only)
Fix Knack.be & LeVif.be
@ -76,7 +77,7 @@ Add NewcastleHerald.com.au
Add S&P Global
Add Westdeutsche Zeitung
Remove HBR Taiwan (fix obsolete)
Fix Australian Community Media
Fix Australian Community Media (json)
* v2.6.1.0 (2022-03-20)
Add Franc-Tireur.fr

@ -251,49 +251,15 @@ else if (domain = matchDomain(["brisbanetimes.com.au", "smh.com.au", "theage.com
else {
// Australian Community Media newspapers
let au_comm_media_domains = ['bendigoadvertiser.com.au', 'bordermail.com.au', 'canberratimes.com.au', 'centralwesterndaily.com.au', 'dailyadvertiser.com.au', 'dailyliberal.com.au', 'examiner.com.au', 'illawarramercury.com.au', 'newcastleherald.com.au', 'northerndailyleader.com.au', 'portnews.com.au', 'standard.net.au', 'theadvocate.com.au', 'thecourier.com.au', 'westernadvocate.com.au'];
let au_comm_media_domains = ['bendigoadvertiser.com.au', 'bordermail.com.au', 'canberratimes.com.au', 'centralwesterndaily.com.au', 'dailyadvertiser.com.au', 'dailyliberal.com.au', 'examiner.com.au', 'illawarramercury.com.au', 'newcastleherald.com.au', 'northerndailyleader.com.au', 'standard.net.au', 'theadvocate.com.au', 'thecourier.com.au', 'westernadvocate.com.au'];
let au_comm_media_link = document.querySelector('a[href^="https://australiancommunitymedia.zendesk.com"]');
if (matchDomain(au_comm_media_domains) || au_comm_media_link) {
let mask = document.querySelector('div[style^="-webkit-mask-image"]');
if (mask) {
mask.removeAttribute('style');
let json_script = document.querySelector('script#__NEXT_DATA__');
if (json_script && dompurify_loaded) {
let json = JSON.parse(json_script.innerText);
if (json && json.props.pageProps.context.story.elements) {
let pars = json.props.pageProps.context.story.elements;
let intro = document.querySelector('p[class^="Paragraph_wrapper__"]');
if (intro && intro.parentNode) {
let article = document.querySelector('div#story-body > div.mx-auto');
if (!article)
article = intro.parentNode;
removeDOMElement(intro);
let article_new = '';
for (let par of pars) {
if (['paragraph', 'topic', 'heading', 'subhead'].includes(par.type) && par.text) {
article_new += '<p>' + par.text.replace(/<br>$/, '') + '<br><br></p>';
} else if (par.type === 'generic' && par.embed) {
article_new += '<p>' + par.embed + '<br><br></p>';
} else if (['list', 'listbox'].includes(par.type) && par.items) {
if (par.type === 'listbox' && par.headline)
article_new += par.headline + '<br>';
article_new += '<ul>';
for (let item of par.items)
article_new += '<li>' + item + '</li>';
article_new += '</ul>';
if (par.type === 'listbox' && par.description)
article_new += par.description + '<br><br>';
} else if (!['image', 'gallery', 'quote'].includes(par.type)) {
console.log(par);
}
}
let parser = new DOMParser();
let doc = parser.parseFromString('<div>' + DOMPurify.sanitize(article_new, {ADD_TAGS: ['iframe']}) + '</div>', 'text/html');
let content_new = doc.querySelector('div');
article.appendChild(content_new);
}
}
}
let div_hidden = document.querySelectorAll('div[class="hidden"]');
for (let elem of div_hidden)
elem.classList.remove('hidden');
} else {
let subscribe_truncate = document.querySelector('.subscribe-truncate');
if (subscribe_truncate)
@ -307,7 +273,7 @@ else {
if (noscroll)
noscroll.removeAttribute('style');
let story_generic_iframe = document.querySelector('.story-generic__iframe');
let ads = document.querySelectorAll('.ad-placeholder, .sticky, #billboard-container');
let ads = document.querySelectorAll('.ad-placeholder, .sticky, [id*="-container"]');
removeDOMElement(story_generic_iframe, blocker, ...ads);
} else if (window.location.hostname.endsWith('.com.au')) {
// Australia News Corp

@ -460,7 +460,6 @@
"*://*.podiumrunner.com/*",
"*://*.politicaexterior.com/*",
"*://*.popularmechanics.com/*",
"*://*.portnews.com.au/*",
"*://*.post-gazette.com/*",
"*://*.precisiononcologynews.com/*",
"*://*.prevention.com/*",
@ -672,5 +671,5 @@
"*://*.wsj.net/*",
"*://webcache.googleusercontent.com/*"
],
"version": "2.6.7.3"
"version": "2.6.7.4"
}

@ -135,7 +135,6 @@ var defaultSites = {
"illawarramercury.com.au",
"newcastleherald.com.au",
"northerndailyleader.com.au",
"portnews.com.au",
"standard.net.au",
"theadvocate.com.au",
"thecourier.com.au",

@ -1,13 +1,4 @@
{
"Automobilwoche": {
"domain": "automobilwoche.de",
"allow_cookies": 1,
"block_regex": "\\.amazonaws\\.com\\/s3fs-public\\/js\\/js_.+\\.js"
},
"Better Nutrition": {
"domain": "betternutrition.com",
"group_rule": "###_gr_usa_outside_mag_domains"
},
"De Tijd": {
"domain": "tijd.be",
"referer": "google"
@ -18,11 +9,6 @@
"block_regex": "(\\.tinypass\\.com\\/|cdn\\.cxense\\.com\\/|cdn\\.ampproject\\.org\\/v\\d\\/amp-subscriptions-.+\\.js)",
"amp_redirect": "div.exclusive_validation"
},
"El País": {
"domain": "elpais.com",
"allow_cookies": 1,
"block_regex": "(\\/elpais\\.com\\/arc\\/subs\\/p\\.min\\.js|cdn\\.ampproject\\.org\\/v\\d\\/amp-access-.+\\.js)"
},
"eNotes": {
"domain": "enotes.com",
"allow_cookies": 1,
@ -40,38 +26,10 @@
}
]
},
"Fortune": {
"domain": "fortune.com",
"allow_cookies": 1,
"block_regex": "(\\.tinypass\\.com\\/|cdn\\.ampproject\\.org\\/v\\d\\/amp-access-.+\\.js)",
"cs_code": [{
"cond": "div.paywallActive",
"rm_attrib": "class"
}
]
},
"Gym Climber": {
"domain": "gymclimber.com",
"group_rule": "###_gr_usa_outside_mag_domains"
},
"Italia Oggi": {
"domain": "italiaoggi.it",
"allow_cookies": 1,
"ld_json": "div.boxAbb|div.article-locked",
"new_site": 1
},
"L'Écho": {
"domain": "lecho.be",
"referer": "google"
},
"Peloton": {
"domain": "pelotonmagazine.com",
"group_rule": "###_gr_usa_outside_mag_domains"
},
"Podium Runner": {
"domain": "podiumrunner.com",
"group_rule": "###_gr_usa_outside_mag_domains"
},
"Puck.news": {
"domain": "puck.news",
"allow_cookies": 1,
@ -90,10 +48,6 @@
],
"new_site": 1
},
"Rock and Ice": {
"domain": "rockandice.com",
"group_rule": "###_gr_usa_outside_mag_domains"
},
"The Daily Wire": {
"domain": "dailywire.com",
"allow_cookies": 1,
@ -103,20 +57,5 @@
}
],
"new_site": 1
},
"###_gr_usa_outside_mag_domains": {
"group_rule_domains": ["betternutrition.com", "gymclimber.com", "pelotonmagazine.com", "podiumrunner.com", "rockandice.com"],
"allow_cookies": 1,
"block_regex": "\\.{domain}\\/.+\\/scripts\\/contentGate.+\\.js",
"cs_code": [{
"cond": "div.o-membership-overlay",
"rm_elem": 1,
"elems": [{
"cond": "[class*=\"is-gated\"]",
"rm_class": "is-gated,is-gated--flexible-layout"
}
]
}
]
}
}

Loading…
Cancel
Save