Fix-update/restore El Pais (Spain)

This commit is contained in:
magnolia1234 2020-12-24 13:37:58 +01:00
parent 82ecf053b4
commit 5234574f65
3 changed files with 34 additions and 1 deletions

View file

@ -4,7 +4,7 @@
var ext_api = (typeof browser === 'object') ? browser : chrome; var ext_api = (typeof browser === 'object') ? browser : chrome;
var ext_name = ext_api.runtime.getManifest().name; var ext_name = ext_api.runtime.getManifest().name;
const cs_limit_except = ['afr.com', 'harpers.org', 'inkl.com', 'la-croix.com', 'lescienze.it', 'techinasia.com']; const cs_limit_except = ['afr.com', 'elpais.com', 'harpers.org', 'inkl.com', 'la-croix.com', 'lescienze.it', 'techinasia.com'];
var currentTabUrl = ''; var currentTabUrl = '';
var csDone = false; var csDone = false;

View file

@ -6,6 +6,7 @@ Add FreiePresse.de
Add L'Obs (France) Add L'Obs (France)
Add Paris Match (France) Add Paris Match (France)
Fix-update El Mercurio (Chile) Fix-update El Mercurio (Chile)
Fix-update/restore El Pais (Spain)
* v2.0.0.0 (2020-12-20) * v2.0.0.0 (2020-12-20)
Add Krautreporter (Germany) Add Krautreporter (Germany)

View file

@ -1430,6 +1430,38 @@ else if (matchDomain(de_madsack_domains)) {
} }
} }
else if (matchDomain("elpais.com")) {
let login_register = document.querySelector('.login_register');
if (login_register) {
let scripts = document.querySelectorAll('script');
let json_script;
for (let script of scripts) {
if (script.innerText.includes('Fusion.globalContent'))
json_script = script;
continue;
}
if (json_script) {
let json_text = json_script.innerHTML.split('Fusion.globalContent=')[1].split(';Fusion.globalContentConfig')[0];
let json_article = JSON.parse(json_text).content_elements;
let article_body_par = document.querySelector('div.article_body > p');
if (article_body_par) {
article_body_par.innerText = '';
let parser = new DOMParser();
let par_text, par_html;
for (let par of json_article) {
par_html = parser.parseFromString('<div><p>' + par.content + '</p></br></div>', 'text/html');
par_text = par_html.querySelector('div');
if (par_text)
article_body_par.appendChild(par_text);
}
}
}
removeDOMElement(login_register);
}
let paywall_offer = document.querySelector('.paywallOffer');
removeDOMElement(paywall_offer);
}
else if (matchDomain("slate.com")) { else if (matchDomain("slate.com")) {
let slate_roadblock = document.querySelector('.slate-roadblock'); let slate_roadblock = document.querySelector('.slate-roadblock');
let ads = document.querySelectorAll('section[class*="-ad"]'); let ads = document.querySelectorAll('section[class*="-ad"]');