PageSourceSearch

https://www.coleyhome.com/cdn/shop/t/105/assets/kickflip-customizer-focus.js?v=69741044689961860921788963457

js coleyhome.com collected 2026-09-29 15:58:35 UTC 4,636 bytes, 2 lines download raw bytes

1(function(){const WRAPPER_SELECTOR="kickflip-customizer-iframe, .kickflip-customizer-iframe, #kickflip-customizer-iframe",TRIGGER_SELECTOR="#product-mczr-modal-button, #kickflip-customize-button";let lastTrigger=null,activeWrapper=null,inertRoots=[],hasMovedFocus=!1,focusAttempts=0;const dialogLabel=()=>window.theme?.strings?.customiserDialog||"Product customizer",isVisible=element=>{if(!element||element.hasAttribute("hidden")||element.getAttribute("aria-hidden")==="true")return!1;const style=window.getComputedStyle(element);if(style.display==="none"||style.visibility==="hidden")return!1;const rect=element.getBoundingClientRect();return rect.width>0&&rect.height>0},getWrapper=()=>document.querySelector(WRAPPER_SELECTOR),getIframe=wrapper=>{if(!wrapper)return null;if(wrapper.tagName==="IFRAME")return wrapper;const lightDomIframe=wrapper.querySelector("iframe");return lightDomIframe||wrapper.shadowRoot?.querySelector("iframe")||null},getDialog=wrapper=>wrapper.closest('[role="dialog"], [aria-modal="true"]')||wrapper,isIframeOrInsideIframe=element=>!element||!activeWrapper?!1:!!(element.tagName==="IFRAME"||element===getIframe(activeWrapper)||element===activeWrapper&&getIframe(activeWrapper)),getBodyRoot=element=>{let root=element;for(;root.parentElement&&root.parentElement!==document.body;)root=root.parentElement;return root},setBackgroundInert=(dialog,enabled)=>{if(inertRoots.forEach(root=>root.removeAttribute("inert")),inertRoots=[],!enabled)return;const dialogRoot=getBodyRoot(dialog);[...document.body.children].forEach(child=>{child!==dialogRoot&&(child.setAttribute("inert",""),inertRoots.push(child))})},decorateDialog=(wrapper,iframe)=>{const dialog=getDialog(wrapper);return dialog.hasAttribute("role")||dialog.setAttribute("role","dialog"),dialog.setAttribute("aria-modal","true"),!dialog.getAttribute("aria-label")&&!dialog.getAttribute("aria-labelledby")&&dialog.setAttribute("aria-label",dialogLabel()),iframe&&!iframe.getAttribute("title")&&iframe.setAttribute("title",dialogLabel()),dialog},moveFocusIntoIframe=wrapper=>{const iframe=getIframe(wrapper);if(!iframe)return!1;iframe.setAttribute("tabindex","0");try{iframe.contentWindow?.focus()}catch{}return iframe.focus(),document.activeElement===iframe||document.activeElement===wrapper},focusIframeWhenReady=wrapper=>{focusAttempts=0;const tryFocus=()=>{if(focusAttempts+=1,activeWrapper===wrapper){if(moveFocusIntoIframe(wrapper)){hasMovedFocus=!0;return}focusAttempts<30&&window.setTimeout(tryFocus,100)}};tryFocus()},openCustomizer=wrapper=>{const iframe=getIframe(wrapper);if(activeWrapper!==wrapper){lastTrigger=lastTrigger||document.activeElement,activeWrapper=wrapper,hasMovedFocus=!1;const dialog=decorateDialog(wrapper,iframe);setBackgroundInert(dialog,!0),focusIframeWhenReady(wrapper)}else iframe&&!hasMovedFocus&&(decorateDialog(wrapper,iframe),focusIframeWhenReady(wrapper));iframe&&!iframe.dataset.focusBound&&(iframe.dataset.focusBound="true",iframe.addEventListener("load",()=>{activeWrapper===wrapper&&moveFocusIntoIframe(wrapper)}))},closeCustomizer=()=>{activeWrapper&&(setBackgroundInert(activeWrapper,!1),activeWrapper=null,hasMovedFocus=!1,focusAttempts=0,lastTrigger&&typeof lastTrigger.focus=="function"&&lastTrigger.focus())},syncCustomizerState=()=>{const wrapper=getWrapper();if(wrapper&&isVisible(wrapper)){openCustomizer(wrapper);return}activeWrapper&&closeCustomizer()},onFocusIn=event=>{!activeWrapper||getDialog(activeWrapper).contains(event.target)||activeWrapper.shadowRoot?.contains(event.target)||moveFocusIntoIframe(activeWrapper)},onKeyDown=event=>{if(!activeWrapper)return;if(event.key==="Escape"){const closeButton=getDialog(activeWrapper).querySelector('button[aria-label*="close" i], button[aria-label*="Close"], [class*="close" i]');closeButton&&closeButton.click();return}event.key!=="Tab"||isIframeOrInsideIframe(document.activeElement)||!getIframe(activeWrapper)||(event.preventDefault(),moveFocusIntoIframe(activeWrapper))},rememberTrigger=event=>{const trigger=event.target.closest(TRIGGER_SELECTOR);trigger&&(lastTrigger=trigger)};document.addEventListener("focusin",onFocusIn,!0),document.addEventListener("keydown",onKeyDown,!0),document.addEventListener("click",rememberTrigger,!0),new MutationObserver(syncCustomizerState).observe(document.documentElement,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["hidden","style","class","aria-hidden","open"]}),document.readyState==="loading"?document.addEventListener("DOMContentLoaded",syncCustomizerState):syncCustomizerState()})();
2//# sourceMappingURL=/cdn/shop/t/105/assets/kickflip-customizer-focus.js.map?v=69741044689961860921788963457

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.