From 73157353723c4cfb2cb6d725597ac9bb6fd377ba Mon Sep 17 00:00:00 2001 From: magnolia1234 <7676006-magnolia1234@users.noreply.gitlab.com> Date: Mon, 10 May 2021 18:12:59 +0200 Subject: [PATCH] Fix-update South China Morning Post (amp) --- background.js | 4 ++-- changelog.txt | 1 + contentScript.js | 9 +++++++++ manifest.json | 2 +- 4 files changed, 13 insertions(+), 3 deletions(-) diff --git a/background.js b/background.js index b0110993..59ad834d 100644 --- a/background.js +++ b/background.js @@ -372,7 +372,7 @@ var blockedRegexes = { 'thesaturdaypaper.com.au': /\.thesaturdaypaper\.com\.au\/sites\/all\/modules\/custom\/node_meter\/pw\.js/, 'science-et-vie.com': /\.qiota\.com\//, 'sciencesetavenir.fr': /\.poool\.fr\//, - 'scmp.com': /\.tinypass\.com\//, + 'scmp.com': /(\.tinypass\.com\/|cdn\.ampproject\.org\/v\d\/amp-(access|ad|analytics|consent|fx-flying-carpet)-.+\.js)/, 'seekingalpha.com': /(\.tinypass\.com\/|cdn\.ampproject\.org(\/.+)?\/v\d\/amp-(access|ad|loader)-.+\.js)/, 'sfchronicle.com': /\.blueconic\.net\//, 'shz.de': /cdn\.ampproject\.org\/v\d\/amp-(access|(sticky-)?ad|fx-flying-carpet)-.+\.js/, @@ -1034,7 +1034,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', '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', '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)); } if (!isSiteEnabled(details) && !allow_ext_source && !bpc_amp_site && !au_apn_site && !au_swm_site) { diff --git a/changelog.txt b/changelog.txt index 87489ad5..f2816249 100644 --- a/changelog.txt +++ b/changelog.txt @@ -2,6 +2,7 @@ Changelog Bypass Paywalls Clean - Firefox Post-release +Fix-update South China Morning Post (amp) * v2.2.0.0 (2021-05-09) Add Asia Times diff --git a/contentScript.js b/contentScript.js index bab41c38..a13e9daa 100644 --- a/contentScript.js +++ b/contentScript.js @@ -2096,6 +2096,15 @@ else if (matchDomain('republic.ru')) { removeDOMElement(paywall); } +else if (matchDomain('scmp.com') && window.location.href.includes('/amp.')) { + let div_hidden_all = document.querySelectorAll('div.article-body[amp-access][amp-access-hide]'); + for (let div_hidden of div_hidden_all) + div_hidden.removeAttribute('amp-access-hide'); + let default_meters = document.querySelectorAll('div.default-meter, div#archive-article-meter'); + let adverts = document.querySelectorAll('amp-ad, div.ad-banner, div.advert-fly-carpet-container, div.inline-advert'); + removeDOMElement(...default_meters, ...adverts); +} + else if (matchDomain('scribd.com')) { let blurred_pages = document.querySelectorAll('.blurred_page'); for (let blurred_page of blurred_pages) { diff --git a/manifest.json b/manifest.json index 33aec97a..0188bc0b 100644 --- a/manifest.json +++ b/manifest.json @@ -512,5 +512,5 @@ "*://*.wallkit.net/*", "*://*.wsj.net/*" ], - "version": "2.2.0.0" + "version": "2.2.0.1" } \ No newline at end of file