From ba6d45e0dfc14a352646f27c5cc79971cb8bc2b8 Mon Sep 17 00:00:00 2001 From: magnolia1234 <7676006-magnolia1234@users.noreply.gitlab.com> Date: Fri, 29 Dec 2023 17:59:00 +0100 Subject: [PATCH] Fix Sueddeutsche Zeitung Fix Independent.co.uk --- background.js | 16 ++++++++++------ changelog.txt | 6 ++++-- contentScript.js | 36 ++++++++++++++++++++---------------- custom/manifest.json | 2 +- custom/sites_custom.json | 8 +++++++- manifest.json | 2 +- sites.js | 8 +++++--- 7 files changed, 48 insertions(+), 30 deletions(-) diff --git a/background.js b/background.js index c86dabf..269f238 100644 --- a/background.js +++ b/background.js @@ -163,8 +163,7 @@ function setDefaultOptions() { }); } -function check_sites_updated() { - let sites_updated_json = 'https://gitlab.com/magnolia1234/bypass-paywalls-' + url_loc + '-clean/-/raw/master/sites_updated.json'; +function check_sites_updated(sites_updated_json) { fetch(sites_updated_json) .then(response => { if (response.ok) { @@ -184,6 +183,10 @@ function check_sites_updated() { }); } +var ext_path = 'https://gitlab.com/magnolia1234/bypass-paywalls-' + url_loc + '-clean/-/raw/master/'; +var sites_updated_json = 'sites_updated.json'; +var sites_updated_json_online = ext_path + sites_updated_json; + function clear_sites_updated() { ext_api.storage.local.set({ sites_updated: {} @@ -518,9 +521,10 @@ ext_api.storage.local.get({ add_grouped_enabled_domains(grouped_sites); set_rules(sites, updatedSites, customSites); if (enabledSites.includes('#options_optin_update_rules')) { - check_sites_updated(); - sites_custom_ext_json = 'https://gitlab.com/magnolia1234/bypass-paywalls-' + url_loc + '-clean/-/raw/master/custom/sites_custom.json'; - } + sites_updated_json = sites_updated_json_online; + sites_custom_ext_json = ext_path + 'custom/sites_custom.json'; + } + check_sites_updated(sites_updated_json); check_sites_custom_ext(); if (optin_update) check_update(); @@ -1456,7 +1460,7 @@ ext_api.runtime.onMessage.addListener(function (message, sender) { site_switch(); } if (message.request === 'check_sites_updated') { - check_sites_updated(); + check_sites_updated(sites_updated_json_online); } if (message.request === 'clear_sites_updated') { clear_sites_updated(); diff --git a/changelog.txt b/changelog.txt index 677331a..6ec4c0a 100644 --- a/changelog.txt +++ b/changelog.txt @@ -9,7 +9,9 @@ Add Huffingtonpost.it Remove Haaretz Group (fix obsolete) Fix elDiario.es (amp-redirect) Fix Inc42 (css) +Fix Independent.co.uk (fetch from archive.is) Fix S&P Global (js-inline) +Fix Sueddeutsche Zeitung (fetch from archive.is) Fix The Juggernaut Update block general paywall script (Leaky-js-cookie) @@ -1265,7 +1267,7 @@ Add Capital Gazette (local USA) Add Groupe Nice-Matin (France) Add Il Foglio (Italy) Add Science (free articles only) -Add The Independent (UK - archive.today for premium) +Add Independent.co.uk (archive.is for premium) Fix group Tribune Publishing Company (js) Fix The New Statesman (Evolok) Update popup (permission to clear cookies) @@ -2079,7 +2081,7 @@ Fix WSJ (amp for pro/login) * v1.7.5.0 (2020-06-14) Add BBC History Extra Add Discover Magazine -Add Irish Independent +Add Independent.ie Add Republic.ru Fix Telegraph.co.uk (cookies) Fix The Globe and Mail (cleanup) diff --git a/contentScript.js b/contentScript.js index c3c986a..acd87f0 100644 --- a/contentScript.js +++ b/contentScript.js @@ -1244,18 +1244,24 @@ else if (matchDomain(['stuttgarter-nachrichten.de', 'stuttgarter-zeitung.de']) | else if (matchDomain('sueddeutsche.de')) { let url = window.location.href; - let paywall = document.querySelector('div#sz-paywall'); - if (paywall) { - removeDOMElement(paywall); - let article = document.querySelector('div.article-content, div.text'); - if (article) - article.firstChild.before(archiveLink(url)); - let reduced = document.querySelector('p.sz-article-body__paragraph--reduced'); - if (reduced) - reduced.classList.remove('sz-article-body__paragraph--reduced'); - let ads = document.querySelectorAll('div.ad-container'); - hideDOMElement(...ads); + let paywall; + if (window.location.pathname.startsWith('/projekte/artikel/')) { + paywall = document.querySelector('div.offer-page'); + if (paywall && dompurify_loaded) { + removeDOMElement(paywall); + getArchive(url, 'main'); + } + } else { + paywall = document.querySelector('p.sz-article-body__paragraph--reduced'); + if (paywall && dompurify_loaded) { + paywall.removeAttribute('class'); + getArchive(url, 'div[itemprop="articleBody"]'); + } } + window.setTimeout(function () { + let ads = document.querySelectorAll('div.ad-container, er-ad-slot'); + hideDOMElement(...ads); + }, 1500); } else if (matchDomain('tagesspiegel.de')) { @@ -2934,12 +2940,10 @@ else if (matchDomain('independent.co.uk')) { } else { let paywall = document.querySelector('div.article-premium'); let related = document.querySelector('div.related'); - let msg = document.querySelector('div#bpc_archive'); - if (paywall && !related && !msg) { + if (paywall && !related && dompurify_loaded) { paywall.classList.remove('article-premium'); - let article = document.querySelector('div#main'); - if (article) - article.firstChild.before(archiveLink(url)); + csDoneOnce = true; + getArchive(url, 'div#main'); } } } diff --git a/custom/manifest.json b/custom/manifest.json index 8b5d884..9abb95f 100644 --- a/custom/manifest.json +++ b/custom/manifest.json @@ -51,5 +51,5 @@ "webRequestBlocking", "*://*/*" ], - "version": "3.4.8.6" + "version": "3.4.8.7" } diff --git a/custom/sites_custom.json b/custom/sites_custom.json index 55f07ab..eec2540 100644 --- a/custom/sites_custom.json +++ b/custom/sites_custom.json @@ -1,6 +1,6 @@ { "###_remove_sites": { - "cs_code": "al-monitor.com, arkansasonline.com, bild.de, doorbraak.be, gp.se, handelsblatt.com, interestingengineering.com, lastampa.it, politiken.dk, repubblica.it, rp-online.de, sueddeutsche.de, theepochtimes.com, theinformation.com, thestage.co.uk", + "cs_code": "al-monitor.com, arkansasonline.com, bild.de, doorbraak.be, gp.se, handelsblatt.com, interestingengineering.com, lastampa.it, politiken.dk, repubblica.it, rp-online.de, sueddeutsche.de, theepochtimes.com, theinformation.com", "domain": "###" }, "Abajournal.com": { @@ -705,6 +705,12 @@ "block_regex": "\\.tinypass\\.com", "domain": "thenational.scot" }, + "Thestage.co.uk": { + "add_ext_link": "div#ao-MeteringDNAllow|div[class*='-Teaser']", + "add_ext_link_type": "archive.is", + "allow_cookies": 1, + "domain": "thestage.co.uk" + }, "Tijorifinance.com": { "allow_cookies": 1, "domain": "tijorifinance.com", diff --git a/manifest.json b/manifest.json index 58d896b..9ede684 100644 --- a/manifest.json +++ b/manifest.json @@ -824,5 +824,5 @@ "*://archive.vn/*", "*://webcache.googleusercontent.com/*" ], - "version": "3.4.8.6" + "version": "3.4.8.7" } diff --git a/sites.js b/sites.js index 0ef1e47..a0d5354 100644 --- a/sites.js +++ b/sites.js @@ -2105,7 +2105,8 @@ var defaultSites = { "Süddeutsche Zeitung (link to archive.is)": { domain: "sueddeutsche.de", allow_cookies: 1, - block_regex: /\.sueddeutsche\.de\/api\/tinypass\.min\.js/ + block_regex: /\.sueddeutsche\.de\/api\/tinypass\.min\.js/, + cs_dompurify: 1 }, "Swarajyamag": { domain: "swarajyamag.com", @@ -2322,7 +2323,8 @@ var defaultSites = { "The Independent": { domain: "independent.co.uk", allow_cookies: 1, - block_regex: /(\.tinypass\.com\/|cdn\.ampproject\.org\/v\d\/amp-access-.+\.js)/ + block_regex: /(\.tinypass\.com\/|cdn\.ampproject\.org\/v\d\/amp-access-.+\.js)/, + cs_dompurify: 1 }, "The Indian Express": { domain: "indianexpress.com", @@ -2932,4 +2934,4 @@ var fr_indigo_nofix_domains = ['africaintelligence.com', 'africaintelligence.fr' var il_haaretz_group_nofix_domains = ['haaretz.co.il', 'haaretz.com', 'themarker.com']; var it_gedi_nofix_domains = ['gelocal.it', 'limesonline.com']; var nl_mediahuis_region_nofix_domains = ['gooieneemlander.nl', 'haarlemsdagblad.nl', 'ijmuidercourant.nl', 'leidschdagblad.nl', 'noordhollandsdagblad.nl']; -var nofix_sites = ['aamulehti.fi', 'aftenposten.no', 'aftonbladet.se', 'allgaeuer-zeitung.de', 'asahi.com', 'asiatimes.com', 'autosport.com', 'aviationweek.com', 'badische-zeitung.de', 'bloomberglaw.com', 'bloombergtax.com', 'bnn.de', 'borsen.dk', 'businessinsider.de', 'businessinsider.jp', 'businesslive.co.za', 'businesstimes.com.sg', 'caixin.com', 'caixinglobal.com', 'caravanmagazine.in', 'catalyst-journal.com', 'chegg.com', 'codesports.com.au', 'compactmag.com', 'courrierinternational.com', 'coursehero.com', 'deutsche-wirtschafts-nachrichten.de', 'die-glocke.de', 'dn.no', 'dn.se', 'elordenmundial.com', 'entrepreneur.com', 'epw.in', 'expresso.pt', 'falter.at', 'finance.si', 'ftchinese.com', 'ftchineselive.com', 'gamestar.de', 'geo.de', 'golem.de', 'gp.se', 'handelsblatt.com', 'hbrchina.org', 'hbrfrance.fr', 'heise.de', 'hln.be', 'hs.fi', 'ilsole24ore.com', 'information.dk', 'investors.com', 'iltalehti.fi', 'jacobin.com', 'jeuneafrique.com', 'jungefreiheit.de', 'kleinezeitung.at', 'lavie.fr', 'lavozdegalicia.es', 'law360.co.uk', 'law360.com', 'le1hebdo.fr', 'leconomiste.com', 'lefilmfrancais.com', 'lequipe.fr', 'lesjours.fr', 'letemps.ch', 'liberation.fr', 'limburger.nl', 'main-echo.de', 'mainpost.de', 'manager-magazin.de', 'medianama.com', 'mediapart.fr', 'milanofinanza.it', 'mittelbayerische.de', 'monde-diplomatique.fr', 'mondediplo.com', 'money.it', 'moneycontrol.com', 'moodys.com', 'morningstar.com', 'moz.de', 'nachrichten.at', 'nationaljournal.com', 'nature.com', 'nbr.co.nz', 'newslaundry.com', 'nn.de', 'nwzonline.de', 'observador.pt', 'ouest-france.fr', 'philonomist.com', 'pnp.de', 'politicopro.com', 'politiken.dk', 'pressreader.com', 'publico.pt', 'quillette.com', 'republic.ru', 'rheinpfalz.de', 'risk.net', 'rnz.de', 'saechsische.de', 'schwarzwaelder-bote.de', 'sciencedirect.com', 'springer.com', 'statnews.com', 'stern.de', 'stimme.de', 'straitstimes.com', 'stratfor.com', 'streetinsider.com', 'substack.com', 'suedkurier.de', 'swp.de', 'techcrunch.com', 'the-ken.com', 'theinformation.com', 'theinitium.com', 'themorningcontext.com', 'theparisreview.org', 'thestar.com.my', 'thewirechina.com', 'weltwoche.ch', 'weltwoche.de', 'wissenschaft.de', 'wiwo.de', 'worldpoliticsreview.com', 'ynet.co.il'].concat(be_mediahuis_nofix_domains, de_funke_medien_nofix_domains, de_rp_aachen_medien_nofix_domains, fr_groupe_ebra_nofix_domains, fr_indigo_nofix_domains, il_haaretz_group_nofix_domains, it_gedi_nofix_domains, nl_mediahuis_region_nofix_domains); +var nofix_sites = ['11freunde.de', 'aamulehti.fi', 'aftenposten.no', 'aftonbladet.se', 'allgaeuer-zeitung.de', 'asahi.com', 'asiatimes.com', 'autosport.com', 'aviationweek.com', 'badische-zeitung.de', 'bloomberglaw.com', 'bloombergtax.com', 'bnn.de', 'borsen.dk', 'businessinsider.de', 'businessinsider.jp', 'businesslive.co.za', 'businesstimes.com.sg', 'caixin.com', 'caixinglobal.com', 'caravanmagazine.in', 'catalyst-journal.com', 'chegg.com', 'codesports.com.au', 'compactmag.com', 'courrierinternational.com', 'coursehero.com', 'deutsche-wirtschafts-nachrichten.de', 'die-glocke.de', 'dn.no', 'dn.se', 'elordenmundial.com', 'entrepreneur.com', 'epw.in', 'expresso.pt', 'falter.at', 'finance.si', 'ftchinese.com', 'ftchineselive.com', 'gamestar.de', 'geo.de', 'golem.de', 'gp.se', 'handelsblatt.com', 'hbrchina.org', 'hbrfrance.fr', 'heise.de', 'hln.be', 'hs.fi', 'ilsole24ore.com', 'information.dk', 'investors.com', 'iltalehti.fi', 'jacobin.com', 'jeuneafrique.com', 'jungefreiheit.de', 'kleinezeitung.at', 'lavie.fr', 'lavozdegalicia.es', 'law360.co.uk', 'law360.com', 'le1hebdo.fr', 'leconomiste.com', 'lefilmfrancais.com', 'lequipe.fr', 'lesjours.fr', 'letemps.ch', 'liberation.fr', 'limburger.nl', 'main-echo.de', 'mainpost.de', 'manager-magazin.de', 'medianama.com', 'mediapart.fr', 'milanofinanza.it', 'mittelbayerische.de', 'monde-diplomatique.fr', 'mondediplo.com', 'money.it', 'moneycontrol.com', 'moodys.com', 'morningstar.com', 'moz.de', 'nachrichten.at', 'nationaljournal.com', 'nature.com', 'nbr.co.nz', 'newslaundry.com', 'nn.de', 'nwzonline.de', 'observador.pt', 'ouest-france.fr', 'philonomist.com', 'pnp.de', 'politicopro.com', 'politiken.dk', 'pressreader.com', 'publico.pt', 'quillette.com', 'republic.ru', 'rheinpfalz.de', 'risk.net', 'rnz.de', 'saechsische.de', 'schwarzwaelder-bote.de', 'sciencedirect.com', 'springer.com', 'statnews.com', 'stern.de', 'stimme.de', 'straitstimes.com', 'stratfor.com', 'streetinsider.com', 'substack.com', 'suedkurier.de', 'swp.de', 'techcrunch.com', 'the-ken.com', 'theinformation.com', 'theinitium.com', 'themorningcontext.com', 'theparisreview.org', 'thestar.com.my', 'thewirechina.com', 'weltwoche.ch', 'weltwoche.de', 'wissenschaft.de', 'wiwo.de', 'worldpoliticsreview.com', 'ynet.co.il'].concat(be_mediahuis_nofix_domains, de_funke_medien_nofix_domains, de_rp_aachen_medien_nofix_domains, fr_groupe_ebra_nofix_domains, fr_indigo_nofix_domains, il_haaretz_group_nofix_domains, it_gedi_nofix_domains, nl_mediahuis_region_nofix_domains);