From 018629c8da1f7c610bc46999bf95bda35910764b Mon Sep 17 00:00:00 2001 From: magnolia1234 <7676006-magnolia1234@users.noreply.gitlab.com> Date: Tue, 21 Dec 2021 17:38:17 +0100 Subject: [PATCH] Fix Times of India (amp) --- background.js | 2 +- changelog.txt | 1 + contentScript.js | 23 +++++++++++++++++++++++ 3 files changed, 25 insertions(+), 1 deletion(-) diff --git a/background.js b/background.js index 03e2d34..b6e770b 100644 --- a/background.js +++ b/background.js @@ -950,7 +950,7 @@ if (matchUrlDomain(change_headers, details.url) && !['font', 'image', 'styleshee } if ((!['font', 'stylesheet'].includes(details.type) || matchUrlDomain(cs_limit_except, currentTabUrl)) && !csDone) { let lib_file = 'lib/empty.js'; - if (matchUrlDomain(['bloomberg.com', 'cicero.de', 'economictimes.com', 'lesechos.fr', 'marianne.net', 'newleftreview.org', 'newyorker.com', 'nzherald.co.nz', 'prospectmagazine.co.uk', 'stratfor.com', 'sudouest.fr', 'techinasia.com', 'valor.globo.com', 'vn.nl'].concat(nl_mediahuis_region_domains, no_nhst_media_domains, usa_theathletic_domains), currentTabUrl)) + if (matchUrlDomain(['bloomberg.com', 'cicero.de', 'economictimes.com', 'lesechos.fr', 'marianne.net', 'newleftreview.org', 'newyorker.com', 'nzherald.co.nz', 'prospectmagazine.co.uk', 'stratfor.com', 'sudouest.fr', 'techinasia.com', 'timesofindia.com', 'valor.globo.com', 'vn.nl'].concat(nl_mediahuis_region_domains, no_nhst_media_domains, usa_theathletic_domains), currentTabUrl)) lib_file = 'lib/purify.min.js'; var bg2csData = { optin_setcookie: optin_setcookie, diff --git a/changelog.txt b/changelog.txt index c859b51..4935c7d 100644 --- a/changelog.txt +++ b/changelog.txt @@ -2,6 +2,7 @@ Changelog Bypass Paywalls Clean - Firefox Post-release +Fix Times of India (amp) Update custom sites (random ip) * v2.4.8.0 (2021-12-19) diff --git a/contentScript.js b/contentScript.js index 870d8b8..aeb88a7 100644 --- a/contentScript.js +++ b/contentScript.js @@ -2905,6 +2905,29 @@ else if (matchDomain(timesofindia_domains)) { if (overflow) overflow.removeAttribute('style'); } + if (window.location.pathname.includes('/amp_')) { + let paywall = document.querySelector('div.paywall'); + if (paywall && dompurify_loaded) { + let contentblocker = document.querySelector('div#contentblocker'); + removeDOMElement(contentblocker); + let preview = document.querySelector('div.article-txt'); + if (preview) { + let parser = new DOMParser(); + let doc = parser.parseFromString('