From 82af78b1089e792f633b374be30e22105294c49a Mon Sep 17 00:00:00 2001 From: magnolia1234 <7676006-magnolia1234@users.noreply.gitlab.com> Date: Mon, 15 Aug 2022 18:05:31 +0200 Subject: [PATCH] Fix El Correo & La Voz de Cadiz --- README.md | 4 +-- background.js | 3 +-- changelog.txt | 1 + contentScript.js | 63 +++++++++++++++++--------------------------- custom/manifest.json | 2 +- manifest.json | 2 +- sites.js | 13 +++------ 7 files changed, 34 insertions(+), 54 deletions(-) diff --git a/README.md b/README.md index cf3f47c..e029459 100755 --- a/README.md +++ b/README.md @@ -621,7 +621,6 @@ Grouped in options:\ [Finance.si](https://www.finance.si) ##### Spain -[ABC](https://www.abc.es) - [El Confidencial](https://www.elconfidencial.com) - [El Diario.es](https://www.eldiario.es) - [El Español](https://www.elespanol.com) - @@ -648,7 +647,8 @@ Grouped in options:\ [El Mundo](https://www.elmundo.es) - [Expansión](https://www.expansion.com) - [Marca](https://www.marca.com)\ -*Grupo Vocento* (ABC regional) sites like\ +*Grupo Vocento* sites like\ +[ABC](https://www.abc.es) - [Diario Vasco](https://www.diariovasco.com) - [El Comercio](https://www.elcomercio.es) - [El Correo](https://www.elcorreo.com) - diff --git a/background.js b/background.js index 22632f8..73e30c0 100755 --- a/background.js +++ b/background.js @@ -356,7 +356,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 = ['###_de_westfalen_medien', '###_es_unidad', '###_it_gedi', '###_nl_dpg_media', '###_usa_genomeweb']; + let new_groups = ['###_de_westfalen_medien', '###_es_grupo_vocento', '###_es_unidad', '###_it_gedi', '###_nl_dpg_media', '###_usa_genomeweb']; let open_options = new_groups.some(group => !enabledSites.includes(group) && grouped_sites[group].some(domain => enabledSites.includes(domain) && !customSites_domains.includes(domain))); if (open_options) ext_api.runtime.openOptionsPage(); @@ -1003,7 +1003,6 @@ ext_api.webRequest.onBeforeSendHeaders.addListener(function(details) { if (matchUrlDomain(change_headers, details.url) && !['font', 'image', 'stylesheet'].includes(details.type)) { var mobile = details.requestHeaders.filter(x => x.name.toLowerCase() === "user-agent" && x.value.toLowerCase().includes("mobile")).length; var googlebotEnabled = matchUrlDomain(use_google_bot, details.url) && - !(matchUrlDomain('abc.es', details.url) && mobile) && !(matchUrlDomain('barrons.com', details.url) && enabledSites.includes('#options_disable_gb_barrons')) && !(matchUrlDomain(['economictimes.com', 'economictimes.indiatimes.com'], details.url) && !details.url.split(/\?|#/)[0].endsWith('.cms')) && !(matchUrlDomain('theaustralian.com.au', details.url) && !details.url.startsWith('https://www.theaustralian.com.au/the-oz/')) && diff --git a/changelog.txt b/changelog.txt index 9524ea4..48afab3 100644 --- a/changelog.txt +++ b/changelog.txt @@ -2,6 +2,7 @@ Changelog Bypass Paywalls Clean - Chrome Post-release +Fix El Correo & La Voz de Cadiz * v2.8.0.0 (2022-08-15) Add Gazzetta.it diff --git a/contentScript.js b/contentScript.js index c84e2fc..8de2bc8 100755 --- a/contentScript.js +++ b/contentScript.js @@ -12,7 +12,7 @@ var de_madsack_domains = ['haz.de', 'kn-online.de', 'ln-online.de', 'lvz.de', 'm var de_madsack_custom_domains = ['aller-zeitung.de', 'dnn.de', 'gnz.de', 'goettinger-tageblatt.de', 'paz-online.de', 'sn-online.de', 'waz-online.de']; var de_westfalen_medien_domains = ['muensterschezeitung.de', 'westfalen-blatt.de', 'wn.de']; var es_epiberica_domains = ['diaridegirona.cat', 'diariocordoba.com', 'diariodeibiza.es', 'diariodemallorca.es', 'eldia.es', 'elperiodicodearagon.com', 'elperiodicoextremadura.com', 'elperiodicomediterraneo.com', 'emporda.info', 'epe.es', 'farodevigo.es', 'informacion.es', 'laopinioncoruna.es', 'laopiniondemalaga.es', 'laopiniondemurcia.es', 'laopiniondezamora.es', 'laprovincia.es', 'levante-emv.com', 'lne.es', 'mallorcazeitung.es', 'regio7.cat']; -var es_grupo_vocento_domains = ['diariosur.es', 'diariovasco.com', 'elcomercio.es', 'elcorreo.com', 'eldiariomontanes.es', 'elnortedecastilla.es', 'hoy.es', 'ideal.es', 'larioja.com', 'lasprovincias.es', 'laverdad.es', 'lavozdigital.es']; +var es_grupo_vocento_domains = ['abc.es', 'diariosur.es', 'diariovasco.com', 'elcomercio.es', 'elcorreo.com', 'eldiariomontanes.es', 'elnortedecastilla.es', 'hoy.es', 'ideal.es', 'larioja.com', 'lasprovincias.es', 'laverdad.es', 'lavozdigital.es']; var es_unidad_domains = ['elmundo.es', 'expansion.com', 'marca.com']; var fi_alma_talent_domains = ['arvopaperi.fi', 'iltalehti.fi', 'kauppalehti.fi', 'marmai.fi', 'mediuutiset.fi', 'mikrobitti.fi', 'talouselama.fi', 'tekniikkatalous.fi', 'tivi.fi', 'uusisuomi.fi']; var fr_groupe_ebra_domains = ['bienpublic.com', 'dna.fr', 'estrepublicain.fr', 'lalsace.fr', 'ledauphine.com', 'lejsl.com', 'leprogres.fr', 'republicain-lorrain.fr', 'vosgesmatin.fr']; @@ -39,7 +39,7 @@ var usa_outside_mag_domains = ["backpacker.com", "betamtb.com", "betternutrition var usa_tribune_domains = ['baltimoresun.com', 'chicagotribune.com', 'courant.com', 'dailypress.com', 'mcall.com', 'nydailynews.com', 'orlandosentinel.com', 'pilotonline.com', 'sun-sentinel.com']; // clean local storage of sites (with an exemption for hold-list) -var arr_localstorage_hold = ['abc.es', 'allgaeuer-zeitung.de', 'augsburger-allgemeine.de', 'barrons.com', 'businessoffashion.com', 'challenges.fr', 'charliehebdo.fr', 'cmjornal.pt', 'corriere.it', 'corrieredellosport.it', 'cyclingtips.com', 'eldiario.es', 'elespanol.com', 'elle.fr', 'elpais.com', 'elperiodico.com', 'enotes.com', 'estadao.com.br', 'forbes.com', 'fortune.com', 'economictimes.com', 'freiepresse.de', 'ilfoglio.it', 'inc42.com', 'lanouvellerepublique.fr', 'lesechos.fr', 'mid-day.com', 'nytimes.com', 'nzherald.co.nz', 'scmp.com', 'seekingalpha.com', 'substack.com', 'telegraph.co.uk', 'theatlantic.com', 'thehindu.com', 'thetimes.co.uk', 'wsj.com'].concat(de_funke_medien_domains, de_westfalen_medien_domains, es_epiberica_domains, es_grupo_vocento_domains, es_unidad_domains, fr_groupe_ebra_domains, fr_groupe_la_depeche_domains, fr_groupe_nice_matin_domains, it_quotidiano_domains, ca_gcm_domains, nl_dpg_media_domains, no_nhst_media_domains, usa_hearst_comm_domains); +var arr_localstorage_hold = ['allgaeuer-zeitung.de', 'augsburger-allgemeine.de', 'barrons.com', 'businessoffashion.com', 'challenges.fr', 'charliehebdo.fr', 'cmjornal.pt', 'corriere.it', 'corrieredellosport.it', 'cyclingtips.com', 'eldiario.es', 'elespanol.com', 'elle.fr', 'elpais.com', 'elperiodico.com', 'enotes.com', 'estadao.com.br', 'forbes.com', 'fortune.com', 'economictimes.com', 'freiepresse.de', 'ilfoglio.it', 'inc42.com', 'lanouvellerepublique.fr', 'lesechos.fr', 'mid-day.com', 'nytimes.com', 'nzherald.co.nz', 'scmp.com', 'seekingalpha.com', 'substack.com', 'telegraph.co.uk', 'theatlantic.com', 'thehindu.com', 'thetimes.co.uk', 'wsj.com'].concat(de_funke_medien_domains, de_westfalen_medien_domains, es_epiberica_domains, es_grupo_vocento_domains, es_unidad_domains, fr_groupe_ebra_domains, fr_groupe_la_depeche_domains, fr_groupe_nice_matin_domains, it_quotidiano_domains, ca_gcm_domains, nl_dpg_media_domains, no_nhst_media_domains, usa_hearst_comm_domains); if (!matchDomain(arr_localstorage_hold)) { window.localStorage.clear(); } @@ -125,7 +125,7 @@ if ((bg2csData !== undefined) && bg2csData.optin_setcookie) { function amp_iframes_replace(weblink = false, source = '') { let amp_iframes = document.querySelectorAll('amp-iframe' + (source ? '[src*="'+ source + '"]' : '')); - let elem; + let par, elem; for (let amp_iframe of amp_iframes) { if (!weblink) { elem = document.createElement('iframe'); @@ -138,12 +138,13 @@ function amp_iframes_replace(weblink = false, source = '') { }); amp_iframe.parentNode.replaceChild(elem, amp_iframe); } else { - amp_iframe.removeAttribute('class'); + par = document.createElement('p'); elem = document.createElement('a'); elem.innerText = 'Media-link'; elem.setAttribute('href', amp_iframe.getAttribute('src')); elem.setAttribute('target', '_blank'); - amp_iframe.parentNode.replaceChild(elem, amp_iframe); + par.appendChild(elem); + amp_iframe.parentNode.replaceChild(par, amp_iframe); } } } @@ -1010,27 +1011,7 @@ else } else if (window.location.hostname.match(/\.(es|pt|cat)$/) || matchDomain(['diariocordoba.com', 'diariovasco.com', 'elconfidencial.com', 'elcorreo.com', 'elespanol.com', 'elpais.com', 'elperiodico.com', 'elperiodicodearagon.com', 'elperiodicoextremadura.com', 'elperiodicomediterraneo.com', 'emporda.info', 'expansion.com', 'larioja.com', 'levante-emv.com', 'marca.com', 'politicaexterior.com'])) {//spain/portugal -if (matchDomain('abc.es')) { - let paywall = document.querySelector('div.voc-paywall'); - if (window.location.pathname.endsWith('_amp.html')) { - amp_unhide_access_hide('="result=\'ALLOW_ACCESS\'"', '', 'amp-ad, amp-embed'); - removeDOMElement(paywall); - let body_top = document.querySelector('body#top'); - if (body_top) - body_top.removeAttribute('id'); - } else { - let amphtml = document.querySelector('link[rel="amphtml"]'); - if (paywall && amphtml) { - removeDOMElement(paywall); - window.location.href = amphtml.href; - } else { - let banners = document.querySelectorAll('div.ev-em-modal, span.mega-superior'); - removeDOMElement(...banners); - } - } -} - -else if (matchDomain(['ara.cat', 'arabalears.cat'])) { +if (matchDomain(['ara.cat', 'arabalears.cat'])) { let url = window.location.href; if (!window.location.pathname.endsWith('.amp.html')) { let paywall = document.querySelector('div.paywall'); @@ -1146,18 +1127,24 @@ else if (matchDomain('elperiodico.com')) { } else if (matchDomain(es_grupo_vocento_domains)) { + let paywall = document.querySelector('.voc-paywall, .container-wall-exclusive'); if (!window.location.pathname.endsWith('_amp.html')) { - let paywall = document.querySelector('.content-exclusive-bg, #cierre_suscripcion, ev-engagement[group-name^="paywall-"]'); let amphtml = document.querySelector('link[rel="amphtml"]'); + if (!amphtml) + amphtml = {href: window.location.pathname.replace('.html', '_amp.html')}; if (paywall && amphtml) { removeDOMElement(paywall); window.location.href = amphtml.href; - } + } else { + let banners = document.querySelectorAll('.voc-advertising, div.ev-em-modal, span.mega-superior'); + removeDOMElement(...banners); + } } else { - if (!matchDomain('lavozdigital.es')) - amp_unhide_access_hide('="result=\'ALLOW_ACCESS\'"', '="result!=\'ALLOW_ACCESS\'"', 'amp-ad, amp-embed'); - else - amp_unhide_subscr_section(); + amp_unhide_access_hide('="result=\'ALLOW_ACCESS\'"', '="result!=\'ALLOW_ACCESS\'"', 'amp-ad, amp-embed'); + removeDOMElement(paywall); + let body_top = document.querySelector('body#top'); + if (body_top) + body_top.removeAttribute('id'); } } @@ -1770,13 +1757,11 @@ else if (matchDomain('italiaoggi.it')) { let json_text = json.articleBody; let content = article_locked.querySelector('section'); if (json_text && content) { - if (json_text && content) { - let parser = new DOMParser(); - json_text = DOMPurify.sanitize(json_text).replace(/&apos;/g, "'").replace(/;/g, ''); - let doc = parser.parseFromString('
' + json_text + '
', 'text/html'); - let content_new = doc.querySelector('div'); - content.parentNode.replaceChild(content_new, content); - } + let parser = new DOMParser(); + json_text = DOMPurify.sanitize(json_text).replace(/&apos;/g, "'").replace(/;/g, ''); + let doc = parser.parseFromString('
' + json_text + '
', 'text/html'); + let content_new = doc.querySelector('div'); + content.parentNode.replaceChild(content_new, content); } } } diff --git a/custom/manifest.json b/custom/manifest.json index 682f496..ccef63a 100644 --- a/custom/manifest.json +++ b/custom/manifest.json @@ -43,5 +43,5 @@ "webRequestBlocking", "" ], - "version": "2.8.0.0" + "version": "2.8.0.1" } diff --git a/manifest.json b/manifest.json index ceb581b..fa70e65 100755 --- a/manifest.json +++ b/manifest.json @@ -687,5 +687,5 @@ "*://gcm.omerlocdn.com/*", "*://webcache.googleusercontent.com/*" ], - "version": "2.8.0.0" + "version": "2.8.0.1" } diff --git a/sites.js b/sites.js index 8171a24..d55c5d5 100755 --- a/sites.js +++ b/sites.js @@ -1,10 +1,4 @@ var defaultSites = { - "ABC.es": { - domain: "abc.es", - allow_cookies: 1, - block_regex: /(\.evolok\.net\/|cdn\.ampproject\.org\/v\d\/amp-access-.+\.js)/, - useragent: "googlebot" - }, "Advance Local": { domain: "###_usa_adv_local", allow_cookies: 1, @@ -720,6 +714,7 @@ var defaultSites = { "Grupo Vocento": { domain: "###_es_grupo_vocento", group: [ + "abc.es", "diariosur.es", "diariovasco.com", "elcomercio.es", @@ -734,7 +729,7 @@ var defaultSites = { "lavozdigital.es" ], allow_cookies: 1, - block_regex: /cdn\.ampproject\.org\/v\d\/amp-(access|subscriptions)-.+\.js/ + block_regex: /(\.evolok\.net\/|cdn\.ampproject\.org\/v\d\/amp-access-.+\.js)/ }, "Gruppo GEDI.it": { domain: "###_it_gedi", @@ -1743,7 +1738,7 @@ var defaultSites = { allow_cookies: 1, block_regex: /\.irishtimes\.com\/zephr\/features/ }, - "The Japan Times": { + "The Japan Times (recent/last 2 months articles only)": { domain: "japantimes.co.jp", block_regex: /cdn\.cxense\.com\//, remove_cookies_select_drop: ["xbc"] @@ -1991,7 +1986,7 @@ var defaultSites = { group_rule_domains: ["brisbanetimes.com.au", "smh.com.au", "theage.com.au", "watoday.com.au"], block_regex: /cdn\.ampproject\.org\/v\d\/amp-subscriptions-.+\.js/ }, - "* Block Paywall-scripts (opt-in to custom sites to enable also for non-listed sites)": { + "* Block Paywall-scripts (opt-in to custom sites to enable also for unlisted sites)": { domain: "###" }, "Amp-access": {