(function () { function setupRoot(root) { var track = root.querySelector(".square-promo__track"); var group = root.querySelector(".square-promo__group"); if (!track || !group) return; var clone = root.querySelector(".square-promo__group--clone"); if (clone) clone.remove(); root.classList.remove("is-marquee"); track.style.animationDuration = ""; if (group.scrollWidth <= root.clientWidth + 1) return; clone = group.cloneNode(true); clone.classList.add("square-promo__group--clone"); clone.setAttribute("aria-hidden", "true"); clone.querySelectorAll("a").forEach(function (link) { link.setAttribute("tabindex", "-1"); }); track.appendChild(clone); root.classList.add("is-marquee"); track.style.animationDuration = Math.max(18, Math.round(group.scrollWidth / 36)) + "s"; if (typeof window.initLazyImages === "function") { window.initLazyImages(clone); } } function setupAll() { document.querySelectorAll("[data-square-promo]").forEach(setupRoot); } var resizeTimer = 0; function onResize() { window.clearTimeout(resizeTimer); resizeTimer = window.setTimeout(setupAll, 160); } if (document.readyState === "loading") { document.addEventListener("DOMContentLoaded", setupAll, { once: true }); } else { setupAll(); } window.addEventListener("resize", onResize); })();