Fix Tech in Asia (css)

This commit is contained in:
magnolia1234 2023-11-19 17:18:30 +01:00
parent e7a54f600e
commit 0769f82795
4 changed files with 31 additions and 24 deletions

View File

@ -12,6 +12,7 @@ Add Welt.de (link to archive.is)
Remove EurekaReport.com.au (domain obsolete) Remove EurekaReport.com.au (domain obsolete)
Fix FreiePresse.de Fix FreiePresse.de
Fix South China Morning Post (css) Fix South China Morning Post (css)
Fix Tech in Asia (css)
* v3.4.2.0 (2023-11-12) * v3.4.2.0 (2023-11-12)
Add Haymarket Media Group (opt-in to custom sites) Add Haymarket Media Group (opt-in to custom sites)

View File

@ -4783,31 +4783,37 @@ else if (matchDomain('swarajyamag.com')) {
} }
else if (matchDomain('techinasia.com')) { else if (matchDomain('techinasia.com')) {
let paywall = document.querySelector('.paywall-content'); window.setTimeout(function () {
if (paywall && dompurify_loaded) { let paywall = document.querySelector('div.paywall-content');
paywall.classList.remove('paywall-content'); if (paywall && dompurify_loaded) {
let url = window.location.href; paywall.classList.remove('paywall-content');
let url_xhr = url.replace('.com/', '.com/wp-json/techinasia/2.0/posts/').replace('/visual-story/', '/'); let par_missing = paywall.querySelectorAll('div[id^="attachment_"], a.flourish-credit');
fetch(url_xhr) let attach_xhr = Array.from(par_missing).some(x => !x.hasChildNodes());
.then(response => { if (attach_xhr) {
if (response.ok) { let url = window.location.href;
response.json().then(json => { let url_xhr = url.replace('.com/', '.com/wp-json/techinasia/2.0/posts/').replace('/visual-story/', '/');
let json_text = json.posts[0].content; fetch(url_xhr)
json_text = json_text.replace(/width\=\"(\d){3,}\"/g, 'width="100%"').replace(/height\=\"(\d){3,}\"/g, 'height="100%"'); .then(response => {
let content = document.querySelector('div.content'); if (response.ok) {
if (json_text && content) { response.json().then(json => {
let parser = new DOMParser(); let json_text = json.posts[0].content;
let doc = parser.parseFromString('<div class="jsx-1794864983 content">' + DOMPurify.sanitize(json_text) + '</div>', 'text/html'); json_text = json_text.replace(/width\=\"(\d){3,}\"/g, 'width="100%"').replace(/height\=\"(\d){3,}\"/g, 'height="100%"');
let content_new = doc.querySelector('div.content'); let content = document.querySelector('div.content');
content.parentNode.replaceChild(content_new, content); if (json_text && content) {
let parser = new DOMParser();
let doc = parser.parseFromString('<div class="jsx-1794864983 content">' + DOMPurify.sanitize(json_text) + '</div>', 'text/html');
let content_new = doc.querySelector('div.content');
content.parentNode.replaceChild(content_new, content);
}
});
} }
}); });
} }
}); }
} let splash_subscribe = document.querySelector('div.splash-subscribe');
let splash_subscribe = document.querySelector('.splash-subscribe'); let paywall_hard = document.querySelector('div.paywall-hard');
let paywall_hard = document.querySelector('.paywall-hard'); removeDOMElement(splash_subscribe, paywall_hard);
removeDOMElement(splash_subscribe, paywall_hard); }, 3000);
} }
else if (matchDomain(['techtarget.com', 'computerweekly.com', 'lemagit.fr'])) { else if (matchDomain(['techtarget.com', 'computerweekly.com', 'lemagit.fr'])) {

View File

@ -51,5 +51,5 @@
"webRequestBlocking", "webRequestBlocking",
"*://*/*" "*://*/*"
], ],
"version": "3.4.2.8" "version": "3.4.2.9"
} }

View File

@ -815,5 +815,5 @@
"*://*.wyleex.com/*", "*://*.wyleex.com/*",
"*://webcache.googleusercontent.com/*" "*://webcache.googleusercontent.com/*"
], ],
"version": "3.4.2.8" "version": "3.4.2.9"
} }