https://timex.co.uk/cdn/shop/t/457/assets/popup-hierarchy-control.js?v=88832335278751534131789367871
1const POPUP_HIERARCHY_INIT_TIME=Date.now(),INITIAL_LOAD_BUFFER=1e3,TIMEOUT_TO_DISCONNECT_OBSERVER=1e4;let HAS_SCROLLED_TO_TOP_FOR_ONETRUST=!1;const isElementVisible=elem=>{if(!elem)return!1;const computedStyle=window.getComputedStyle(elem);return!!(elem.getClientRects().length&&computedStyle.visibility!=="hidden"&&computedStyle.display!=="none")},openKlaviyoFormFromOneTrust=klaviyoPopupParent=>{setTimeout(()=>{(klaviyoPopupParent?.parentNode?.querySelector('span[role="button"]')||null)?.dispatchEvent(new Event("click"))},1e3)},disconnectHierarchyObserver=(hierarchyObserver,{globalePopup,oneTrustPopup,klaviyoPopupParent})=>{hierarchyObserver.disconnect(),globalePopup?.classList.remove("popup-force-hide"),oneTrustPopup?.classList.remove("popup-force-hide"),klaviyoPopupParent?.classList.remove("popup-force-hide"),HAS_SCROLLED_TO_TOP_FOR_ONETRUST=!0},hierarchyObserverMutationCallback=hierarchyObserver=>{const bodyElemTarget=document.documentElement||document.body,timeSinceInit=Date.now()-POPUP_HIERARCHY_INIT_TIME,globalePopup=document.querySelector("#md-app-embed__modal"),oneTrustPopup=document.querySelector("#onetrust-consent-sdk"),oneTrustPopupBanner=document.querySelector("#onetrust-banner-sdk"),oneTrustAcceptButton=document.getElementById("onetrust-accept-btn-handler"),klaviyoPopupParent=(document.querySelector('div[aria-label="POPUP Form"].needsclick')||null)?.parentNode||null;try{const isGlobalePopupVisible=isElementVisible(globalePopup);globalePopup?.classList.toggle("popup-force-hide",!isGlobalePopupVisible&&timeSinceInit>INITIAL_LOAD_BUFFER);const isOneTrustVisible=isElementVisible(oneTrustPopupBanner);isOneTrustVisible&&HAS_SCROLLED_TO_TOP_FOR_ONETRUST===!1&&(setTimeout(()=>{window.scrollTo(0,0)},100),HAS_SCROLLED_TO_TOP_FOR_ONETRUST=!0),oneTrustAcceptButton!==null&&!oneTrustAcceptButton.hasAttribute("data-klaviyo-scroll-trigger-init")&&(oneTrustAcceptButton.addEventListener("click",()=>{const scrollTop=window.scrollY||bodyElemTarget.scrollTop,viewportHeight=window.innerHeight,documentHeight=bodyElemTarget.scrollHeight;scrollTop+viewportHeight>=documentHeight-viewportHeight/2&&window.scrollTo(0,0)}),oneTrustAcceptButton.setAttribute("data-klaviyo-scroll-trigger-init",!0)),oneTrustPopup?.classList.toggle("popup-force-hide",isGlobalePopupVisible||timeSinceInit<=INITIAL_LOAD_BUFFER);const isParentBody=klaviyoPopupParent===bodyElemTarget;klaviyoPopupParent?.classList.toggle("popup-force-hide",(isGlobalePopupVisible||isOneTrustVisible)&&!isParentBody||timeSinceInit<=INITIAL_LOAD_BUFFER+250),oneTrustAcceptButton&&klaviyoPopupParent&&!oneTrustAcceptButton.hasAttribute("data-klaviyo-trigger-init")&&(oneTrustAcceptButton.setAttribute("data-klaviyo-trigger-init",!0),oneTrustAcceptButton.addEventListener("click",()=>{openKlaviyoFormFromOneTrust(klaviyoPopupParent)}));const loadBuffer=timeSinceInit>TIMEOUT_TO_DISCONNECT_OBSERVER;!isOneTrustVisible&&!isGlobalePopupVisible&&loadBuffer&&disconnectHierarchyObserver(hierarchyObserver,{globalePopup,oneTrustPopup,klaviyoPopupParent})}catch(error){console.error("Error in hierarchyObserverMutationCallback:",error),disconnectHierarchyObserver(hierarchyObserver,{globalePopup,oneTrustPopup,klaviyoPopupParent})}},popupHierarchyControl=()=>{const bodyElemTarget=document.documentElement||document.body,hierarchyObserverConfig={attributes:!0,childList:!0,subtree:!0},hierarchyObserver=new MutationObserver(()=>requestAnimationFrame(()=>hierarchyObserverMutationCallback(hierarchyObserver)));hierarchyObserver.observe(bodyElemTarget,hierarchyObserverConfig)};document.addEventListener("DOMContentLoaded",popupHierarchyControl); 2//# sourceMappingURL=/cdn/shop/t/457/assets/popup-hierarchy-control.js.map?v=88832335278751534131789367871
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.