Fix New Scientist (text-break)

This commit is contained in:
magnolia1234 2023-09-29 08:04:57 +02:00
parent 2d389456a8
commit 22c03a5ee3
4 changed files with 15 additions and 2 deletions

View file

@ -8,6 +8,7 @@ Add Salzburger Nachrichten
Add The Columbian
Fix Mediahuis Noord (json)
Fix Mexico News Daily
Fix New Scientist (text-break)
Update custom sites (import - remove obsolete)
* v3.3.5.0 (2023-09-24)

View file

@ -4385,6 +4385,18 @@ else if (matchDomain('newscientist.com')) {
let lazy_images = document.querySelectorAll('img.lazyload[data-src]:not([src])');
for (let elem of lazy_images)
elem.src = elem.getAttribute('data-src').split('?')[0] + '?width=800';
let break_pre_array = pageContains('div.non-paywall > p', /…\s?$/);
if (break_pre_array.length) {
let break_pre = break_pre_array[0];
let break_post = document.querySelector('div.paywall > p');
if (break_post) {
let parser = new DOMParser();
let doc = parser.parseFromString('<p>' + DOMPurify.sanitize(break_pre.innerHTML.replace(/\s…\s?/, ' ') + break_post.innerHTML) + '</p>', 'text/html');
let content_new = doc.querySelector('p');
break_pre.parentNode.replaceChild(content_new, break_pre);
removeDOMElement(break_post);
}
}
let ads = document.querySelectorAll('div[class*="Advert"]');
hideDOMElement(...ads);
}, 1000);

View file

@ -51,5 +51,5 @@
"webRequestBlocking",
"*://*/*"
],
"version": "3.3.5.5"
"version": "3.3.5.6"
}

View file

@ -796,5 +796,5 @@
"*://*.wyleex.com/*",
"*://webcache.googleusercontent.com/*"
],
"version": "3.3.5.5"
"version": "3.3.5.6"
}