From 6d9d642dfeea836c8cfeba258cc3cdaf65c513dd Mon Sep 17 00:00:00 2001 From: magnolia1234 <7676006-magnolia1234@users.noreply.gitlab.com> Date: Wed, 19 May 2021 17:11:21 +0200 Subject: [PATCH] Fix-update Prensa Iberica --- background.js | 10 ++++------ changelog.txt | 1 + contentScript.js | 46 +++++++++++++++------------------------------- manifest.json | 2 +- 4 files changed, 21 insertions(+), 38 deletions(-) diff --git a/background.js b/background.js index 31355c1..c88b89e 100644 --- a/background.js +++ b/background.js @@ -102,7 +102,6 @@ var allow_cookies_default = [ 'lesechos.fr', 'letelegramme.fr', 'lexpress.fr', - 'lne.es', 'loeildelaphotographie.com', 'lrb.co.uk', 'marketwatch.com', @@ -344,7 +343,6 @@ var blockedRegexes = { 'letelegramme.fr': /\.poool\.fr\//, 'lexpress.fr': /\.poool\.fr\//, 'livemint.com': /(\.livemint\.com\/js\/localWorker\.js|analytics\.htmedia\.in\/analytics-js\/.+\.js)/, - 'lne.es': /cdn\.ampproject\.org\/v\d\/amp-(access|consent)-.+\.js/, 'loeildelaphotographie.com': /cdn\.loeildelaphotographie\.com\/wp-content\/.+\/hague-child\/js\/script-.+\.js/, 'lopinion.fr': /\.poool\.fr\//, 'lrb.co.uk': /\.tinypass\.com\//, @@ -408,7 +406,7 @@ var blockedRegexes = { // grouped domains (rules only) const au_nine_domains = ['brisbanetimes.com.au', 'smh.com.au', 'theage.com.au', 'watoday.com.au']; -const es_epiberica_domains = ['diariodeibiza.es', 'diariodemallorca.es', 'farodevigo.es', 'laprovincia.es', 'levante-emv.com']; +const es_epiberica_domains = ['diariodeibiza.es', 'diariodemallorca.es', 'farodevigo.es', 'laprovincia.es', 'levante-emv.com', 'lne.es']; const it_repubblica_domains = ['gelocal.it', 'ilsecoloxix.it', 'lanuovasardegna.it', 'lastampa.it', 'limesonline.com', 'repubblica.it'].concat(['lescienze.it']); const nl_pg_domains = ['parool.nl', 'trouw.nl', 'volkskrant.nl', 'humo.be', 'demorgen.be']; const usa_genomeweb_domains = ['genomeweb.com', '360dx.com', 'precisiononcologynews.com']; @@ -550,11 +548,11 @@ function add_grouped_sites(init_rules) { blockedRegexes[domain] = /cdn\.ampproject\.org\/v\d\/amp-subscriptions-.+\.js/; for (let domain of es_epiberica_domains) { allow_cookies.push(domain); - blockedRegexes[domain] = /cdn\.ampproject\.org\/v\d\/amp-access-.+\.js/; + blockedRegexes[domain] = /cdn\.ampproject\.org\/v\d\/amp-(access|analytics|consent)-.+\.js/; } for (let domain of it_repubblica_domains) { allow_cookies.push(domain); - blockedRegexes[domain] = /(scripts\.repubblica\.it\/pw\/pw\.js|cdn\.ampproject\.org\/v\d\/amp-(access|ad|user-notification)-.+\.js)/; + blockedRegexes[domain] = /(scripts\.repubblica\.it\/pw\/pw\.js|cdn\.ampproject\.org\/v\d\/amp-(access|ad|user-notification)-.+\.js|\.repstatic\.it\/minify\/sites\/gelocal\/.+\/config\.cache\.php)/; } for (let domain of nl_pg_domains) remove_cookies_select_drop[domain] = ['TID_ID']; @@ -1047,7 +1045,7 @@ ext_api.webRequest.onBeforeSendHeaders.addListener(function(details) { let usa_today_site = (matchUrlDomain('gannett-cdn.com', details.url) && matchUrlDomain(['usatoday.com'], header_referer)); allow_ext_source = allow_ext_source || inkl_site || cl_elmerc_site || es_elesp_site || it_repubblica_site || uk_nlr_site || usa_discmag_site || usa_mw_site || usa_today_site; - bpc_amp_site = (matchUrlDomain('cdn.ampproject.org', details.url) && matchUrlDomain(['asiatimes.com', 'augsburger-allgemeine.de', 'barrons.com', 'belfasttelegraph.co.uk', 'cicero.de', 'cmjornal.pt', 'elmundo.es', 'elpais.com', 'elperiodico.com', 'expansion.com', 'freiepresse.de', 'independent.ie', 'irishtimes.com', 'la-croix.com', 'lne.es', 'marketwatch.com', 'nationalreview.com', 'noz.de', 'nwzonline.de', 'scmp.com', 'seekingalpha.com', 'shz.de', 'sueddeutsche.de', 'svz.de', 'telegraph.co.uk'].concat(au_news_corp_domains, au_nine_domains, de_madsack_domains, es_epiberica_domains, es_grupo_vocento_domains, fr_groupe_ebra_domains, fr_groupe_la_depeche_domains, it_repubblica_domains, usa_mcc_domains, usa_theathletic_domains), header_referer)); + bpc_amp_site = (matchUrlDomain('cdn.ampproject.org', details.url) && matchUrlDomain(['asiatimes.com', 'augsburger-allgemeine.de', 'barrons.com', 'belfasttelegraph.co.uk', 'cicero.de', 'cmjornal.pt', 'elmundo.es', 'elpais.com', 'elperiodico.com', 'expansion.com', 'freiepresse.de', 'independent.ie', 'irishtimes.com', 'la-croix.com', 'marketwatch.com', 'nationalreview.com', 'noz.de', 'nwzonline.de', 'scmp.com', 'seekingalpha.com', 'shz.de', 'sueddeutsche.de', 'svz.de', 'telegraph.co.uk'].concat(au_news_corp_domains, au_nine_domains, de_madsack_domains, es_epiberica_domains, es_grupo_vocento_domains, fr_groupe_ebra_domains, fr_groupe_la_depeche_domains, it_repubblica_domains, usa_mcc_domains, usa_theathletic_domains), header_referer)); } if (!isSiteEnabled(details) && !allow_ext_source && !bpc_amp_site && !au_apn_site && !au_swm_site) { diff --git a/changelog.txt b/changelog.txt index cc9fb7a..f7879a6 100644 --- a/changelog.txt +++ b/changelog.txt @@ -3,6 +3,7 @@ Changelog Bypass Paywalls Clean - Firefox Post-release Add MediaNama (India) +Fix-update Prensa Iberica * v2.2.1.0 (2021-05-16) Add Las Provincias (Spain) diff --git a/contentScript.js b/contentScript.js index 35795f4..3b3cdeb 100644 --- a/contentScript.js +++ b/contentScript.js @@ -6,7 +6,7 @@ var csDone = false; var ca_torstar_domains = ['niagarafallsreview.ca', 'stcatharinesstandard.ca', 'thepeterboroughexaminer.com', 'therecord.com', 'thespec.com', 'thestar.com', 'wellandtribune.ca']; var de_funke_media_domains = ['abendblatt.de', 'braunschweiger-zeitung.de', 'morgenpost.de', 'nrz.de', 'otz.de', 'thueringer-allgemeine.de', 'tlz.de', 'waz.de', 'wp.de', 'wr.de']; var de_madsack_domains = ['haz.de', 'kn-online.de', 'ln-online.de', 'lvz.de', 'maz-online.de', 'neuepresse.de', 'ostsee-zeitung.de']; -var es_epiberica_domains = ['diariodeibiza.es', 'diariodemallorca.es', 'farodevigo.es', 'laprovincia.es', 'levante-emv.com']; +var es_epiberica_domains = ['diariodeibiza.es', 'diariodemallorca.es', 'farodevigo.es', 'laprovincia.es', 'levante-emv.com', 'lne.es']; 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 fr_groupe_ebra_domains = ['bienpublic.com', 'dna.fr', 'estrepublicain.fr', 'lalsace.fr', 'ledauphine.com', 'lejsl.com', 'leprogres.fr', 'republicain-lorrain.fr', 'vosgesmatin.fr']; var fr_groupe_la_depeche_domains = ['centrepresseaveyron.fr', 'ladepeche.fr', 'lindependant.fr', 'midi-olympique.fr', 'midilibre.fr', 'nrpyrenees.fr', 'petitbleu.fr']; @@ -688,21 +688,23 @@ else if (matchDomain(es_grupo_vocento_domains)) { } else if (matchDomain(es_epiberica_domains)) { + let truncated = document.querySelector('div.article-body--truncated'); + if (truncated) + truncated.classList.remove('article-body--truncated'); + window.setTimeout(function () { + let paywall = document.querySelector('div.paywall'); + removeDOMElement(paywall); + }, 500); // Delay (in milliseconds) if (window.location.href.includes('.amp.html')) { - let div_hidden = document.querySelectorAll('div[amp-access="access"]'); + let div_access = document.querySelector('div[amp-access="access"]'); + removeDOMElement(div_access); + let div_hidden = document.querySelectorAll('div[amp-access="NOT access"][amp-access-hide], div[amp-access="FALSE"][amp-access-hide]'); for (let elem of div_hidden) elem.removeAttribute('amp-access-hide'); } else { - let truncated = document.querySelector('div.article-body--truncated'); - if (truncated) - truncated.classList.remove('article-body--truncated'); let div_hidden = document.querySelector('div.baldomero'); if (div_hidden) div_hidden.classList.remove('baldomero'); - window.setTimeout(function () { - let paywall = document.querySelector('div.paywall'); - removeDOMElement(paywall); - }, 500); // Delay (in milliseconds) } } @@ -712,23 +714,6 @@ else if (matchDomain('lavanguardia.com')) { removeDOMElement(paywall, infinite_loading); } -else if (matchDomain('lne.es')) { - let premium = document.querySelector('body.premium'); - let url = window.location.href; - if (!url.includes('.amp.html')) { - if (premium) { - window.location.href = url.replace('.html', '.amp.html'); - premium.classList.remove('premium'); - } - } else { - let section_hidden = document.querySelectorAll('div[amp-access="access"]'); - for (let elem of section_hidden) - elem.removeAttribute('amp-access-hide'); - let not_subscriber = document.querySelector('div[amp-access="NOT access"]'); - removeDOMElement(not_subscriber); - } -} - else if (matchDomain('observador.pt')) { let paywall = document.querySelector('.premium-article'); if (paywall) @@ -1071,7 +1056,7 @@ else if (domain = matchDomain(it_repubblica_domains)) { if (['lastampa.it', 'repubblica.it'].includes(domain)) { let amphtml = document.querySelector('link[rel="amphtml"]'); if (!amphtml) - amphtml = {href: url.split('?')[0] + 'amp'}; + amphtml = {href: (url.split('?')[0] + '/amp').replace('//amp', '/amp')}; if (amphtml) window.location.href = amphtml.href; } else { @@ -1480,12 +1465,11 @@ else if (matchDomain(['theathletic.com', 'theathletic.co.uk'])) { } } - else if (matchDomain('thetimes.co.uk')) { let block = document.querySelector('.subscription-block'); - let ad_block = document.getElementById('ad-article-inline') - let ad_header = document.getElementById('sticky-ad-header') - removeDOMElement(block, ad_block, ad_header); + let ad_block = document.getElementById('ad-article-inline'); + let ad_header = document.getElementById('sticky-ad-header'); + removeDOMElement(block, ad_block, ad_header); } else if (!matchDomain(['belfasttelegraph.co.uk', 'independent.ie'])) diff --git a/manifest.json b/manifest.json index 11e9f77..96e9421 100644 --- a/manifest.json +++ b/manifest.json @@ -516,5 +516,5 @@ "*://*.wallkit.net/*", "*://*.wsj.net/*" ], - "version": "2.2.1.1" + "version": "2.2.1.2" } \ No newline at end of file