From 2175c904d57b16ce28fbe637931662665da98db0 Mon Sep 17 00:00:00 2001 From: magnolia1234 <7676006-magnolia1234@users.noreply.gitlab.com> Date: Thu, 18 May 2023 08:22:47 +0200 Subject: [PATCH] Fix Gruppo SAE.it --- README.md | 9 ++++++--- background.js | 4 ++-- changelog.txt | 1 + contentScript.js | 33 +-------------------------------- contentScript_once.js | 2 ++ custom/manifest.json | 2 +- manifest.json | 2 +- sites.js | 13 +++++++------ 8 files changed, 21 insertions(+), 45 deletions(-) diff --git a/README.md b/README.md index 8d4652a3..fae31fc0 100644 --- a/README.md +++ b/README.md @@ -611,11 +611,10 @@ Grouped in options:\ [Il Fatto Quotidiano](https://www.ilfattoquotidiano.it) - [Il Foglio](https://www.ilfoglio.it) - [Il Manifesto](https://ilmanifesto.it) - -[Il Tirreno](https://www.iltirreno.it) - [Internazionale](https://www.internazionale.it) - [Italia Oggi](https://www.italiaoggi.it) - -[La Gazzetta dello Sport](https://www.gazzetta.it) - -[La Nuova Sardegna](https://www.lanuovasardegna.it) +[La Gazzetta dello Sport](https://www.gazzetta.it) + Grouped in options:\ *Gruppo GEDI.it* sites like\ @@ -635,6 +634,10 @@ Grouped in options:\ [Il Telegrafo Livorno](https://www.iltelegrafolivorno.it) - [La Nazione](https://www.lanazione.it) +*[Gruppo SAE.it](https://www.grupposae.it/i-quotidiani)** sites like\ +[Il Tirreno](https://www.iltirreno.it)* - +[La Nuova Sardegna](https://www.lanuovasardegna.it)* + ##### Netherlands/Flanders [De Limburger](https://www.limburger.nl) - [De Tijd](https://www.tijd.be) - diff --git a/background.js b/background.js index 51c03a09..fcd8baa3 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', 'cicero.de', 'defector.com', 'ilmanifesto.it', 'iltirreno.it', 'inc42.com', 'independent.ie', 'ipolitics.ca', 'italiaoggi.it', 'jacobin.de', 'lanuovasardegna.it', 'lecourrierdesstrateges.fr', 'lesechos.fr', 'marianne.net', 'newleftreview.org', 'newscientist.com', 'outlookbusiness.com', 'prospectmagazine.co.uk', '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', 'bloomberg.com', 'cicero.de', 'defector.com', 'ilmanifesto.it', 'inc42.com', 'independent.ie', 'ipolitics.ca', 'italiaoggi.it', 'jacobin.de', 'lecourrierdesstrateges.fr', 'lesechos.fr', 'marianne.net', 'newleftreview.org', 'newscientist.com', 'outlookbusiness.com', 'prospectmagazine.co.uk', '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; @@ -428,7 +428,7 @@ ext_api.storage.local.get({ } else { ext_api.management.getSelf(function (result) { if ((result.installType === 'development' || (result.installType !== 'development' && !enabledSites.includes('#options_on_update')))) { - let new_groups = ['###_ar_grupo_clarin', '###_be_groupe_ipm', '###_be_roularta', '###_de_noz_mhn', '###_uk_nat_world']; + let new_groups = ['###_ar_grupo_clarin', '###_be_groupe_ipm', '###_be_roularta', '###_de_noz_mhn', '###_it_gruppo_sae', '###_uk_nat_world']; let open_options = new_groups.some(group => !enabledSites.includes(group) && grouped_sites[group].some(domain => enabledSites.includes(domain) && !customSites_domains.includes(domain))) || (enabledSites.includes('tinypass.com') && !enabledSites.includes('piano.io')); if (open_options) diff --git a/changelog.txt b/changelog.txt index 58fc87f9..1577b10a 100644 --- a/changelog.txt +++ b/changelog.txt @@ -4,6 +4,7 @@ Updates (install signed xpi-file): https://gitlab.com/magnolia1234/bypass-paywal Post-release Remove (custom) Substack (fix obsolete) +Fix Gruppo SAE.it (free articles only) Fix Tagesspiegel.de (not background/checkpoint) Update custom sites/popup (remove Google Search Tool) diff --git a/contentScript.js b/contentScript.js index b18dcd73..b11513d1 100644 --- a/contentScript.js +++ b/contentScript.js @@ -1942,39 +1942,8 @@ else if (matchDomain('ilmanifesto.it')) { }, 1000); } -else if (matchDomain(['iltirreno.it', 'lanuovasardegna.it'])) { +else if (matchDomain(['iltirreno.it', 'lanuovasardegna.it']) || matchDomain(['gazzettadimodena.it', 'gazzettadireggio.it', 'lanuovaferrara.it'])) { if (window.location.pathname.includes('/news/')) { - let paywall = document.querySelector('div.MuiBox-root > h4.MuiTypography-h4'); - if (paywall && dompurify_loaded) { - let article = document.querySelector('div.MuiGrid-root.MuiGrid-grid-sm-7 > div'); - if (article) { - removeDOMElement(paywall.parentNode); - try { - fetch(window.location.href) - .then(response => { - if (response.ok) { - response.text().then(html => { - let parser = new DOMParser(); - let doc = parser.parseFromString(html, 'text/html'); - let json = doc.querySelector('script#__NEXT_DATA__'); - if (json) { - let article_new = JSON.parse(json.text).props.pageProps.article.content; - if (article_new) { - let parser = new DOMParser(); - let doc = parser.parseFromString('
' + DOMPurify.sanitize(article_new) + '
', 'text/html'); - let content_new = doc.querySelector('div'); - article.innerHTML = ''; - article.appendChild(content_new); - } - } - }) - } - }); - } catch (err) { - console.log(err); - } - } - } window.setTimeout(function () { let banners = document.querySelectorAll('div.MuiSnackbar-root, div.css-16cchgy'); removeDOMElement(...banners); diff --git a/contentScript_once.js b/contentScript_once.js index 2b930de9..a2725556 100644 --- a/contentScript_once.js +++ b/contentScript_once.js @@ -85,6 +85,8 @@ window.setTimeout(function () { } else if (hostname.endsWith('.it')) { if (document.querySelector('link[href^="//citynews.stgy.ovh/"]')) group = '###_it_citynews';// no fix + else if (matchDomain(['gazzettadimodena.it', 'gazzettadireggio.it', 'lanuovaferrara.it'])) + group = '###_it_gruppo_sae'; } else if (hostname.endsWith('.nl')) { if (document.querySelector('script[src*=".ndcmediagroep.nl/"]')) group = '###_nl_mediahuis_noord'; diff --git a/custom/manifest.json b/custom/manifest.json index 468f1e4f..2d351066 100644 --- a/custom/manifest.json +++ b/custom/manifest.json @@ -51,5 +51,5 @@ "webRequestBlocking", "*://*/*" ], - "version": "3.1.8.1" + "version": "3.1.8.2" } diff --git a/manifest.json b/manifest.json index 550c2e13..c9437db7 100644 --- a/manifest.json +++ b/manifest.json @@ -753,5 +753,5 @@ "*://*.wallkit.net/*", "*://webcache.googleusercontent.com/*" ], - "version": "3.1.8.1" + "version": "3.1.8.2" } diff --git a/sites.js b/sites.js index d69eb2fc..ab4a8935 100644 --- a/sites.js +++ b/sites.js @@ -879,6 +879,13 @@ var defaultSites = { allow_cookies: 1, block_regex: /(scripts\.repubblica\.it\/pw\/pw\.js|cdn\.ampproject\.org\/v\d\/amp-(access|user-notification)-.+\.js)/ }, + "Gruppo SAE.it (free articles only)": { + domain: "###_it_gruppo_sae", + group: [ + "iltirreno.it", + "lanuovasardegna.it" + ] + }, "Haaretz English": { domain: "haaretz.com", allow_cookies: 1, @@ -980,9 +987,6 @@ var defaultSites = { allow_cookies: 1, block_regex: /(\.(cedscdn|cedsdigital)\.it\/.+\/PaywallMeter\.js|cdn\.ampproject\.org\/v\d\/amp-(access|consent|subscriptions)-.+\.(m)?js)/ }, - "Il Tirreno": { - domain: "iltirreno.it" - }, "Inc.com": { domain: "inc.com", block_regex: /\.tinypass\.com\// @@ -1118,9 +1122,6 @@ var defaultSites = { allow_cookies: 1, block_regex: /(\.weborama\.fr\/|cdn\.ampproject\.org\/v\d\/amp-access-.+\.js)/ }, - "La Nuova Sardegna": { - domain: "lanuovasardegna.it" - }, "La Segunda": { domain: "lasegunda.com", block_regex: /\.(lasegunda\.com|emol\.cl)\/(.+\/)?js\/(.+\/)?(modal|merPramV\d|PramModal\.min)\.js/