//"use strict"; if (matchDomain('nationalgeographic.com')) { function natgeo_func(node) { removeDOMElement(node); let body = document.querySelector('body[class]'); if (body) { body.removeAttribute('class'); body.removeAttribute('style'); } } waitDOMElement('div[id^="fittPortal"]', 'DIV', natgeo_func, false); } else if (matchDomain('nyteknik.se')) { window.setTimeout(function () { let hidden_images = document.querySelectorAll('img[src=""][data-proxy-image]'); for (let hidden_image of hidden_images) hidden_image.setAttribute('src', hidden_image.getAttribute('data-proxy-image').replace('_320', '_640')); }, 2000); // Delay (in milliseconds) } function matchDomain(domains, hostname) { var matched_domain = false; if (!hostname) hostname = window.location.hostname; if (typeof domains === 'string') domains = [domains]; domains.some(domain => (hostname === domain || hostname.endsWith('.' + domain)) && (matched_domain = domain)); return matched_domain; } function removeDOMElement(...elements) { for (let element of elements) { if (element) element.remove(); } } function waitDOMElement(selector, tagName = '', callback, multiple = false) { new window.MutationObserver(function (mutations) { for (let mutation of mutations) { for (let node of mutation.addedNodes) { if (!tagName || (node.tagName === tagName)) { if (node.matches(selector)) { callback(node); if (!multiple) this.disconnect(); } } } } }).observe(document, { subtree: true, childList: true }); }