From cf33bbd6ac19c1c958229aea0a6307704286b0ce Mon Sep 17 00:00:00 2001 From: magnolia1234 <7676006-magnolia1234@users.noreply.gitlab.com> Date: Wed, 2 Aug 2023 16:37:50 +0200 Subject: [PATCH] Fix The Economic Times (update mobile redirect) --- background.js | 2 +- changelog.txt | 3 ++- contentScript.js | 12 ++++++++---- sites.js | 3 ++- 4 files changed, 13 insertions(+), 7 deletions(-) diff --git a/background.js b/background.js index 26963c6..7428806 100644 --- a/background.js +++ b/background.js @@ -667,7 +667,7 @@ if ((typeof browser !== 'object') && navigator_ua_mobile) { // economictimes redirect ext_api.webRequest.onBeforeRequest.addListener(function (details) { - if (!isSiteEnabled(details) || details.url.includes('.com/epaper/')) { + if (!isSiteEnabled(details) || details.url.includes('.com/epaper/') || !navigator_ua_mobile) { return; } var updatedUrl = details.url.split('?')[0].replace('economictimes.indiatimes.com', 'm.economictimes.com'); diff --git a/changelog.txt b/changelog.txt index bbcc437..c86d46a 100644 --- a/changelog.txt +++ b/changelog.txt @@ -5,6 +5,7 @@ Updates (install signed xpi-file): https://gitlab.com/magnolia1234/bypass-paywal Post-release Add Crikey.com.au Fix Grupo Vocento (limit amp-redirect) +Fix The Economic Times (update mobile redirect) Update custom sites (add_ext_link: Google webcache) * v3.2.7.0 (2023-07-30) @@ -1272,7 +1273,7 @@ Fix National Geographic USA Fix Prensa Iberica Fix Saechsische Zeitung (amp) Fix The Daily Telegraph (au) -Fix The Economic Times (mobile/India) +Fix The Economic Times (mobile) Fix Valor Economico (Google webcache) * v2.2.1.0 (2021-05-16) diff --git a/contentScript.js b/contentScript.js index 6415ae4..e06d819 100644 --- a/contentScript.js +++ b/contentScript.js @@ -3460,11 +3460,15 @@ else if (matchDomain('dn.no')) { else if (matchDomain('economictimes.com')) { if (window.location.pathname.includes('/amp_')) { let paywall = document.querySelector('.paywall_wrap'); - if (paywall) { + if (paywall && dompurify_loaded) { let content = document.querySelector('.paywall[style="display:none;"]'); - if (content) - content.setAttribute('style', 'display:block;'); - else + if (content) { + let parser = new DOMParser(); + let doc = parser.parseFromString('