PageSourceSearch

https://www.jhpfashion.nl/cdn/shop/t/108/assets/cart-drawer.js?v=29090225068775607561786537595

js jhpfashion.nl collected 2026-10-05 05:15:42 UTC 6,835 bytes, 7 lines download raw bytes

1class CartDrawer extends HTMLElement{constructor(){super(),this.addEventListener("keyup",evt=>evt.code==="Escape"&&this.close()),this.querySelector("#CartDrawer-Overlay").addEventListener("click",this.close.bind(this)),this.setHeaderCartIconAccessibility(),this.addEventListener("cart-drawer:reinitialize",this.handleReinitialize.bind(this)),window.cartTimerState||(window.cartTimerState={initialized:!1,interval:null,minutes:0,seconds:0})}setHeaderCartIconAccessibility(){const cartLink=document.querySelector("#cart-icon-bubble");cartLink.setAttribute("role","button"),cartLink.setAttribute("aria-haspopup","dialog"),cartLink.addEventListener("click",event=>{event.preventDefault(),this.open(cartLink)}),cartLink.addEventListener("keydown",event=>{event.code.toUpperCase()==="SPACE"&&(event.preventDefault(),this.open(cartLink))})}open(triggeredBy){triggeredBy&&this.setActiveElement(triggeredBy);const cartDrawerNote=this.querySelector('[id^="Details-"] summary');cartDrawerNote&&!cartDrawerNote.hasAttribute("role")&&this.setSummaryAccessibility(cartDrawerNote),setTimeout(()=>{this.classList.add("animate","active")}),this.addEventListener("transitionend",()=>{const containerToTrapFocusOn=this.classList.contains("is-empty")?this.querySelector(".drawer__inner-empty"):document.getElementById("CartDrawer"),focusElement=this.querySelector(".drawer__inner")||this.querySelector(".drawer__close");trapFocus(containerToTrapFocusOn,focusElement)},{once:!0}),document.body.classList.add("overflow-hidden"),this.setupExpirationTimer()}setupExpirationTimer(){if(this.classList.contains("is-empty"))return;const hideTimer=this.getAttribute("data-hide-timer")==="true",timerText=this.getAttribute("data-timer-text")||"Please note: your shopping cart will expire in";if(hideTimer){const existingTimer=document.getElementById("cart-expiration-message");existingTimer&&existingTimer.remove();return}this.createTimerElement(timerText);const countdownEl=document.getElementById("cart-countdown");countdownEl&&(window.cartTimerState.initialized||(window.cartTimerState.minutes=10,window.cartTimerState.seconds=0,window.cartTimerState.initialized=!0),this.updateCountdownDisplay(countdownEl),window.cartTimerState.interval&&clearInterval(window.cartTimerState.interval),window.cartTimerState.interval=setInterval(()=>{this.updateCountdown(countdownEl)},1e3))}
1createTimerElement(timerText){if(document.getElementById("cart-expiration-message"))return;const timerElement=document.createElement("div");timerElement.id="cart-expiration-message",timerElement.className="cart-expiration-message",timerElement.innerHTML=`
2  <svg style="margin-right: 10px; width: 20px; height: 20px;" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="black">
3    <path d="M12 2C6.5 2 2 6.5 2 12s4.5 10 10 10 10-4.5 10-10S17.5 2 12 2zm0 18c-4.4 0-8-3.6-8-8s3.6-8 8-8 8 3.6 8 8-3.6 8-8 8zm.5-13H11v6l5.2 3.2.8-1.3-4.5-2.7V7z"/>
4  </svg>
5  <span>${timerText} <span id="cart-countdown">00:00</span></span>
6`;const shippingMessage=this.querySelector(".cart-shipping"),drawerHeader=this.querySelector(".drawer__header");shippingMessage?shippingMessage.after(timerElement):drawerHeader&&drawerHeader.after(timerElement)}updateCountdown(countdownEl){if(window.cartTimerState.seconds===0){if(window.cartTimerState.minutes===0){clearInterval(window.cartTimerState.interval),window.cartTimerState.interval=null;return}window.cartTimerState.minutes--,window.cartTimerState.seconds=59}else window.cartTimerState.seconds--;this.updateCountdownDisplay(countdownEl)}updateCountdownDisplay(countdownEl){const formattedMinutes=window.cartTimerState.minutes.toString().padStart(2,"0"),formattedSeconds=window.cartTimerState.seconds.toString().padStart(2,"0");countdownEl.textContent=`${formattedMinutes}:${formattedSeconds}`}close(){this.classList.remove("active"),removeTrapFocus(this.activeElement),document.body.classList.remove("overflow-hidden")}setSummaryAccessibility(cartDrawerNote){cartDrawerNote.setAttribute("role","button"),cartDrawerNote.setAttribute("aria-expanded","false"),cartDrawerNote.nextElementSibling.getAttribute("id")&&cartDrawerNote.setAttribute("aria-controls",cartDrawerNote.nextElementSibling.id),cartDrawerNote.addEventListener("click",event=>{event.currentTarget.setAttribute("aria-expanded",!event.currentTarget.closest("details").hasAttribute("open"))}),cartDrawerNote.parentElement.addEventListener("keyup",onKeyUpEscape)}renderContents(parsedState){this.querySelector(".drawer__inner").classList.contains("is-empty")&&this.querySelector(".drawer__inner").classList.remove("is-empty"),this.productId=parsedState.id,this.getSectionsToRender().forEach(section=>{const sectionElement=section.selector?document.querySelector(section.selector):document.getElementById(section.id);sectionElement.innerHTML=this.getSectionInnerHTML(parsedState.sections[section.id],section.selector)}),setTimeout(()=>{this.querySelector("#CartDrawer-Overlay").addEventListener("click",this.close.bind(this)),this.open()})}getSectionInnerHTML(html,selector=".shopify-section"){return new DOMParser().parseFromString(html,"text/html").querySelector(selector).innerHTML}getSectionsToRender(){return[{id:"cart-drawer",selector:"#CartDrawer"},{id:"cart-icon-bubble"}]}getSectionDOM(html,selector=".shopify-section"){return new DOMParser().parseFromString(html,"text/html").querySelector(selector)}setActiveElement(element){this.activeElement=element}handleReinitialize(event){const overlay=this.querySelector("#CartDrawer-Overlay");overlay&&(overlay.removeEventListener("click",this.close.bind(this)),overlay.addEventListener("click",this.close.bind(this)));const cartDrawerItems=this.querySelector("cart-drawer-items");cartDrawerItems&&this.reinitializeCartDrawerItems(cartDrawerItems),this.classList.contains("is-empty")||this.setupExpirationTimer()}reinitializeCartDrawerItems(cartDrawerItems){cartDrawerItems.querySelectorAll('input[name="quantity"]').forEach(input=>{input.removeEventListener("change",cartDrawerItems.onChange.bind(cartDrawerItems)),input.addEventListener("change",cartDrawerItems.onChange.bind(cartDrawerItems))}),cartDrawerItems.querySelectorAll("cart-remove-button").forEach(button=>{button.removeEventListener("click",event=>{event.preventDefault(),cartDrawerItems.updateQuantity(button.dataset.index,0)}),button.addEventListener("click",event=>{event.preventDefault(),cartDrawerItems.updateQuantity(button.dataset.index,0)})})}}customElements.define("cart-drawer",CartDrawer);class CartDrawerItems extends CartItems{getSectionsToRender(){return[{id:"CartDrawer",section:"cart-drawer",selector:".drawer__inner"},{id:"cart-icon-bubble",section:"cart-icon-bubble",selector:".shopify-section"}]}}customElements.define("cart-drawer-items",CartDrawerItems);
7//# sourceMappingURL=/cdn/shop/t/108/assets/cart-drawer.js.map?v=29090225068775607561786537595

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.