diff --git a/background.js b/background.js index 94b98d3..8235607 100644 --- a/background.js +++ b/background.js @@ -4,7 +4,7 @@ var ext_api = (typeof browser === 'object') ? browser : chrome; 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 csDone = false; diff --git a/changelog.txt b/changelog.txt index 11e993e..f31b365 100644 --- a/changelog.txt +++ b/changelog.txt @@ -6,6 +6,7 @@ Add FreiePresse.de Add L'Obs (France) Add Paris Match (France) Fix-update El Mercurio (Chile) +Fix-update/restore El Pais (Spain) * v2.0.0.0 (2020-12-20) Add Krautreporter (Germany) diff --git a/contentScript.js b/contentScript.js index e0ce108..05e03e8 100644 --- a/contentScript.js +++ b/contentScript.js @@ -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('

' + par.content + '


', '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")) { let slate_roadblock = document.querySelector('.slate-roadblock'); let ads = document.querySelectorAll('section[class*="-ad"]');