diff --git a/changelog.txt b/changelog.txt index 0fcb573..180158e 100644 --- a/changelog.txt +++ b/changelog.txt @@ -3,6 +3,7 @@ Changelog Bypass Paywalls Clean - Firefox Updates (install signed xpi-file): https://gitlab.com/magnolia1234/bypass-paywalls-firefox-clean/-/releases Post-release +Fix Mediahuis Noord (json) * v3.3.5.0 (2023-09-24) Add Arkansas Democrat-Gazette diff --git a/contentScript.js b/contentScript.js index 44ff17e..ccf68b2 100644 --- a/contentScript.js +++ b/contentScript.js @@ -2370,13 +2370,13 @@ else if (matchDomain(be_roularta_domains)) { } else if (matchDomain(['lc.nl', 'dvhn.nl']) || document.querySelector('link[href*=".ndcmediagroep.nl/"]')) { - if (true) { - let paywall = document.querySelector('div.signupPlus, div.pw-wrapper'); - if (paywall && dompurify_loaded) { - let intro = document.querySelector('div.startPayWall'); - removeDOMElement(paywall, intro); - let html = document.documentElement.outerHTML; - if (html.includes('window.__NUXT__=')) { + let paywall = document.querySelector('div.signupPlus, div.pw-wrapper'); + if (paywall && dompurify_loaded) { + let intro = document.querySelector('div.startPayWall'); + removeDOMElement(paywall, intro); + let html = document.documentElement.outerHTML; + if (html.includes('window.__NUXT__=')) { + try { let json = html.split('window.__NUXT__=')[1].split('')[0].trim(); let url_nuxt = json.includes(',canonical:"') ? json.split(',canonical:"')[1].match(/\d+\.(html|ece)/)[0] : false; if (!url_nuxt) @@ -2388,77 +2388,77 @@ else if (matchDomain(['lc.nl', 'dvhn.nl']) || document.querySelector('link[href* let article = document.querySelector('div.content'); if (article) { article.innerHTML = ''; - try { - let pars = JSON.parse(json_text); - function addParText(elem, par_text, add_br = false) { - if (par_text.length > 2) { - let span = document.createElement('span'); - span.innerText = par_text; - elem.appendChild(span); - if (add_br) - elem.appendChild(document.createElement('br')); - } + let pars = JSON.parse(json_text); + function addParText(elem, par_text, add_br = false) { + if (par_text.length > 2) { + let span = document.createElement('span'); + span.innerText = par_text; + elem.appendChild(span); + if (add_br) + elem.appendChild(document.createElement('br')); } - for (let par of pars) { - let elem = document.createElement('p'); - if (par.code) { - let parser = new DOMParser(); - let article_html = parser.parseFromString('
' + DOMPurify.sanitize(par.code, {ADD_TAGS: ['iframe']}) + '
', 'text/html'); - elem = article_html.querySelector('div'); - } else if (par.insertbox_head || par.insertbox_text) { - if (par.insertbox_head && par.insertbox_head.length > 2) { - addParText(elem, par.insertbox_head, true); - } - if (par.insertbox_text) { - for (let item of par.insertbox_text) { - if (item.children) { - for (let child of item.children) { - if (child.text) { - addParText(elem, child.text, true); - } else if (child.href && child.href.length > 2) { - let par_link = document.createElement('a'); - par_link.href = child.href; - par_link.innerText = child.children[0].text; - elem.appendChild(par_link); - elem.appendChild(document.createElement('br')); - } else if (child.children) { - for (let sub_child of child.children) { - if (sub_child.text) { - addParText(elem, sub_child.text); - } else if (sub_child.children && sub_child.children.length && sub_child.children[0].text) { - addParText(elem, sub_child.children[0].text); - } + } + for (let par of pars) { + let elem = document.createElement('p'); + if (par.code) { + let parser = new DOMParser(); + let article_html = parser.parseFromString('
' + DOMPurify.sanitize(par.code, {ADD_TAGS: ['iframe']}) + '
', 'text/html'); + elem = article_html.querySelector('div'); + } else if (par.insertbox_head || par.insertbox_text) { + if (par.insertbox_head && par.insertbox_head.length > 2) { + addParText(elem, par.insertbox_head, true); + } + if (par.insertbox_text) { + for (let item of par.insertbox_text) { + if (item.children) { + for (let child of item.children) { + if (child.text) { + addParText(elem, child.text, true); + } else if (child.href && child.href.length > 2) { + let par_link = document.createElement('a'); + par_link.href = child.href; + par_link.innerText = child.children[0].text; + elem.appendChild(par_link); + elem.appendChild(document.createElement('br')); + } else if (child.children) { + for (let sub_child of child.children) { + if (sub_child.text) { + addParText(elem, sub_child.text); + } else if (sub_child.children && sub_child.children.length && sub_child.children[0].text) { + addParText(elem, sub_child.children[0].text); } } } } } } - } else if (par.text) { - addParText(elem, par.text); - } else if (par.children) { - for (let child of par.children) { - if (child.relation) { - if (child.type === 'img' && child.relation.href) { - let figure = document.createElement('figure'); - let img = document.createElement('img'); - img.src = child.relation.href; - figure.appendChild(img); - if (child.relation.caption && child.relation.caption.length > 2) { - let caption = document.createElement('figcaption'); - caption.innerText = child.relation.caption; - figure.appendChild(caption); - } - elem.appendChild(figure); - } else if (child.relation.link && child.relation.link.length > 2 && ((child.relation.title && child.relation.title.length > 2) || child.relation.imageAlt)) { - let par_link = document.createElement('a'); - par_link.href = child.relation.link; - par_link.innerText = child.relation.title.length > 2 ? child.relation.title : (child.relation.imageAlt.length > 2 ? child.relation.imageAlt : child.relation.link); - elem.appendChild(par_link); + } + } else if (par.text) { + addParText(elem, par.text); + } else if (par.children) { + for (let child of par.children) { + if (child.relation) { + if (child.type === 'img' && child.relation.href) { + let figure = document.createElement('figure'); + let img = document.createElement('img'); + img.src = child.relation.href; + figure.appendChild(img); + if (child.relation.caption && child.relation.caption.length > 2) { + let caption = document.createElement('figcaption'); + caption.innerText = child.relation.caption; + figure.appendChild(caption); } - } else if (child.text) { - addParText(elem, child.text); - } else if (child.children && child.children.length && child.children[0].text && child.children[0].text.length > 2) { + elem.appendChild(figure); + } else if (child.relation.link && child.relation.link.length > 2 && ((child.relation.title && child.relation.title.length > 2) || child.relation.imageAlt)) { + let par_link = document.createElement('a'); + par_link.href = child.relation.link; + par_link.innerText = child.relation.title.length > 2 ? child.relation.title : (child.relation.imageAlt.length > 2 ? child.relation.imageAlt : child.relation.link); + elem.appendChild(par_link); + } + } else if (child.text) { + addParText(elem, child.text); + } else if (child.children && child.children[0]) { + if (child.children[0].text && child.children[0].text.length > 2) { if ((child.href && child.href.length > 2) || (child.relation && child.relation.follow && child.relation.follow.url)) { let par_link = document.createElement('a'); par_link.href = child.href || child.relation.follow.url; @@ -2467,19 +2467,20 @@ else if (matchDomain(['lc.nl', 'dvhn.nl']) || document.querySelector('link[href* } else { addParText(elem, child.children[0].text); } - } + } else if (child.children[0].children && child.children[0].children[0] && child.children[0].children[0].text && child.children[0].children[0].text.length > 2) + addParText(elem, child.children[0].children[0].text); } - } else if (par.typename.length > 2) - console.log(par); - if (elem.hasChildNodes()) { - article.appendChild(elem); } + } else if (par.typename.length > 2) + console.log(par); + if (elem.hasChildNodes()) { + article.appendChild(elem); } - } catch (err) { - console.log(err); } } } + } catch (err) { + console.log(err); } } } @@ -3887,6 +3888,14 @@ else if (matchDomain('firstthings.com')) { else if (matchDomain('forbes.com')) { waitDOMAttribute('body', 'body', 'class', node => node.removeAttribute('class'), true); csDoneOnce = true; + if (window.location.pathname.startsWith('/newsletters/')) { + let paywall = document.querySelector('div > div.newsletter-teaser'); + if (paywall) { + paywall.classList.remove('newsletter-teaser'); + let header = paywall.parentNode; + header_nofix(header); + } + } } else if (matchDomain('foreignaffairs.com')) { diff --git a/custom/sites_custom.json b/custom/sites_custom.json index bcd0c26..ba868bf 100644 --- a/custom/sites_custom.json +++ b/custom/sites_custom.json @@ -296,6 +296,11 @@ "domain": "lagazettedescommunes.com", "useragent": "googlebot" }, + "Lasvegasadvisor.com": { + "allow_cookies": 1, + "block_regex": "\\.lasvegasadvisor\\.com\\/opt\\/.+\\.js", + "domain": "lasvegasadvisor.com" + }, "Lefigaro.fr": { "add_ext_link": "div#fig-premium-paywall|article", "add_ext_link_type": "archive.is", @@ -537,6 +542,11 @@ "block_regex": "\\/spectator\\.org\\/.+\\/evolok", "domain": "spectator.org" }, + "Spectrejournal.com": { + "allow_cookies": 1, + "block_regex": "\\/spectrejournal\\.com\\/wp-content\\/plugins\\/elementor\\/.+\\/dialog\\.min\\.js", + "domain": "spectrejournal.com" + }, "Speld.nl": { "domain": "speld.nl" },