Fix Business-standard.com

This commit is contained in:
magnolia1234 2024-04-12 13:00:42 +02:00
parent 4e672ecef4
commit af6e944887
2 changed files with 8 additions and 4 deletions

View file

@ -5,8 +5,9 @@ Updates (install signed xpi-file): https://gitlab.com/magnolia1234/bypass-paywal
Post-release Post-release
Add OVB Media (opt-in to custom sites for unlisted) Add OVB Media (opt-in to custom sites for unlisted)
Add Private Media AU Add Private Media AU
Fix Business Insider (js)
Fix BizJournals (css) Fix BizJournals (css)
Fix Business Insider (js)
Fix Business-standard.com
Fix The Economist (regwall) Fix The Economist (regwall)
Fix WaPo (js) Fix WaPo (js)
Update custom sites (block_regex_ignore_default) Update custom sites (block_regex_ignore_default)

View file

@ -3963,14 +3963,17 @@ else if (matchDomain('business-standard.com')) {
let json = JSON.parse(json_script.text); let json = JSON.parse(json_script.text);
if (json && json.props.pageProps.data.htmlContent) { if (json && json.props.pageProps.data.htmlContent) {
let json_text = json.props.pageProps.data.htmlContent; let json_text = json.props.pageProps.data.htmlContent;
let content = document.querySelector('div.storycontent'); let content = document.querySelector('div[class^="MainStory_storycontent__"');
if (json_text && content) { if (json_text && content) {
content.innerHTML = '';
let intro = content.querySelectorAll('div:not([class]'); let intro = content.querySelectorAll('div:not([class]');
removeDOMElement(...intro); removeDOMElement(...intro);
let parser = new DOMParser(); let parser = new DOMParser();
let doc = parser.parseFromString('<div>' + DOMPurify.sanitize(json_text) + '</div>', 'text/html'); let doc = parser.parseFromString('<div>' + DOMPurify.sanitize(json_text, dompurify_options) + '</div>', 'text/html');
let content_new = doc.querySelector('div'); let content_new = doc.querySelector('div');
content.firstChild.before(content_new); window.setTimeout(function () {
content.appendChild(content_new);
}, 1000);
} }
} else } else
refreshCurrentTab(); refreshCurrentTab();