diff --git a/background.js b/background.js index e3500c1..40d4707 100644 --- a/background.js +++ b/background.js @@ -214,7 +214,6 @@ var blockedRegexes = { 'newyorker.com': /.+\.newyorker\.com\/verso\/static\/presenter-articles.+\.js/, 'nknews.org': /.+\.nknews\.org\/wp-content\/plugins\/leaky-paywall-ajax\/js\/leaky-paywall-ajax\.js/, 'nytimes.com': /(.+meter-svc\.nytimes\.com\/meter\.js.+|.+mwcm\.nyt\.com\/.+\.js)/, -'nzherald.co.nz': /nzherald\.co\.nz\/.+\/headjs\/.+\.js/, 'repubblica.it': /scripts\.repubblica\.it\/pw\/pw\.js.+/, 'rollingstone.com': /cdn\.cxense\.com/, 'sacbee.com': /cdn\.ampproject\.org\/v\d\/amp-subscriptions-.+\.js/, diff --git a/changelog.txt b/changelog.txt index 965ec07..d4602cb 100644 --- a/changelog.txt +++ b/changelog.txt @@ -4,7 +4,10 @@ Changelog Bypass Paywalls Clean - Firefox Post-release Remove BusinessTimes.com.sg (obsolete) Fix-update Bloomberg (overlay) +Fix-update Challenges.fr (timing) +Fix-update NzHerald Fix-update Toronto Star (map-snippet/footer) +Fix-update WaPo (paywall-script) * v1.8.9.0 (2020-10-04) Add Hannoversche Allgemeine Zeitung diff --git a/contentScript.js b/contentScript.js index d6c5e00..7de45a5 100644 --- a/contentScript.js +++ b/contentScript.js @@ -200,20 +200,64 @@ else if (matchDomain("the-american-interest.com")) { } else if (matchDomain("nzherald.co.nz")) { - let article_content = document.getElementById('article-content'); + let article_content = document.querySelector('.article__content'); if (article_content) { - let premium = document.querySelector('.premium-sub'); - removeDOMElement(premium); - article_content.classList.remove('premium-content'); - article_content.classList.add('full-content'); - removeClassesByPrefix(article_content, 'QUnW'); - let elems = article_content.querySelectorAll("p, span, h2, div"); - for (let elem of elems){ - removeClassesByPrefix(elem, 'QUnW'); - elem.classList.remove("ellipsis"); - elem.removeAttribute('style'); + let article_offer = document.querySelector('.article-offer'); + if (article_offer) { + let scripts = document.querySelectorAll('script'); + let json_script; + for (let script of scripts) { + if (script.innerText.includes('Fusion.globalContent')) + json_script = script; + continue; + } + let first_pars = article_content.querySelectorAll('p[class=""], div[class="article__raw-html__top"]'); + removeDOMElement(...first_pars); + if (json_script) { + let json_text = json_script.innerHTML.split('Fusion.globalContent=')[1].split(';Fusion.globalContentConfig')[0]; + let json_pars = JSON.parse(json_text).elements; + let par_dom; + let article_action_bar = document.querySelector('.article__action-bar:not([data-ref-group="author"])'); + for (let par of json_pars) { + par_dom = document.createElement('div'); + par_dom.setAttribute('style', 'margin: 10px; font-size: 1.1rem'); + if (par.type === 'text') { + par_dom.innerHTML = par.content; + } else if (par.type === 'raw_html') { + if (par.subtype) + par_dom.innerHTML = par.content; + else { + let raw_html = document.querySelector('div.article__raw-html'); + if (raw_html) { + raw_html.setAttribute('class', 'article__raw-html'); + raw_html.removeAttribute('style'); + } + par_dom = raw_html; + } + } else if (par.type === 'header') { + par_dom.innerHTML = '