diff --git a/README.md b/README.md index 801b9b6a..a5812dec 100644 --- a/README.md +++ b/README.md @@ -542,6 +542,7 @@ Grouped in options:\ [Die Zeit](https://www.zeit.de) - [Frankfurter Allgemeine Zeitung](https://www.faz.net) - [Freie Presse](https://www.freiepresse.de) - +[Jacobin Magazin](https://jacobin.de) - [Kölner Stadt-Anzeiger](https://www.ksta.de) - [Kölnische Rundschau](https://www.rundschau-online.de) - [Krautreporter](https://krautreporter.de) - diff --git a/changelog.txt b/changelog.txt index 50c40842..08b3a929 100644 --- a/changelog.txt +++ b/changelog.txt @@ -3,6 +3,7 @@ Changelog Bypass Paywalls Clean - Firefox Updates: https://gitlab.com/magnolia1234/bypass-paywalls-firefox-clean/-/releases Post-release +Add Jacobin.de * v3.1.3.0 (2023-04-10) Add Haas Mediengruppe (opt-in to custom sites) diff --git a/contentScript.js b/contentScript.js index be5a457e..4a3cdad0 100644 --- a/contentScript.js +++ b/contentScript.js @@ -691,6 +691,60 @@ else if (matchDomain('freiepresse.de')) { } } +else if (matchDomain('jacobin.de')) { + let paywall = pageContains('h3.m-auto', 'Dieser Artikel ist nur mit Abo zugänglich.'); + if (paywall.length) { + let slash = document.querySelector('div.slash'); + removeDOMElement(paywall[0].parentNode, slash); + let json_script = document.querySelector('script#__NEXT_DATA__'); + if (json_script) { + try { + let json = JSON.parse(json_script.text); + if (json && json.props.pageProps.sections && json.props.pageProps.sections[1].content) { + let url_next = json.query.slug; + if (url_next && !window.location.pathname.includes(url_next)) + refreshCurrentTab(); + let pars = json.props.pageProps.sections[1].content; + let first_par = document.querySelector('body > div#__next p.bodyText'); + if (first_par) { + let par_class = first_par.getAttribute('class'); + let article = first_par.parentNode; + if (article) { + let add_par = false; + for (let par of pars) { + if (!add_par) { + if (par.type === 'paywall') + add_par = true; + } else { + if (par.text) { + let elem_type = 'p'; + let elem_class = par_class; + let elem_style; + if (['paragraph', 'quote'].includes(par.type)) { + if (par.type === 'quote') + elem_style = 'font-size: 36px; font-weight: bold;'; + } else if (par.type === 'header') { + elem_type = 'h2'; + elem_class = 'content-element font-headline h2 my-1em'; + } + let content = par.text.replace(/ /g, ''); + let parser = new DOMParser(); + let content_new = parser.parseFromString('<' + elem_type + ' class="' + elem_class + (elem_style ? '" style="' + elem_style : '') + '">' + content + '', 'text/html'); + article.appendChild(content_new.querySelector(elem_type)); + } else + console.log(par); + } + } + } + } + } + } catch (err) { + console.log(err); + } + } + } +} + else if (matchDomain('krautreporter.de')) { let paywall = document.querySelector('.js-article-paywall'); if (paywall) { diff --git a/custom/manifest.json b/custom/manifest.json index c1ac7564..5a1df76d 100644 --- a/custom/manifest.json +++ b/custom/manifest.json @@ -51,5 +51,5 @@ "webRequestBlocking", "*://*/*" ], - "version": "3.1.3.0" + "version": "3.1.3.1" } diff --git a/manifest.json b/manifest.json index 8df6cdde..069250a7 100644 --- a/manifest.json +++ b/manifest.json @@ -325,6 +325,7 @@ "*://*.irishtimes.com/*", "*://*.italian.tech/*", "*://*.italiaoggi.it/*", + "*://*.jacobin.de/*", "*://*.japantimes.co.jp/*", "*://*.jgnt.co/*", "*://*.journaldunet.com/*", @@ -747,5 +748,5 @@ "*://*.wallkit.net/*", "*://webcache.googleusercontent.com/*" ], - "version": "3.1.3.0" + "version": "3.1.3.1" } diff --git a/sites.js b/sites.js index b2d51578..654bedfd 100644 --- a/sites.js +++ b/sites.js @@ -1008,6 +1008,10 @@ var defaultSites = { domain: "italiaoggi.it", allow_cookies: 1 }, + "Jacobin.de": { + domain: "jacobin.de", + allow_cookies: 1 + }, "Kölner Stadt-Anzeiger": { domain: "ksta.de", allow_cookies: 1