From 4934148035f38c0bd2fcdd3811addda40ec7b39c Mon Sep 17 00:00:00 2001 From: magnolia1234 <7676006-magnolia1234@users.noreply.gitlab.com> Date: Sun, 6 Dec 2020 22:32:59 +0100 Subject: [PATCH] Add Groupe EBRA (France) --- README.md | 10 ++++++++++ background.js | 14 ++++++++++++-- changelog.txt | 1 + contentScript.js | 21 +++++++++++++++++++++ manifest.json | 11 ++++++++++- sites.js | 1 + 6 files changed, 55 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 2f19a31..dcbdc5c 100644 --- a/README.md +++ b/README.md @@ -171,6 +171,16 @@ Alma Talent sites (grouped in options) like [Challenges](https://www.challenges.fr) – [Charlie Hebdo](https://charliehebdo.fr) - [Esprit](https://esprit.presse.fr) +Groupe EBRA sites (grouped in options) like +[Dernières Nouvelles d'Alsace](https://www.dna.fr) - +[L'Alsace](https://www.lalsace.fr) - +[L'Est Républicain](https://www.estrepublicain.fr) - +[Le Bien Public](https://www.bienpublic.com) - +[Le Dauphiné Libéré](https://www.ledauphine.com) - +[Le Journal de Saône-et-Loire](https://www.lejsl.com) - +[Le Progrès](https://www.leprogres.fr) - +[Le Républicain Lorrain](https://www.republicain-lorrain.fr) - +[Vosges Matin](https://www.vosgesmatin.fr) Groupe Rossel sites (grouped in options) like [L'Aisne nouvelle](https://www.aisnenouvelle.fr) - [L'Ardennais](https://www.lardennais.fr) - diff --git a/background.js b/background.js index 36ecfcb..5f0e66d 100644 --- a/background.js +++ b/background.js @@ -291,6 +291,7 @@ const au_prov_news_domains = ['news-mail.com.au', 'frasercoastchronicle.com.au', const es_grupo_vocento_domains = ['diariosur.es', 'diariovasco.com', 'elcomercio.es', 'elcorreo.com', 'eldiariomontanes.es', 'elnortedecastilla.es', 'hoy.es', 'ideal.es', 'larioja.com', 'laverdad.es', 'lavozdigital.es']; const fi_alma_talent_domains = ['arvopaperi.fi', 'kauppalehti.fi', 'marmai.fi', 'mediuutiset.fi', 'mikrobitti.fi', 'talouselama.fi', 'tekniikkatalous.fi', 'tivi.fi', 'uusisuomi.fi']; const fr_be_groupe_rossel_domains = ['aisnenouvelle.fr', 'courrier-picard.fr', 'lardennais.fr', 'lavoixdunord.fr', 'lecho.be', 'lesoir.be', 'lest-eclair.fr', 'liberation-champagne.fr', 'lunion.fr', 'nordeclair.fr', 'paris-normandie.fr', 'sudinfo.be']; +const fr_groupe_ebra_domains = ['bienpublic.com', 'dna.fr', 'estrepublicain.fr', 'lalsace.fr', 'ledauphine.com', 'lejsl.com', 'leprogres.fr', 'republicain-lorrain.fr', 'vosgesmatin.fr']; const ilmessaggero_domains = ['corriereadriatico.it', 'ilgazzettino.it', 'ilmattino.it', 'quotidianodipuglia.it']; const nymag_domains = ['grubstreet.com', 'thecut.com', 'vulture.com']; // pg_domains has only grouped remove_cookies_select_drop rules @@ -305,7 +306,7 @@ const userAgentMobileB = "Chrome/80.0.3987.92 Mobile Safari/537.36 (compatible; var enabledSites = []; var disabledSites = []; var defaultSites_grouped_domains = Object.values(defaultSites); -var defaultSites_domains = defaultSites_grouped_domains.concat(ad_region_domains, au_comm_media_domains, au_news_corp_domains, au_prov_news_domains, es_grupo_vocento_domains, fi_alma_talent_domains, fr_be_groupe_rossel_domains, ilmessaggero_domains, nymag_domains); +var defaultSites_domains = defaultSites_grouped_domains.concat(ad_region_domains, au_comm_media_domains, au_news_corp_domains, au_prov_news_domains, es_grupo_vocento_domains, fi_alma_talent_domains, fr_be_groupe_rossel_domains, fr_groupe_ebra_domains, ilmessaggero_domains, nymag_domains); var customSites = {}; var customSites_domains = []; @@ -373,6 +374,10 @@ function add_grouped_sites(init_rules) { use_google_bot.push(domain); } } + for (let domain of fr_groupe_ebra_domains) { + allow_cookies.push(domain); + blockedRegexes[domain] = /(.+\.poool\.fr\/.+|cdn\.ampproject\.org\/v\d\/amp-(access|iframe)-.+\.js)/; + } for (let domain of ilmessaggero_domains) blockedRegexes[domain] = /utils\.cedsdigital\.it\/js\/PaywallMeter\.js/; for (let domain of pg_domains) @@ -406,6 +411,10 @@ function add_grouped_sites(init_rules) { enabledSites = enabledSites.concat(fr_be_groupe_rossel_domains); else disabledSites = disabledSites.concat(fr_be_groupe_rossel_domains); + if (enabledSites.includes('###_fr_groupe_ebra')) + enabledSites = enabledSites.concat(fr_groupe_ebra_domains); + else + disabledSites = disabledSites.concat(fr_groupe_ebra_domains); if (enabledSites.includes('ilmessaggero.it')) enabledSites = enabledSites.concat(ilmessaggero_domains); else @@ -728,11 +737,12 @@ ext_api.webRequest.onBeforeSendHeaders.addListener(function(details) { let au_apn_site = (header_referer && (urlHost(header_referer).endsWith('com.au') || urlHost(header_referer).endsWith('net.au')) && details.url.includes('https://media.apnarm.net.au/')); let au_swm_site = (header_referer && urlHost(header_referer).endsWith('com.au') && details.url.includes('https://s.thewest.com.au/')); let es_grupo_vocento_site = (matchUrlDomain('cdn.ampproject.org', details.url) && matchUrlDomain(es_grupo_vocento_domains, header_referer) && isSiteEnabled({url: header_referer})); + let fr_groupe_ebra_site = (matchUrlDomain('cdn.ampproject.org', details.url) && matchUrlDomain(fr_groupe_ebra_domains, header_referer) && isSiteEnabled({url: header_referer})); let fr_lacroix_amp_site = (matchUrlDomain('cdn.ampproject.org', details.url) && matchUrlDomain('la-croix.com', header_referer) && isSiteEnabled({url: header_referer})); let sz_amp_site = (matchUrlDomain('cdn.ampproject.org', details.url) && matchUrlDomain('sueddeutsche.de', header_referer) && isSiteEnabled({url: header_referer})); let uk_telegraph_amp_site = (matchUrlDomain('cdn.ampproject.org', details.url) && matchUrlDomain('telegraph.co.uk', header_referer) && isSiteEnabled({url: header_referer})); - if (!isSiteEnabled(details) && !inkl_site && !au_nc_amp_site && !au_apn_site && !au_swm_site && !es_grupo_vocento_site && !fr_lacroix_amp_site && !sz_amp_site && !uk_telegraph_amp_site) { + if (!isSiteEnabled(details) && !inkl_site && !au_nc_amp_site && !au_apn_site && !au_swm_site && !es_grupo_vocento_site && !fr_groupe_ebra_site && !fr_lacroix_amp_site && !sz_amp_site && !uk_telegraph_amp_site) { return; } diff --git a/changelog.txt b/changelog.txt index 17c9a72..3fd137b 100644 --- a/changelog.txt +++ b/changelog.txt @@ -2,6 +2,7 @@ Changelog Bypass Paywalls Clean - Firefox Post-release +Add Groupe EBRA (France) * v1.9.8.0 (2020-12-06) Add El Comercio, Ideal & La Voz de Cadiz (Spain) diff --git a/contentScript.js b/contentScript.js index d02277f..3897b17 100644 --- a/contentScript.js +++ b/contentScript.js @@ -6,6 +6,7 @@ var csDone = false; // clean local storage of sites (with an exemption for hold-list) var arr_localstorage_hold = ['charliehebdo.fr', 'elmundo.es', 'kurier.at', 'nknews.org', 'nrz.de', 'seekingalpha.com', 'sfchronicle.com', 'thehindu.com', 'thetimes.co.uk', 'waz.de', 'wp.de', 'wr.de']; var es_grupo_vocento_domains = ['diariosur.es', 'diariovasco.com', 'elcomercio.es', 'elcorreo.com', 'eldiariomontanes.es', 'elnortedecastilla.es', 'hoy.es', 'ideal.es', 'larioja.com', 'laverdad.es', 'lavozdigital.es']; +var fr_groupe_ebra_domains = ['bienpublic.com', 'dna.fr', 'estrepublicain.fr', 'lalsace.fr', 'ledauphine.com', 'lejsl.com', 'leprogres.fr', 'republicain-lorrain.fr', 'vosgesmatin.fr']; arr_localstorage_hold = arr_localstorage_hold.concat(es_grupo_vocento_domains); if (!matchDomain(arr_localstorage_hold)){ window.localStorage.clear(); @@ -1805,6 +1806,26 @@ else if (matchDomain('esprit.presse.fr')) { removeDOMElement(paywall); } +else if ((domain = matchDomain(fr_groupe_ebra_domains)) && window.location.href.match(/\/\d{4}\/\d{2}\/\d{2}\//)) { + let url = window.location.href; + let url_new = url.replace(domain + '/', domain + '/amp/'); + if (!url.includes(domain + '/amp/')) { + let free = document.querySelector('[class^="paywall"]'); + if (!free) { + window.setTimeout(function () { + window.location.href = url_new; + }, 500); // Delay (in milliseconds) + } + } else { + let amp_access_hide = document.querySelector('[amp-access-hide]'); + if (amp_access_hide) { + let not_access_section = document.querySelector('section[amp-access="NOT access"]'); + removeDOMElement(not_access_section); + amp_access_hide.removeAttribute('amp-access-hide'); + } + } +} + else csDone = true; diff --git a/manifest.json b/manifest.json index a7bfa6e..40ad604 100644 --- a/manifest.json +++ b/manifest.json @@ -60,6 +60,7 @@ "*://*.bd.nl/*", "*://*.belfasttelegraph.co.uk/*", "*://*.bendigoadvertiser.com.au/*", + "*://*.bienpublic.com/*", "*://*.bizjournals.com/*", "*://*.bloomberg.com/*", "*://*.bloombergquint.com/*", @@ -106,6 +107,7 @@ "*://*.digiday.com/*", "*://*.discovermagazine.com/*", "*://*.dn.se/*", + "*://*.dna.fr/*", "*://*.dvhn.nl/*", "*://*.economist.com/*", "*://*.ed.nl/*", @@ -121,6 +123,7 @@ "*://*.elperiodico.com/*", "*://*.estadao.com.br/*", "*://*.estrellavalpo.cl/*", + "*://*.estrepublicain.fr/*", "*://*.eurekareport.com.au/*", "*://*.exame.abril.com.br/*", "*://*.examiner.com.au/*", @@ -185,6 +188,7 @@ "*://*.la-croix.com/*", "*://*.labusinessjournal.com/*", "*://*.ladepeche.fr/*", + "*://*.lalsace.fr/*", "*://*.lanacion.com.ar/*", "*://*.lardennais.fr/*", "*://*.larioja.com/*", @@ -197,9 +201,12 @@ "*://*.lavozdigital.es/*", "*://*.lc.nl/*", "*://*.lecho.be/*", + "*://*.ledauphine.com/*", "*://*.ledevoir.com/*", "*://*.lejdd.fr/*", + "*://*.lejsl.com/*", "*://*.leparisien.fr/*", + "*://*.leprogres.fr/*", "*://*.lescienze.it/*", "*://*.lesechos.com/*", "*://*.lesechos.fr/*", @@ -266,6 +273,7 @@ "*://*.qz.com/*", "*://*.repubblica.it/*", "*://*.republic.ru/*", + "*://*.republicain-lorrain.fr/*", "*://*.rollingstone.com/*", "*://*.sacbee.com/*", "*://*.saechsische.de/*", @@ -335,6 +343,7 @@ "*://*.vanityfair.com/*", "*://*.variety.com/*", "*://*.volkskrant.nl/*", + "*://*.vosgesmatin.fr/*", "*://*.vulture.com/*", "*://*.warwickdailynews.com.au/*", "*://*.washingtonpost.com/*", @@ -379,5 +388,5 @@ "*://*.repstatic.it/*", "*://*.userzoom.com/*" ], - "version": "1.9.8.0" + "version": "1.9.8.1" } \ No newline at end of file diff --git a/sites.js b/sites.js index 5c7651d..0ff135f 100644 --- a/sites.js +++ b/sites.js @@ -70,6 +70,7 @@ var defaultSites = "Glassdoor": "glassdoor.com", "Globes": "globes.co.il", "Groene Amsterdammer": "groene.nl", + "Groupe EBRA (France)": "###_fr_groupe_ebra", "Groupe Rossel (France/Belgium)": "###_fr_be_groupe_rossel", "Grupo Vocento (Spain, regional daily)": "###_es_grupo_vocento", "Haaretz English": "haaretz.com",