Fix The Economic Times (update mobile redirect)

This commit is contained in:
magnolia1234 2023-08-02 16:37:50 +02:00
parent 309ad7079a
commit cf33bbd6ac
4 changed files with 13 additions and 7 deletions

View file

@ -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');

View file

@ -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)

View file

@ -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('<div style="margin: 20px 0px;">' + DOMPurify.sanitize(content.innerText, {ADD_TAGS: ['iframe'], ADD_ATTR: ['frameborder']}) + '</div>', 'text/html');
let content_new = doc.querySelector('div');
if (content_new && content.parentNode)
content.parentNode.replaceChild(content_new, content);
} else
window.location.href = 'https://economictimes.indiatimes.com' + window.location.pathname.replace('amp_prime', 'prime');
let intro = document.querySelector('.art_wrap');
let article_blocker = document.querySelector('.articleBlocker');

View file

@ -2046,7 +2046,8 @@ var defaultSites = {
"economictimes.indiatimes.com"
],
allow_cookies: 1,
useragent: "googlebot"
useragent: "googlebot",
cs_dompurify: 1
},
"The Economist": {
domain: "economist.com",