Fix Tech in Asia (css)

merge-requests/16/head
magnolia1234 7 months ago
parent e7a54f600e
commit 0769f82795

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

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

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

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

Loading…
Cancel
Save