/* FURY VAPE — hydrate lazy-loaded images. Images ship as and a lazy-load library normally promotes data-srcset -> srcset. None of that JS runs here (no OceanWP/Elementor/lazysizes on the page), so every image stayed on the 1x1 placeholder. Most size variants referenced in the srcset (e.g. *-300x300.jpg, *-1536x1536.jpg) live under the reference site's old upload paths and were never migrated, so offering a srcset just produces 404s. We therefore load the base file (the first srcset entry = the file that WAS migrated) and skip srcset entirely. */ (function () { if (window.__furyLazyImages) return; window.__furyLazyImages = true; function parse(list) { if (!list) return []; return list.split(',').map(function (p) { var b = p.trim().split(/\s+/); return { url: b[0], w: parseInt(b[1], 10) || 0 }; }).filter(function (c) { return c.url && c.url.indexOf('data:') !== 0; }); } function baseUrl(cands, ds) { if (ds && ds.indexOf('data:') !== 0) return ds; return cands.length ? cands[0].url : null; // first entry = the migrated original } function hydrate(img) { if (!img || img.dataset.furyHydrated) return; img.dataset.furyHydrated = '1'; var cands = parse(img.getAttribute('data-srcset')); var ds = img.getAttribute('data-src'); var base = baseUrl(cands, ds); if (!base) return; img.removeAttribute('srcset'); img.removeAttribute('sizes'); if ((img.getAttribute('src') || '').indexOf('data:') === 0) img.setAttribute('src', base); img.classList.add('lazyloaded'); img.classList.remove('lazyload'); } function scan() { var imgs = document.querySelectorAll('img[data-srcset], img[data-src]'); for (var i = 0; i < imgs.length; i++) hydrate(imgs[i]); } function ready(fn) { if (document.readyState !== 'loading') fn(); else document.addEventListener('DOMContentLoaded', fn); } ready(function () { scan(); if (window.MutationObserver) { new MutationObserver(function (m) { for (var i = 0; i < m.length; i++) if (m[i].addedNodes && m[i].addedNodes.length) { scan(); break; } }).observe(document.body, { childList: true, subtree: true }); } window.addEventListener('load', scan); var n = 0, t = setInterval(function () { scan(); if (++n > 13) clearInterval(t); }, 1500); }); })();