Add gva.be, hbvl.be & nieuwsblad.be

This commit is contained in:
magnolia1234 2022-05-25 18:34:20 +02:00
parent 85e3873659
commit ed7fa34710
6 changed files with 132 additions and 2 deletions

View file

@ -563,6 +563,10 @@ Grouped in options:\
[Vrij Nederland](https://www.nl.nl)
Grouped in options:\
*Mediahuis België* sites like:\
[Gazet van Antwerpen](https://www.gva.be) -
[Het Belang van Limburg](https://www.hbvl.be) -
[Het Nieuwsblad](https://www.nieuwsblad.be)\
*Mediahuis Nederland Regional* sites like\
[Noordhollands Dagblad](https://www.noordhollandsdagblad.nl) -
[Haarlems Dagblad](https://www.haarlemsdagblad.nl) -

View file

@ -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(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(be_mediahuis_domains, 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;

View file

@ -2,6 +2,9 @@
Changelog Bypass Paywalls Clean - Firefox
Post-release
Add Gazet van Antwerpen
Add Het Belang van Limburg
Add Het Nieuwsblad
Fix Telegraaf.nl
* v2.7.0.0 (2022-05-22)

View file

@ -1767,6 +1767,116 @@ else if (matchDomain('ftm.nl')) {
removeDOMElement(banner_pp);
}
else if (matchDomain(['gva.be', 'hbvl.be', 'nieuwsblad.be'])) {
let paywall = document.querySelector('div[data-cj-root="subscription-wall"]');
if (paywall && dompurify_loaded) {
removeDOMElement(paywall);
let main_content = document.querySelector('div[data-mht-block="article-detail__article-main"]');
let json_script = main_content.querySelector('script');
let json_str = json_script.text.substring(json_script.textContent.indexOf('{'));
try {
let json = JSON.parse(json_str);
if (json) {
let json_text = Object.values(json)[0]['data']['article']['body'];
let parser = new DOMParser();
let div_content = main_content.querySelector('div');
let par_elem, par_key, par_li, par_html, par_link;
let head = document.querySelector('head');
let streamone = false;
let flourish = false;
for (let par of json_text) {
for (let key in par) {
par_elem = document.createElement('p');
par_key = par[key];
if (['p', 'subhead'].includes(key)) {
if (par_key.includes('<')) {
par_html = parser.parseFromString('<p>' + DOMPurify.sanitize(par_key) + '</p>', 'text/html');
par_elem = par_html.querySelector('p');
} else
par_elem.innerText = par_key;
if (key === 'subhead')
par_elem.setAttribute('style', 'font-weight: bold;');
} else if (key === 'image') {
par_elem = document.createElement('img');
par_elem.src = par_key.url;
} else if (key === 'bullet_list') {
par_elem = document.createElement('ul');
for (let bullet of par_key) {
par_html = parser.parseFromString('<li>' + DOMPurify.sanitize(bullet) + '</li>', 'text/html');
par_li = par_html.querySelector('li');
let bullet_link = par_li.querySelector('a');
if (bullet_link && bullet_link.href && !bullet_link.innerText)
bullet_link.innerText = bullet_link.href;
par_elem.appendChild(par_li);
}
} else if (key === 'related') {
par_elem = document.createElement('p');
if (par_key.article && par_key.article.title && par_key.article.webcmsRelativeUrl) {
par_link = document.createElement('a');
if (par_key.article.label)
par_link.innerText = par_key.article.label;
par_link.innerText += par_key.article.title;
par_link.href = par_key.article.webcmsRelativeUrl;
par_elem.appendChild(par_link);
}
} else if (key === 'iframe_sized') {
par_elem = document.createElement('iframe');
par_elem.src = par_key.url;
if (par_key.height && par_key.width) {
par_elem.setAttribute('height', par_key.height);
par_elem.setAttribute('width', par_key.width);
}
} else if (key === 'streamone') {
if (!streamone) {
let streamone_script = document.createElement('script');
streamone_script.setAttribute('src', 'https://shared.mediahuis.be/videoplayers/mediahuis/video-theoplayer.js?v=20220525T184101');
streamone_script.setAttribute('defer', true);
streamone_script.setAttribute('crossorigin', 'anonymous');
if (head)
head.appendChild(streamone_script);
streamone = true;
}
let par_key_id = DOMPurify.sanitize(par_key.id);
par_html = parser.parseFromString('<div id="json_id"><div><div><div><div data-testid="embed-video"><div><div id="video-player-' + par_key_id + '" style="width:100%;" data-video-embed-id="' + par_key_id + '" data-video-target-id="video-player-' + par_key_id + '" data-video-brand="gva" class="js-theoplayer-placeholder"></div></div></div></div></div>', 'text/html');
par_elem = par_html.querySelector('div');
} else if (key === 'legacy-ml') {
par_html = parser.parseFromString('<div>' + DOMPurify.sanitize(par_key) + '</div>', 'text/html');
par_elem = par_html.querySelector('div');
if (!flourish && par_key.includes('flourish.studio')) {
let flourish_script = document.createElement('script');
flourish_script.setAttribute('src', 'https://public.flourish.studio/resources/embed.js');
if (head)
head.appendChild(flourish_script);
flourish = true;
}
} else {
console.log(key);
console.log(par_key);
par_html = parser.parseFromString('<p>' + DOMPurify.sanitize(par_key) + '</p>', 'text/html');
par_elem = par_html.querySelector('p');
}
if (!['streamone', 'legacy-ml', 'iframe_sized'].includes(key))
par_elem.setAttribute('style', 'font-size: 16px;');
if (par_elem)
div_content.appendChild(par_elem);
}
}
}
} catch (err) {
console.warn('unable to parse text');
console.warn(err);
}
}
window.setTimeout(function () {
let overlay = document.querySelector('div.cj-root');
removeDOMElement(overlay);
let noscroll = document.querySelector('html.is-dialog-active');
if (noscroll)
noscroll.classList.remove('is-dialog-active');
}, 500); // Delay (in milliseconds)
}
else if (matchDomain(['knack.be', 'levif.be'])) {
let paywall = document.querySelector('#paywall-modal');
if (paywall) {

View file

@ -246,6 +246,7 @@
"*://*.griffithreview.com/*",
"*://*.groene.nl/*",
"*://*.grubstreet.com/*",
"*://*.gva.be/*",
"*://*.gymclimber.com/*",
"*://*.haaretz.co.il/*",
"*://*.haaretz.com/*",
@ -255,6 +256,7 @@
"*://*.haz.de/*",
"*://*.hbr.org/*",
"*://*.hbrchina.org/*",
"*://*.hbvl.be/*",
"*://*.heraldsun.com.au/*",
"*://*.hilltimes.com/*",
"*://*.hindustantimes.com/*",
@ -417,6 +419,7 @@
"*://*.newyorker.com/*",
"*://*.niagarafallsreview.ca/*",
"*://*.nicematin.com/*",
"*://*.nieuwsblad.be/*",
"*://*.nikkei.com/*",
"*://*.nj.com/*",
"*://*.nn.de/*",
@ -678,5 +681,5 @@
"*://*.wsj.net/*",
"*://webcache.googleusercontent.com/*"
],
"version": "2.7.0.1"
"version": "2.7.0.2"
}

View file

@ -1119,6 +1119,15 @@ var defaultSites = {
],
block_regex: /(js\.matheranalytics\.com\/|cdn\.ampproject\.org\/v\d\/amp-(access|subscriptions)-.+\.js)/
},
"Mediahuis België": {
domain: "###_be_mediahuis",
group: [
"gva.be",
"hbvl.be",
"nieuwsblad.be"
],
allow_cookies: 1
},
"Mediahuis Nederland Regional": {
domain: "###_nl_mediahuis_region",
group: [
@ -2115,6 +2124,7 @@ expandSiteRules(defaultSites);
// grouped domains (background)
var au_comm_media_domains = grouped_sites['###_au_comm_media'];
var au_news_corp_domains = grouped_sites['###_au_news_corp'];
var be_mediahuis_domains = grouped_sites['###_be_mediahuis'];
var fr_groupe_sud_ouest_domains = grouped_sites['###_fr_groupe_sud_ouest'];
var it_repubblica_domains = defaultSites['###_gr_it_repubblica_domains']['group_rule_domains'];
var medium_custom_domains = grouped_sites['###_medium_custom'];