Co potřebujete najít?
Doporučujeme
document.addEventListener('DOMContentLoaded', function () {
function processImage(img) {
if (img.hasAttribute('loading')) {
img.removeAttribute('loading');
}
if (img.hasAttribute('data-shp-lazy')) {
img.removeAttribute('data-shp-lazy');
}
if (img.hasAttribute('data-micro-image')) {
img.src = img.getAttribute('data-micro-image');
}
img.setAttribute('fetchpriority', 'high');
}
document.querySelectorAll('img').forEach(processImage);
const observer = new MutationObserver(function (mutations) {
mutations.forEach(function (mutation) {
mutation.addedNodes.forEach(function (node) {
if (node.tagName === 'IMG') {
processImage(node);
}
if (node.querySelectorAll) {
node.querySelectorAll('img').forEach(processImage);
}
});
});
});
observer.observe(document.body, { childList: true, subtree: true });
});