From 15543ae001fb0d5654199c256b1657ed99d1bea0 Mon Sep 17 00:00:00 2001 From: magnolia1234 <7676006-magnolia1234@users.noreply.gitlab.com> Date: Tue, 10 Aug 2021 19:11:51 +0200 Subject: [PATCH] Fix group McClatchy (unlisted sites) --- background.js | 10 ++++++---- changelog.txt | 1 + contentScript.js | 3 +-- manifest.json | 5 ++++- 4 files changed, 12 insertions(+), 7 deletions(-) diff --git a/background.js b/background.js index 22ed243..ebfc82d 100644 --- a/background.js +++ b/background.js @@ -976,7 +976,7 @@ ext_api.webRequest.onHeadersReceived.addListener(function (details) { }, ['blocking', 'responseHeaders']); -var block_js_default = ["*://cdn.tinypass.com/*", "*://*.piano.io/*", "*://*.poool.fr/*", "*://cdn.ampproject.org/v*/amp-access-*.js", "*://*.blueconic.net/*", "*://*.cxense.com/*", "*://*.evolok.net/*", "*://js.matheranalytics.com/*", "*://*.newsmemory.com/*", "*://*.onecount.net/*", "*://js.pelcro.com/*", "*://*.qiota.com/*", "*://*.tribdss.com/*"]; +var block_js_default = ["*://cdn.tinypass.com/*", "*://*.piano.io/*", "*://*.poool.fr/*", "*://cdn.ampproject.org/v*/amp-access-*.js", "*://cdn.ampproject.org/v*/amp-subscriptions-*.js", "*://*.blueconic.net/*", "*://*.cxense.com/*", "*://*.evolok.net/*", "*://js.matheranalytics.com/*", "*://*.newsmemory.com/*", "*://*.onecount.net/*", "*://js.pelcro.com/*", "*://*.qiota.com/*", "*://*.tribdss.com/*"]; var block_js_custom = []; var block_js_custom_ext = []; var block_js = block_js_default.concat(block_js_custom); @@ -1062,11 +1062,13 @@ ext_api.webRequest.onBeforeSendHeaders.addListener(function(details) { } // block script for additional McClatchy sites (opt-in to custom sites) - var usa_mcc_domain = (matchUrlDomain('mcclatchyinteractive.com', details.url) && ['script'].includes(details.type) && !matchUrlDomain(usa_mcc_domains, header_referer) && enabledSites.includes('###_usa_mcc')); + var usa_mcc_domain = ((matchUrlDomain('mcclatchyinteractive.com', details.url) && ['script'].includes(details.type)) || + (matchUrlDomain('mcclatchy-wires.com', details.url) && ['image'].includes(details.type)) && + !matchUrlDomain(usa_mcc_domains, header_referer) && enabledSites.includes('###_usa_mcc')); if (usa_mcc_domain) { - let mcc_domain = urlHost(header_referer).replace('account.', ''); + let mcc_domain = urlHost(header_referer).replace(/^(account|amp)\./, ''); if (!usa_mcc_domains.includes(mcc_domain)) { - blockedRegexes[domain] = /(js\.matheranalytics\.com\/|cdn\.ampproject\.org\/v\d\/amp-subscriptions-.+\.js)/; + blockedRegexes[mcc_domain] = /(js\.matheranalytics\.com\/|cdn\.ampproject\.org\/v\d\/amp-subscriptions-.+\.js)/; usa_mcc_domains.push(mcc_domain); if (!enabledSites.includes(mcc_domain)) enabledSites.push(mcc_domain); diff --git a/changelog.txt b/changelog.txt index 0b9f980..c364f90 100644 --- a/changelog.txt +++ b/changelog.txt @@ -2,6 +2,7 @@ Changelog Bypass Paywalls Clean - Firefox Post-release +Fix group McClatchy (unlisted sites) Fix MediaNama (modal) * v2.3.2.0 (2021-08-08) diff --git a/contentScript.js b/contentScript.js index 986f0b0..14d1020 100644 --- a/contentScript.js +++ b/contentScript.js @@ -2754,7 +2754,7 @@ else if (matchDomain('wsj.com') && !matchDomain('cn.wsj.com')) { } } -else if ((domain = matchDomain(usa_mcc_domains)) || document.querySelector('script[src^="https://media.mcclatchyinteractive.com/"]') || window.location.href.match(/\/\/amp\..+\.com\/(.+\/)?article(\d){8,}\.html/)) { +else if ((domain = matchDomain(usa_mcc_domains)) || document.querySelector('script[src^="https://media.mcclatchyinteractive.com/"]') || (window.location.href.match(/\/\/amp\..+\.com\/(.+\/)?article(\d){8,}\.html/) && document.querySelector('a[href^="https://classifieds.mcclatchy.com/"]'))) { if (!domain) domain = document.domain.replace(/(account|amp)\./, ''); let url = window.location.href; @@ -2855,7 +2855,6 @@ function matchDomain(domains, hostname) { return matched_domain; } -// add domains to manifest (content_scripts - matches) function replaceDomElementExt(url, proxy, base64, selector, text_fail = '') { let proxyurl = proxy ? 'https://bpc2-cors-anywhere.herokuapp.com/' : ''; fetch(proxyurl + url, {headers: {"Content-Type": "text/plain", "X-Requested-With": "XMLHttpRequest"} }) diff --git a/manifest.json b/manifest.json index ce2ac8e..7c8571a 100644 --- a/manifest.json +++ b/manifest.json @@ -533,14 +533,17 @@ "*://*.jsdelivr.net/*", "*://*.lightboxcdn.com/*", "*://*.loader-cdn.azureedge.net/*", + "*://*.mcclatchy-wires.com/*", + "*://*.mcclatchyinteractive.com/*", "*://*.natgeofe.com/*", "*://*.nyt.com/*", "*://*.pasedigital.cl/*", "*://*.rcsobjects.it/*", "*://*.repstatic.it/*", + "*://*.rndtech.de/*", "*://*.userzoom.com/*", "*://*.wallkit.net/*", "*://*.wsj.net/*" ], - "version": "2.3.2.1" + "version": "2.3.2.2" } \ No newline at end of file