Fix Helsingin Sanomat (dynamic)
parent
9d79b31a80
commit
3de13c05f3
|
@ -950,7 +950,7 @@ if (matchUrlDomain(change_headers, details.url) && !['font', 'image', 'styleshee
|
||||||
}
|
}
|
||||||
if ((!['font', 'stylesheet'].includes(details.type) || matchUrlDomain(cs_limit_except, currentTabUrl)) && !csDone) {
|
if ((!['font', 'stylesheet'].includes(details.type) || matchUrlDomain(cs_limit_except, currentTabUrl)) && !csDone) {
|
||||||
let lib_file = 'lib/empty.js';
|
let lib_file = 'lib/empty.js';
|
||||||
if (matchUrlDomain(['bloomberg.com', 'cicero.de', 'economictimes.com', 'lesechos.fr', 'marianne.net', 'newleftreview.org', 'newyorker.com', 'nzherald.co.nz', 'prospectmagazine.co.uk', 'stratfor.com', 'sudouest.fr', 'techinasia.com', 'timesofindia.com', 'valor.globo.com', 'vn.nl'].concat(nl_mediahuis_region_domains, no_nhst_media_domains, usa_theathletic_domains), currentTabUrl))
|
if (matchUrlDomain(['bloomberg.com', 'cicero.de', 'economictimes.com', 'hs.fi', 'lesechos.fr', 'marianne.net', 'newleftreview.org', 'newyorker.com', 'nzherald.co.nz', 'prospectmagazine.co.uk', 'stratfor.com', 'sudouest.fr', 'techinasia.com', 'timesofindia.com', 'valor.globo.com', 'vn.nl'].concat(nl_mediahuis_region_domains, no_nhst_media_domains, usa_theathletic_domains), currentTabUrl))
|
||||||
lib_file = 'lib/purify.min.js';
|
lib_file = 'lib/purify.min.js';
|
||||||
var bg2csData = {
|
var bg2csData = {
|
||||||
optin_setcookie: optin_setcookie,
|
optin_setcookie: optin_setcookie,
|
||||||
|
|
|
@ -4,6 +4,7 @@ Changelog Bypass Paywalls Clean - Chrome
|
||||||
Post-release
|
Post-release
|
||||||
Add ESPN USA (news only)
|
Add ESPN USA (news only)
|
||||||
Add Les Inrockuptibles (France)
|
Add Les Inrockuptibles (France)
|
||||||
|
Fix Helsingin Sanomat (dynamic)
|
||||||
Fix The Diplomat (cookies)
|
Fix The Diplomat (cookies)
|
||||||
Fix Times of India (amp)
|
Fix Times of India (amp)
|
||||||
Update custom sites (random ip)
|
Update custom sites (random ip)
|
||||||
|
|
142
contentScript.js
142
contentScript.js
|
@ -660,6 +660,124 @@ else if ((domain = matchDomain(de_madsack_domains)) || document.querySelector('l
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
else
|
||||||
|
csDone = true;
|
||||||
|
|
||||||
|
} else if (window.location.hostname.match(/\.(dk|fi|no|se)$/)) {//denmark/finland/norway/sweden
|
||||||
|
|
||||||
|
if (matchDomain(fi_alma_talent_domains)) {
|
||||||
|
let ads = document.querySelectorAll('div[class^="p2m385-"]');
|
||||||
|
removeDOMElement(...ads);
|
||||||
|
}
|
||||||
|
|
||||||
|
else if (matchDomain('hs.fi')) {
|
||||||
|
let url = window.location.href;
|
||||||
|
if (!url.includes('https://dynamic.hs.fi')) {
|
||||||
|
let iframe = document.querySelector('iframe[src^="https://dynamic.hs.fi/a/"]');
|
||||||
|
if (iframe && url.includes('.html')) {
|
||||||
|
window.setTimeout(function () {
|
||||||
|
window.location.href = iframe.src;
|
||||||
|
}, 500); // Delay (in milliseconds)
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
let paywall = document.querySelector('.paywall-container, .paywall-wrapper');
|
||||||
|
if (paywall && dompurify_loaded) {
|
||||||
|
let scripts = document.querySelectorAll('script');
|
||||||
|
let json_script;
|
||||||
|
for (let script of scripts) {
|
||||||
|
if (script.innerText.includes('window.__NUXT__='))
|
||||||
|
json_script = script;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
let json_text;
|
||||||
|
if (json_script.innerHTML.includes('paywallComponents:['))
|
||||||
|
json_text = json_script.innerHTML.replace(/\r\n/g, '').split('amlData:[')[1].split('metaData')[0].split('paywallComponents:[')[1].slice(0, -4);
|
||||||
|
let main = document.querySelector('main');
|
||||||
|
if (main && json_text) {
|
||||||
|
let pars = json_text.split('{type:');
|
||||||
|
let type, value, slides, src, elem, img, caption, caption_text, par_html, par_text;
|
||||||
|
let parser = new DOMParser();
|
||||||
|
for (let par of pars) {
|
||||||
|
//console.log(par);
|
||||||
|
elem = '';
|
||||||
|
type = par.split(',')[0];
|
||||||
|
if (['a', 'i'].includes(type)) { // text
|
||||||
|
value = par.split('value:')[1].split('}')[0].replace(/(^"|"$)/g, '');
|
||||||
|
if (!value.includes('<p>'))
|
||||||
|
value = '<p>' + value + '</p>';
|
||||||
|
par_html = parser.parseFromString(DOMPurify.sanitize(value), 'text/html');
|
||||||
|
elem = par_html.querySelector('p');
|
||||||
|
} else if (['D', 'f', 'j', 'k'].includes(type)) { // quote
|
||||||
|
if (par.includes('text:') && par.includes(',position:')) {
|
||||||
|
value = par.split('text:')[1].split(',position:')[0].replace(/(^"|"$)/g, '');
|
||||||
|
elem = document.createElement('p');
|
||||||
|
elem.innerText = value;
|
||||||
|
elem.setAttribute('style', 'font-style: italic;');
|
||||||
|
}
|
||||||
|
} else if (['m', 'u'].includes(type)) { // authors
|
||||||
|
value = par.split('text:')[1].split(',role')[0].replace(/(^"|"$)/g, '');
|
||||||
|
if (value.length > 1) {
|
||||||
|
elem = document.createElement('p');
|
||||||
|
elem.innerText = value;
|
||||||
|
}
|
||||||
|
} else if (['e', 'h', 'y'].includes(type)) { // image
|
||||||
|
src = par.split('src:"')[1].split('",')[0];
|
||||||
|
if (!src.startsWith('http'))
|
||||||
|
src = 'https://arkku.mediadelivery.fi/img/468/' + src;
|
||||||
|
elem = document.createElement('p');
|
||||||
|
img = document.createElement('img');
|
||||||
|
img.setAttribute('src', src);
|
||||||
|
img.setAttribute('style', 'width:468px !important');
|
||||||
|
elem.appendChild(img);
|
||||||
|
if (par.includes('caption:')) {
|
||||||
|
caption = document.createElement('figcaption');
|
||||||
|
caption_text = par.split('caption:')[1].split('",')[0];
|
||||||
|
if (caption_text.length)
|
||||||
|
caption_text = caption_text.slice(1, caption_text.length - 1);
|
||||||
|
caption.innerText = caption_text;
|
||||||
|
elem.appendChild(caption);
|
||||||
|
}
|
||||||
|
} else if (['p', 'r'].includes(type)) { // slides
|
||||||
|
slides = par.split('src:');
|
||||||
|
elem = document.createElement('p');
|
||||||
|
for (let slide of slides) {
|
||||||
|
if (slide.includes('.jpg')) {
|
||||||
|
src = slide.split(',')[0].replace(/"/g, '');
|
||||||
|
if (!src.startsWith('http'))
|
||||||
|
src = 'https://arkku.mediadelivery.fi/img/468/' + src;
|
||||||
|
img = document.createElement('img');
|
||||||
|
img.setAttribute('src', src);
|
||||||
|
img.setAttribute('style', 'width:468px !important');
|
||||||
|
elem.appendChild(img);
|
||||||
|
caption = document.createElement('figcaption');
|
||||||
|
caption_text = slide.split('text:')[1].split(',"text-style"')[0];
|
||||||
|
if (caption_text.length)
|
||||||
|
caption_text = caption_text.slice(1, caption_text.length - 1);
|
||||||
|
par_html = parser.parseFromString('<div>' + DOMPurify.sanitize(caption_text) + '</div>', 'text/html');
|
||||||
|
elem.appendChild(par_html.querySelector('div'));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else
|
||||||
|
false;//console.log('type: ' + type + ' par: ' + par);
|
||||||
|
if (elem) {
|
||||||
|
elem.setAttribute('class', 'article-body px-16 mb-24');
|
||||||
|
main.appendChild(elem);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
main.appendChild(document.createElement('br'));
|
||||||
|
}
|
||||||
|
removeDOMElement(paywall);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
else if (matchDomain('nyteknik.se')) {
|
||||||
|
// plus code in contentScript_once.js
|
||||||
|
let locked_article = document.querySelector('div.locked-article');
|
||||||
|
if (locked_article)
|
||||||
|
locked_article.classList.remove('locked-article');
|
||||||
|
}
|
||||||
|
|
||||||
else
|
else
|
||||||
csDone = true;
|
csDone = true;
|
||||||
|
|
||||||
|
@ -845,7 +963,7 @@ else if (matchDomain('politicaexterior.com')) {
|
||||||
else
|
else
|
||||||
csDone = true;
|
csDone = true;
|
||||||
|
|
||||||
} else if (window.location.hostname.endsWith('.fr') || matchDomain(['bienpublic.com', 'journaldunet.com', 'la-croix.com', 'ledauphine.com', 'ledevoir.com', 'lejsl.com', 'loeildelaphotographie.com', 'marianne.net', 'nouvelobs.com', 'parismatch.com', 'science-et-vie.com'])) {//france
|
} else if (window.location.hostname.endsWith('.fr') || matchDomain(['bienpublic.com', 'journaldunet.com', 'la-croix.com', 'ledauphine.com', 'ledevoir.com', 'lesinrocks.com', 'lejsl.com', 'loeildelaphotographie.com', 'marianne.net', 'nouvelobs.com', 'parismatch.com', 'science-et-vie.com'])) {//france
|
||||||
|
|
||||||
if (matchDomain('alternatives-economiques.fr')) {
|
if (matchDomain('alternatives-economiques.fr')) {
|
||||||
window.setTimeout(function () {
|
window.setTimeout(function () {
|
||||||
|
@ -1075,6 +1193,16 @@ else if (matchDomain('lesechos.fr') && window.location.href.match(/-\d{6,}/)) {
|
||||||
}, 500); // Delay (in milliseconds)
|
}, 500); // Delay (in milliseconds)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
else if (matchDomain('lesinrocks.com')) {
|
||||||
|
if (window.location.search.startsWith('?amp')) {
|
||||||
|
let size_defined = document.querySelector('amp-script.i-amphtml-layout-size-defined');
|
||||||
|
if (size_defined)
|
||||||
|
size_defined.style = 'overflow:visible !important;';
|
||||||
|
let overlays = document.querySelectorAll('section.learn_more, div.sidebar, div.menu-footer, div.tooltip_bib, footer.content-info');
|
||||||
|
removeDOMElement(...overlays);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
else if (matchDomain('loeildelaphotographie.com')) {
|
else if (matchDomain('loeildelaphotographie.com')) {
|
||||||
let paywall = document.querySelector('.paywall');
|
let paywall = document.querySelector('.paywall');
|
||||||
if (paywall) {
|
if (paywall) {
|
||||||
|
@ -2084,11 +2212,6 @@ else if (matchDomain('entrepreneur.com')) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
else if (matchDomain(fi_alma_talent_domains)) {
|
|
||||||
let ads = document.querySelectorAll('div[class^="p2m385-"]');
|
|
||||||
removeDOMElement(...ads);
|
|
||||||
}
|
|
||||||
|
|
||||||
else if (matchDomain('firstthings.com')) {
|
else if (matchDomain('firstthings.com')) {
|
||||||
let paywall = document.querySelector('.paywall');
|
let paywall = document.querySelector('.paywall');
|
||||||
removeDOMElement(paywall);
|
removeDOMElement(paywall);
|
||||||
|
@ -2505,13 +2628,6 @@ else if (matchDomain('nybooks.com')) {
|
||||||
removeDOMElement(banner);
|
removeDOMElement(banner);
|
||||||
}
|
}
|
||||||
|
|
||||||
else if (matchDomain('nyteknik.se')) {
|
|
||||||
// plus code in contentScript_once.js
|
|
||||||
let locked_article = document.querySelector('div.locked-article');
|
|
||||||
if (locked_article)
|
|
||||||
locked_article.classList.remove('locked-article');
|
|
||||||
}
|
|
||||||
|
|
||||||
else if (matchDomain('nytimes.com')) {
|
else if (matchDomain('nytimes.com')) {
|
||||||
function nyt_main() {
|
function nyt_main() {
|
||||||
navigator.storage.estimate = undefined;
|
navigator.storage.estimate = undefined;
|
||||||
|
|
|
@ -129,6 +129,11 @@
|
||||||
"Speld.nl": {
|
"Speld.nl": {
|
||||||
"domain": "speld.nl"
|
"domain": "speld.nl"
|
||||||
},
|
},
|
||||||
|
"Sportico.com": {
|
||||||
|
"allow_cookies": 1,
|
||||||
|
"block_regex": "\\.tinypass\\.com\\/",
|
||||||
|
"domain": "sportico.com"
|
||||||
|
},
|
||||||
"Supchina.com": {
|
"Supchina.com": {
|
||||||
"allow_cookies": 1,
|
"allow_cookies": 1,
|
||||||
"domain": "supchina.com"
|
"domain": "supchina.com"
|
||||||
|
|
Loading…
Reference in New Issue