diff --git a/background.js b/background.js index a3c42e16..b4687084 100644 --- a/background.js +++ b/background.js @@ -12,7 +12,7 @@ if (typeof ext_api.action !== 'object') { ext_api.action = ext_api.browserAction; } -const dompurify_sites = ['arcinfo.ch', 'belfasttelegraph.co.uk', 'bloomberg.com', 'boersen-zeitung.de', 'cicero.de', 'citywire.com', 'dn.no', 'espn.com', 'ilmanifesto.it', 'inc42.com', 'independent.ie', 'ipolitics.ca', 'italiaoggi.it', 'jacobin.de', 'lecourrierdesstrateges.fr', 'lepoint.fr', 'lesechos.fr', 'marianne.net', 'newleftreview.org', 'newscientist.com', 'outlookbusiness.com', 'prospectmagazine.co.uk', 'schwaebische.de', 'sloanreview.mit.edu', 'stratfor.com', 'stylist.co.uk', 'techinasia.com', 'thebulletin.org', 'vn.nl', 'zerohedge.com'].concat(nl_mediahuis_noord_domains, nl_mediahuis_region_domains, no_nhst_media_domains); +const dompurify_sites = ['arcinfo.ch', 'belfasttelegraph.co.uk', 'beobachter.ch', 'bloomberg.com', 'boersen-zeitung.de', 'cicero.de', 'citywire.com', 'dn.no', 'espn.com', 'handelszeitung.ch', 'ilmanifesto.it', 'inc42.com', 'independent.ie', 'ipolitics.ca', 'italiaoggi.it', 'jacobin.de', 'lecourrierdesstrateges.fr', 'lepoint.fr', 'lesechos.fr', 'marianne.net', 'newleftreview.org', 'newscientist.com', 'outlookbusiness.com', 'prospectmagazine.co.uk', 'schwaebische.de', 'sloanreview.mit.edu', 'stratfor.com', 'stylist.co.uk', 'techinasia.com', 'thebulletin.org', 'vn.nl', 'zerohedge.com'].concat(nl_mediahuis_noord_domains, nl_mediahuis_region_domains, no_nhst_media_domains); var optin_setcookie = false; var optin_update = true; var blocked_referer = false; diff --git a/changelog.txt b/changelog.txt index 525517cd..5554bbc0 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 Beobachter.ch & Handelszeitung.ch * v3.2.2.0 (2023-06-25) Add Follow the Money (Ftm.eu) diff --git a/contentScript.js b/contentScript.js index 86592858..a4360a41 100644 --- a/contentScript.js +++ b/contentScript.js @@ -624,6 +624,45 @@ else if (matchDomain('augsburger-allgemeine.de')) { } } +else if (matchDomain(['beobachter.ch', 'handelszeitung.ch'])) { + let paywall = document.querySelector('div#piano-inlined'); + if (paywall && dompurify_loaded) { + removeDOMElement(paywall); + let json_script = document.querySelector('script#hydrationdata'); + if (json_script) { + try { + let json = JSON.parse(json_script.text); + if (json) { + let url_id = json_script.text.includes('"gcid":"') ? json_script.text.split('"gcid":"')[1].split('","nid"')[0] : ''; + if (url_id && !window.location.pathname.endsWith(url_id)) + refreshCurrentTab(); + let pars = json.state; + let paragraphs = document.querySelectorAll('div.paragraph'); + let article = paragraphs[0]; + if (article) { + article.setAttribute('class', 'paragraph text-paragraph'); + for (let paragraph of paragraphs) + paragraph.innerHTML = ''; + let parser = new DOMParser(); + for (let par in pars) { + let content = pars[par].text; + if (content) { + let content_new = parser.parseFromString('
' + DOMPurify.sanitize(content) + '
', 'text/html'); + let article_new = content_new.querySelector('div'); ; + article.appendChild(article_new); + } + } + } + } + } catch (err) { + console.log(err); + } + } + } + let ads = document.querySelectorAll('div.ad-wrapper'); + hideDOMElement(...ads); +} + else if (matchDomain('berliner-zeitung.de')) { window.setTimeout(function () { let ads = document.querySelectorAll('[id^="traffective-ad"], [class^="ad-slot_wrapper"], [class^="outbrain_container"]'); diff --git a/custom/manifest.json b/custom/manifest.json index b425243a..c1bd6986 100644 --- a/custom/manifest.json +++ b/custom/manifest.json @@ -51,5 +51,5 @@ "webRequestBlocking", "*://*/*" ], - "version": "3.2.2.0" + "version": "3.2.2.1" } diff --git a/manifest.json b/manifest.json index b2dd60fc..135cac07 100644 --- a/manifest.json +++ b/manifest.json @@ -758,5 +758,5 @@ "*://*.wyleex.com/*", "*://webcache.googleusercontent.com/*" ], - "version": "3.2.2.0" + "version": "3.2.2.1" } diff --git a/sites.js b/sites.js index 3e8801eb..f9cfd789 100644 --- a/sites.js +++ b/sites.js @@ -232,6 +232,7 @@ var defaultSites = { "Beobachter.ch": { allow_cookies: 1, domain: "beobachter.ch", + block_regex: /\.tinypass\.com\//, useragent: "googlebot" }, "Berliner Zeitung": { @@ -934,6 +935,7 @@ var defaultSites = { "Handelszeitung.ch": { allow_cookies: 1, domain: "handelszeitung.ch", + block_regex: /\.tinypass\.com\//, useragent: "googlebot" }, "Harper's Magazine": {