(function() { /* Boot marker — check window.IXU_BUILD in the console to confirm which version of this head markup is actually executing on the page. */ window.IXU_BUILD = '2026-08-29-popup-prod-1'; /* ---- Popup banner config ---- */ var POPUP = { imageUrl: '/sfsites/c/resource/IXUPopupBanner', linkUrl: '/product/rotterdam-dockers-match-jersey/01tSe00000JdYbZIAV', newTab: false, /* true only for off-site links */ altText: 'Rotterdam Dockers match jersey', storageKey: 'ixu_popup_v1', /* bump to v2 to re-show after a creative swap */ oncePer: 'session', /* 'session' | 'ever' | 'always' */ homeOnly: false, delayMs: 1200 }; /* Base path differs by environment: /ixusport in sandbox, likely root on www.ixusport.com. Resolved lazily so the meta tag has parsed by then. */ var IXU_BASE = null; function basePath() { if (IXU_BASE !== null) return IXU_BASE; var meta = document.querySelector('meta[name="basePath"]'); var value = meta && meta.getAttribute('content'); if (!value) { var first = location.pathname.split('/')[1]; value = first === 'ixusport' ? '/ixusport' : ''; } IXU_BASE = (value === '/' ? '' : value).replace(/\/$/, ''); return IXU_BASE; } function popupHref(url) { if (!url) return ''; if (/^https?:\/\//i.test(url)) return url; var base = basePath(); var path = url.charAt(0) === '/' ? url : '/' + url; if (base && path.indexOf(base + '/') === 0) return path; return base + path; } function popupSeen() { if (POPUP.oncePer === 'always') return false; try { var store = POPUP.oncePer === 'ever' ? localStorage : sessionStorage; return store.getItem(POPUP.storageKey) === '1'; } catch (e) { return false; } } function markPopupSeen() { if (POPUP.oncePer === 'always') return; try { var store = POPUP.oncePer === 'ever' ? localStorage : sessionStorage; store.setItem(POPUP.storageKey, '1'); } catch (e) {} } function buildPopup() { var lastFocused = document.activeElement; var dismissed = false; var scrim = document.createElement('div'); scrim.className = 'ixu-popup-scrim'; scrim.setAttribute('role', 'dialog'); scrim.setAttribute('aria-modal', 'true'); scrim.setAttribute('aria-label', POPUP.altText); var frame = document.createElement('div'); frame.className = 'ixu-popup-frame'; var img = document.createElement('img'); img.src = POPUP.imageUrl; img.alt = POPUP.altText; if (POPUP.linkUrl) { var link = document.createElement('a'); link.href = popupHref(POPUP.linkUrl); if (POPUP.newTab) { link.target = '_blank'; link.rel = 'noopener noreferrer'; } link.addEventListener('click', function() { /* Close straight away rather than waiting for the page to swap */ dismiss(); }); link.appendChild(img); frame.appendChild(link); } else { frame.appendChild(img); } var close = document.createElement('button'); close.className = 'ixu-popup-close'; close.type = 'button'; close.setAttribute('aria-label', 'Close'); close.textContent = '\u00D7'; function dismiss() { dismissed = true; markPopupSeen(); scrim.setAttribute('data-visible', 'false'); document.removeEventListener('keydown', onKey); setTimeout(function() { if (scrim.parentNode) scrim.parentNode.removeChild(scrim); if (lastFocused && lastFocused.focus) lastFocused.focus(); }, 240); } function onKey(e) { if (e.key === 'Escape') dismiss(); } close.addEventListener('click', function(e) { e.preventDefault(); e.stopPropagation(); dismiss(); }); scrim.addEventListener('click', function(e) { if (e.target === scrim) dismiss(); }); document.addEventListener('keydown', onKey); frame.appendChild(close); scrim.appendChild(frame); /* Attach to documentElement, not body: LWR re-renders body during hydration and will silently discard nodes appended there. */ (document.documentElement || document.body).appendChild(scrim); requestAnimationFrame(function() { scrim.setAttribute('data-visible', 'true'); close.focus(); }); /* Guard: if anything removes the node, put it back until dismissed */ var guard = setInterval(function() { if (dismissed) { clearInterval(guard); return; } if (!scrim.parentNode) { (document.documentElement || document.body).appendChild(scrim); scrim.setAttribute('data-visible', 'true'); } }, 300); img.addEventListener('error', function() { /* Never show shoppers a broken frame — pull the whole thing */ console.error('[ixu-popup] image failed to load:', POPUP.imageUrl); dismissed = true; if (scrim.parentNode) scrim.parentNode.removeChild(scrim); }); } function startPopup() { if (popupSeen()) return; var path = location.pathname.replace(basePath(), ''); if (POPUP.homeOnly && !/^\/?(s\/?)?$/.test(path)) return; setTimeout(function() { try { buildPopup(); } catch (err) { console.error('[ixu-popup] build failed:', err); } }, POPUP.delayMs); } if (document.readyState === 'loading') { document.addEventListener('DOMContentLoaded', startPopup); } else { startPopup(); } function fixImages() { var imgs = document.querySelectorAll('.ixu-constrained-img img'); for (var i = 0; i < imgs.length; i++) { imgs[i].style.width = '100%'; imgs[i].style.height = '200px'; imgs[i].style.objectFit = 'fill'; imgs[i].style.maxWidth = 'none'; var imgDiv = imgs[i].closest('.image') || imgs[i].parentElement; if (imgDiv) { imgDiv.style.width = '100%'; } } } function updatePill() { var pill = document.querySelector('.ixu-pill-auto'); if (!pill) return; var items = document.querySelectorAll('[class*="breadcrumb"] li'); var crumbs = Array.from(items).map(function(li) { return li.textContent.trim(); }); if (!crumbs.length) return; var label = ''; if (crumbs.length === 1) { label = crumbs[0]; } else if (crumbs.length === 2) { label = crumbs[0] + ' - ' + crumbs[1].toUpperCase(); } else { label = crumbs[crumbs.length - 2] + ' - ' + crumbs[crumbs.length - 1].toUpperCase(); } if (label && pill.textContent !== label) { pill.textContent = label; } } /* Fix mobile video playback */ function fixVideos() { var videos = document.querySelectorAll('video'); for (var i = 0; i < videos.length; i++) { if (!videos[i].hasAttribute('playsinline')) { videos[i].setAttribute('playsinline', ''); videos[i].setAttribute('webkit-playsinline', ''); videos[i].setAttribute('disableRemotePlayback', ''); videos[i].removeAttribute('controls'); } } } setInterval(function() { updatePill(); fixVideos(); fixImages(); }, 300); var pushState = history.pushState; history.pushState = function() { pushState.apply(history, arguments); setTimeout(updatePill, 100); setTimeout(updatePill, 300); setTimeout(updatePill, 600); }; var replaceState = history.replaceState; history.replaceState = function() { replaceState.apply(history, arguments); setTimeout(updatePill, 100); setTimeout(updatePill, 300); setTimeout(updatePill, 600); }; })();