mirror of
https://gitlab.com/magnolia1234/bypass-paywalls-firefox-clean.git
synced 2024-11-10 03:31:57 +01:00
Add Standaard.be
This commit is contained in:
parent
21116a39d8
commit
c602805d41
6 changed files with 37 additions and 116 deletions
|
@ -581,6 +581,7 @@ Grouped in options:\
|
|||
|
||||
Grouped in options:\
|
||||
*Mediahuis België* sites like:\
|
||||
[De Standaard](https://www.standaard.be) -
|
||||
[Gazet van Antwerpen](https://www.gva.be) -
|
||||
[Het Belang van Limburg](https://www.hbvl.be) -
|
||||
[Het Nieuwsblad](https://www.nieuwsblad.be)\
|
||||
|
|
|
@ -27,6 +27,7 @@ var restrictions = {
|
|||
'theatlantic.com': /^((?!\/newsletters\.theatlantic\.com\/).)*$/,
|
||||
'nytimes.com': /^((?!\/timesmachine\.nytimes\.com\/).)*$/,
|
||||
'science.org': /^((?!\.science\.org\/doi\/).)*$/,
|
||||
'standaard.be': /^((?!\.standaard\.be\/plus\/).)*$/,
|
||||
'timesofindia.com': /\.timesofindia\.com($|\/($|toi-plus(\/.+)?|.+\.cms))/,
|
||||
'quora.com': /^((?!quora\.com\/search\?q=).)*$/,
|
||||
'repubblica.it': /^((?!\/video\.repubblica\.it\/).)*$/,
|
||||
|
@ -1435,15 +1436,17 @@ ext_api.runtime.onMessage.addListener(function (message, sender) {
|
|||
let parser = new DOMParser();
|
||||
let doc = parser.parseFromString(html, 'text/html');
|
||||
let article_new = doc.querySelector(message.data.selector_source);
|
||||
message.data.html = article_new.outerHTML;
|
||||
ext_api.tabs.query({
|
||||
active: true,
|
||||
currentWindow: true
|
||||
}, function (tabs) {
|
||||
if (tabs && tabs[0] && tabs[0].url && tabs[0].url.startsWith('http')) {
|
||||
ext_api.tabs.sendMessage(sender.tab.id, {msg: "showExtSrc", data: message.data});
|
||||
}
|
||||
});
|
||||
if (article_new) {
|
||||
message.data.html = article_new.outerHTML;
|
||||
ext_api.tabs.query({
|
||||
active: true,
|
||||
currentWindow: true
|
||||
}, function (tabs) {
|
||||
if (tabs && tabs[0] && tabs[0].url && tabs[0].url.startsWith('http')) {
|
||||
ext_api.tabs.sendMessage(sender.tab.id, {msg: "showExtSrc", data: message.data});
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
}).catch(function (err) {
|
||||
|
|
|
@ -3,6 +3,7 @@ Changelog Bypass Paywalls Clean - Firefox
|
|||
|
||||
Post-release
|
||||
Add Limburger.nl
|
||||
Add Standaard.be
|
||||
Add SuomenSotilas.fi
|
||||
Add Tagesspiegel.de
|
||||
Redirect Google AMP cache (opt-in to custom sites)
|
||||
|
|
122
contentScript.js
122
contentScript.js
|
@ -1928,113 +1928,25 @@ else if (matchDomain('ftm.nl')) {
|
|||
removeDOMElement(banner_pp);
|
||||
}
|
||||
|
||||
else if (matchDomain(['gva.be', 'hbvl.be', 'nieuwsblad.be'])) {
|
||||
else if (matchDomain(['gva.be', 'hbvl.be', 'nieuwsblad.be', 'standaard.be'])) {
|
||||
let url = window.location.href;
|
||||
let article_selector = 'div[data-mht-block="article-detail__article-main"]';
|
||||
if (matchDomain('standaard.be'))
|
||||
article_selector = 'article';
|
||||
let paywall = document.querySelector('div[data-cj-root="subscription-wall"]');
|
||||
if (paywall && dompurify_loaded) {
|
||||
if (paywall) {
|
||||
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);
|
||||
}
|
||||
csDoneOnce = true;
|
||||
let url_cache = 'https://webcache.googleusercontent.com/search?q=cache:' + url.split('?')[0];
|
||||
replaceDomElementExt(url_cache, true, false, article_selector);
|
||||
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');
|
||||
}, 1000); // Delay (in milliseconds)
|
||||
}
|
||||
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', 'kw.be', 'levif.be'])) {
|
||||
|
@ -2070,6 +1982,8 @@ else if (matchDomain('limburger.nl')) {
|
|||
let noscroll = document.querySelector('html.is-dialog-active');
|
||||
if (noscroll)
|
||||
noscroll.classList.remove('is-dialog-active');
|
||||
let ads = document.querySelectorAll('div.ad');
|
||||
removeDOMElement(...ads);
|
||||
}, 1000); // Delay (in milliseconds)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -528,6 +528,7 @@
|
|||
"*://*.spglobal.com/*",
|
||||
"*://*.spiegel.de/*",
|
||||
"*://*.sportico.com/*",
|
||||
"*://*.standaard.be/*",
|
||||
"*://*.standard.net.au/*",
|
||||
"*://*.star-telegram.com/*",
|
||||
"*://*.staradvertiser.com/*",
|
||||
|
@ -699,5 +700,5 @@
|
|||
"*://gcm.omerlocdn.com/*",
|
||||
"*://webcache.googleusercontent.com/*"
|
||||
],
|
||||
"version": "2.7.8.2"
|
||||
"version": "2.7.8.3"
|
||||
}
|
||||
|
|
5
sites.js
5
sites.js
|
@ -1176,7 +1176,8 @@ var defaultSites = {
|
|||
group: [
|
||||
"gva.be",
|
||||
"hbvl.be",
|
||||
"nieuwsblad.be"
|
||||
"nieuwsblad.be",
|
||||
"standaard.be"
|
||||
],
|
||||
allow_cookies: 1
|
||||
},
|
||||
|
@ -2209,4 +2210,4 @@ var no_nhst_media_domains = grouped_sites['###_no_nhst_media'];
|
|||
|
||||
// sites with no fix (background)
|
||||
var nl_ad_region_domains = ['ad.nl', 'bd.nl', 'ed.nl', 'tubantia.nl', 'bndestem.nl', 'pzc.nl', 'destentor.nl', 'gelderlander.nl'];
|
||||
var nofix_sites = ['africaintelligence.com', 'africaintelligence.fr', 'aftenposten.no', 'bild.de', 'borsen.dk', 'businesstimes.com.sg', 'caixin.com', 'caixinglobal.com', 'caravanmagazine.in', 'cnbc.com', 'courrierinternational.com', 'dn.se', 'elordenmundial.com', 'epw.in', 'expresso.pt', 'ftchinese.com', 'gazzetta.it', 'handelsblatt.com', 'hln.be', 'ilmanifesto.it', 'ilsole24ore.com', 'jacobinmag.com', 'jeunesafrique.com', 'kurier.at', 'lavozdegalicia.es', 'leconomiste.com', 'lefigaro.fr', 'lemonde.fr', 'lepoint.fr', 'liberation.fr', 'mediapart.fr', 'milanofinanza.it', 'mondediplo.com', 'moneycontrol.com', 'nieuwsblad.be', 'nknews.org', 'ouest-france.fr', 'politiken.de', 'publico.pt', 'republic.ru', 'rp-online.de', 'standaard.be', 'statnews.com', 'stern.de', 'straitstimes.com', 'sueddeutsche.de', 'tagesanzeiger.ch', 'the-ken.com', 'theinformation.com', ' themorningcontext.com', 'theparisreview.org', 'thewirechina.com', 'welt.de', 'wiwo.de', 'ynet.co.il'].concat(nl_ad_region_domains);
|
||||
var nofix_sites = ['africaintelligence.com', 'africaintelligence.fr', 'aftenposten.no', 'bild.de', 'borsen.dk', 'businesstimes.com.sg', 'caixin.com', 'caixinglobal.com', 'caravanmagazine.in', 'cnbc.com', 'courrierinternational.com', 'dn.se', 'elordenmundial.com', 'epw.in', 'expresso.pt', 'ftchinese.com', 'gazzetta.it', 'handelsblatt.com', 'hln.be', 'ilmanifesto.it', 'ilsole24ore.com', 'jacobinmag.com', 'jeunesafrique.com', 'kurier.at', 'lavozdegalicia.es', 'leconomiste.com', 'lefigaro.fr', 'lemonde.fr', 'lepoint.fr', 'liberation.fr', 'mediapart.fr', 'milanofinanza.it', 'mondediplo.com', 'moneycontrol.com', 'nieuwsblad.be', 'nknews.org', 'ouest-france.fr', 'politiken.de', 'publico.pt', 'republic.ru', 'rp-online.de', 'statnews.com', 'stern.de', 'straitstimes.com', 'sueddeutsche.de', 'tagesanzeiger.ch', 'the-ken.com', 'theinformation.com', ' themorningcontext.com', 'theparisreview.org', 'thewirechina.com', 'welt.de', 'wiwo.de', 'ynet.co.il'].concat(nl_ad_region_domains);
|
||||
|
|
Loading…
Reference in a new issue