From 27b3d9b9860f106e5d6dc91a36dab32aaee94b1e Mon Sep 17 00:00:00 2001 From: magnolia1234 <7676006-magnolia1234@users.noreply.gitlab.com> Date: Thu, 13 Jan 2022 21:03:56 +0100 Subject: [PATCH] Fix McClatchy Group (amp-redirect & disable) --- background.js | 4 ++-- changelog.txt | 9 +++++---- contentScript.js | 2 +- manifest.json | 2 +- sites.js | 2 +- 5 files changed, 10 insertions(+), 9 deletions(-) diff --git a/background.js b/background.js index dde3901d..9c5b2a16 100644 --- a/background.js +++ b/background.js @@ -751,8 +751,8 @@ ext_api.webRequest.onBeforeSendHeaders.addListener(function(details) { // block script for additional McClatchy sites (opt-in to custom sites) var usa_mcc_domains = grouped_sites['###_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)) && + 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|amp)\./, ''); diff --git a/changelog.txt b/changelog.txt index cabb7bb7..bb23d4eb 100644 --- a/changelog.txt +++ b/changelog.txt @@ -5,6 +5,7 @@ Post-release Add Mainichi Shimbun (Japan) Remove De Tijd & L'Echo Fix Bloomberg (quotes) +Fix McClatchy Group (amp-redirect & disable) Fix Prospect Magazine (timing) Fix Star Tribune (timing) Update popup (domain to clear cookies) @@ -225,7 +226,7 @@ Fix The Daily Beast (proper/images) * v2.3.3.0 (2021-08-15) Add Live Law (India) Add Sanoma Media Finland (+ aamulehti.fi & regional/opt-in) -Fix group McClatchy (unlisted sites) +Fix McClatchy Group (unlisted sites) Fix MediaNama (modal) Fix The Athletic Fix The Daily Beast (members-only) @@ -272,7 +273,7 @@ Fix WaPo (magazine) Add TradeWinds Fix Discover Magazine Fix Il Secolo XIX (amp-redirect) -Fix Miami Herald (group McClatchy) +Fix Miami Herald (McClatchy Group) Fix New Left Review (timing) Fix WaPo (disable Googlebot & fix amp/interactive) Maintenance contentScript (update sanitize html-input) @@ -406,7 +407,7 @@ Add Aachener-Zeitung.de (RP-medien) Add Apollo Magazine Add NK News (not pro) Add Nordwest Zeitung (Germany) -Fix group McClatchy (opt-in to custom sites for unlisted) +Fix McClatchy Group (opt-in to custom sites for unlisted) Fix Wired (Googlebot) Fix WSJ (option to disable Googlebot; http error 500) @@ -466,7 +467,7 @@ Update limit contentScript (add image/sub_frame) * v2.0.8.0 (2021-02-14) Add Augsburger-Allgemeine.de -Add group McClatchy (USA) +Add McClatchy Group (USA) Add Neue Osnabruecker Zeitung (Germany) Add Time Magazine Fix Cors Anywhere (link to allow access) diff --git a/contentScript.js b/contentScript.js index 9df81703..e6ccf9aa 100644 --- a/contentScript.js +++ b/contentScript.js @@ -3290,7 +3290,7 @@ else if ((domain = matchDomain(usa_mcc_domains)) || document.querySelector('scri let url = window.location.href; if (url.includes('account.' + domain + '/paywall/')) { window.setTimeout(function () { - window.location.href = 'https://amp.' + domain + '/article' + url.split('resume=')[1].split('#')[0] + '.html'; + window.location.href = 'https://amp.' + domain + '/article' + url.split('resume=')[1].split(/[#&]/)[0] + '.html'; }, 500); // Delay (in milliseconds) } else if (url.includes('amp.' + domain + '/')) { amp_unhide_subscr_section(); diff --git a/manifest.json b/manifest.json index d0000f0e..aaa6ad4a 100644 --- a/manifest.json +++ b/manifest.json @@ -605,5 +605,5 @@ "*://*.wsj.net/*", "*://*.zephr.com/*" ], - "version": "2.5.1.3" + "version": "2.5.1.4" } diff --git a/sites.js b/sites.js index 111341c5..26f2760f 100644 --- a/sites.js +++ b/sites.js @@ -1014,7 +1014,7 @@ var defaultSites = { "thestate.com", "tri-cityherald.com" ], - block_regex: /(js\.matheranalytics\.com\/|cdn\.ampproject\.org\/v\d\/amp-subscriptions-.+\.js)/ + block_regex: /(js\.matheranalytics\.com\/|cdn\.ampproject\.org\/v\d\/amp-(access|(sticky-)?ad|subscriptions)-.+\.js)/ }, "Mediahuis Nederland Regional": { domain: "###_nl_mediahuis_region",