From 4b1b7cefb57839abb2971d252d875f048998cb24 Mon Sep 17 00:00:00 2001 From: magnolia1234 <7676006-magnolia1234@users.noreply.gitlab.com> Date: Tue, 15 Jun 2021 21:24:05 +0200 Subject: [PATCH] Fix-update The Spectator UK (amp) --- changelog.txt | 3 ++- contentScript.js | 18 +++++++++++------- manifest.json | 2 +- 3 files changed, 14 insertions(+), 9 deletions(-) diff --git a/changelog.txt b/changelog.txt index 4f55c67..8ee1fe2 100644 --- a/changelog.txt +++ b/changelog.txt @@ -3,12 +3,13 @@ Changelog Bypass Paywalls Clean - Firefox Post-release Fix-update Boston Globe (no opt-in) +Fix-update The Spectator UK (amp) * v2.2.5.0 (2021-06-13) Add The Wrap Fix-update Atlantico.fr Fix-update Folha de S. Paulo (add blogs) -Fix-update La Stampa +Fix-update La Stampa (amp) Fix-update Los Angeles Times (overlay) Fix-update Medium/Towards Data Science (multimedia) Fix-update TheTimes.co.uk (link to archive.is) diff --git a/contentScript.js b/contentScript.js index 3465d94..404a6fa 100644 --- a/contentScript.js +++ b/contentScript.js @@ -1398,13 +1398,17 @@ else if (matchDomain('prospectmagazine.co.uk')) { } else if (matchDomain('spectator.co.uk')) { - let premium = document.querySelector('.HardPayWallContainer-module__overlay'); - removeDOMElement(premium); - window.setTimeout(function () { - if (premium && window.location.href.includes('/www.spectator.co.uk/')) { - window.location.href = window.location.href + '/amp'; - } - }, 500); // Delay (in milliseconds) + let url = window.location.href.split('?')[0]; + if (url.match(/\/amp(\/)?$/)) { + let paywall = document.querySelectorAll('div[amp-access^="p.show"'); + let not_logged_in = document.querySelector('div[amp-access*="NOT loggedIn"]'); + removeDOMElement(...paywall, not_logged_in) + } else { + let premium = document.querySelector('.HardPayWallContainer-module__overlay'); + removeDOMElement(premium); + if (premium) + window.location.href = url + '/amp'; + } } else if (matchDomain('telegraph.co.uk')) { diff --git a/manifest.json b/manifest.json index b8b443f..7fb4b0f 100644 --- a/manifest.json +++ b/manifest.json @@ -526,5 +526,5 @@ "*://*.wallkit.net/*", "*://*.wsj.net/*" ], - "version": "2.2.5.1" + "version": "2.2.5.2" } \ No newline at end of file