Fix Times of India (amp)

This commit is contained in:
magnolia1234 2021-12-21 17:38:17 +01:00
parent 36aba5ee93
commit 018629c8da
3 changed files with 25 additions and 1 deletions

View file

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

View file

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

View file

@ -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('<div>' + DOMPurify.sanitize(paywall.innerHTML, {ADD_TAGS: ['amp-img']}) + '</div>', 'text/html');
let article = doc.querySelector('div');
preview.parentNode.replaceChild(article, preview);
preview.classList.remove('prime-bottom-blur');
}
}
let amp_images = document.querySelectorAll('div.inline-imgecontent > amp-img');
for (let amp_img of amp_images) {
let img_new = document.createElement('img');
img_new.src = amp_img.getAttribute('src');
amp_img.parentNode.replaceChild(img_new, amp_img);
img_new.parentElement.classList.remove('inline-imgecontent');
img_new.parentElement.style = 'text-align: center;';
}
}
}
else if (matchDomain(no_nhst_media_domains)) {