PageSourceSearch

https://www.thesareeroom.com/cdn/shop/t/27/assets/quick-cart-drawer.js?v=71185264810786434921788291218

js thesareeroom.com collected 2026-09-24 20:16:08 UTC 7,099 bytes, 2 lines download raw bytes

1if(!customElements.get("quick-cart-drawer")){class QuickCartDrawer extends HTMLElement{constructor(){super(),Shopify.designMode&&(window.addEventListener("shopify:section:load",this.init.bind(this)),this.parentElement.addEventListener("shopify:section:select",()=>this.open()),this.parentElement.addEventListener("shopify:section:deselect",()=>this.close()))}connectedCallback(){this.init()}init(){this.toggleState=!1,this.classList.contains("is--open")||document.querySelector("body").classList.remove("overflow-hidden"),this.querySelector(".button--close").addEventListener("click",this.close.bind(this)),this.querySelector(".quick-cart-drawer__backdrop").addEventListener("click",this.close.bind(this)),this.querySelector(".quick-cart-drawer__blocks").addEventListener("keydown",e=>{if(e.key==="Escape"&&this.toggleState&&this.close(),this.toggleState){const focusableElements=this.querySelectorAll('button, [href], input, select, label, textarea, [tabindex]:not([tabindex="-1"])'),firstFocusableElement=focusableElements[0],lastFocusableElement=focusableElements[focusableElements.length-1];if(!(e.key==="Tab"))return;e.shiftKey?document.activeElement===firstFocusableElement&&(e.preventDefault(),lastFocusableElement.focus()):document.activeElement===lastFocusableElement&&(e.preventDefault(),firstFocusableElement.focus())}}),this.initTriggers()}initTriggers(){new MutationObserver(()=>{document.querySelectorAll(".quick-cart-drawer__trigger").forEach(element=>{element._init||(element.addEventListener("click",event=>{this.fetchProductForQuickCartDrawer(event)}),element._init=!0)})}).observe(document.body,{childList:!0,subtree:!0})}async fetchProductForQuickCartDrawer(event){event.target.closest("card-product-slider")&&(event.target.closest("card-product-slider").slider.autoplay.stop(),event.target.closest("card-product-slider").classList.add("product--open-on-quick-cart"));const isRecommendations=event.target.classList.contains("quick-cart-drawer__trigger--recommendations"),productCard=event.target.closest("product-card");let productOptions=null;if(!isRecommendations){if(!productCard)return;productOptions=productCard.querySelectorAll('input[type="radio"]:checked, select')}const trigger=event.target.closest("[data-product-url]");trigger.classList.toggle("is--loading");try{let fetchPrefix="";window.Shopify.routes.root.includes(`/${window.Shopify.locale}/`)&&(fetchPrefix=`/${window.Shopify.locale}`);const productCardResponse=await fetch(`${fetchPrefix}${trigger.dataset.productUrl}/?view=quick-cart`);if(!productCardResponse)return;const productCardHTML=await productCardResponse.text(),productCard2=document.createElement("DIV");if(productCard2.insertAdjacentHTML("beforeend",productCardHTML),!productCard2.querySelector(".quick-cart-product"))return;this.querySelector(".quick-cart-drawer__main").innerHTML="",this.querySelector(".quick-cart-drawer__main").append(productCard2.querySelector(".quick-cart-product")),this.sliderInstance=new Swiper(".quick-cart-drawer__media-swiper",{slidesPerView:1.25,spaceBetween:8,freeMode:{enabled:!0},breakpoints:{750:{slidesPerView:2}}})}catch{}finally{trigger.classList.toggle("is--loading"),isRecommendations||productOptions.forEach(productOption=>{const quickCartDrawerOption=this.querySelector(`[name="${CSS.escape(productOption.name)}"][value="${CSS.escape(productOption.value)}"]`),quickCartDrawerOptionLabel=quickCartDrawerOption.parentElement.parentElement.querySelector("legend"),quickCartDrawerOptionLabelInnerHTML=quickCartDrawerOptionLabel.innerHTML;if(this.querySelectorAll(`[name="${productOption.name}"]`).forEach(radioInput=>{radioInput.removeAttribute("checked"),radioInput.closest("li").classList.remove("checked")}),quickCartDrawerOption){quickCartDrawerOption.setAttribute("checked","");const quickCartDrawerOptionLabelSpan=quickCartDrawerOptionLabel.querySelector("[data-selected-variant]");quickCartDrawerOptionLabelSpan&&(quickCartDrawerOptionLabelSpan.innerHTML=productOption.value)}this.querySelector("product-card").querySelector('input[name="id"]').value=productCard.querySelector('input[name="id"]').value,quickCartDrawerOption&&quickCartDrawerOption.closest("li").classList.add("checked"),this.querySelector("product-card").init()}),setTimeout(()=>{this.open()},500),this.querySelector(".quick-cart-drawer__main").querySelectorAll(".variant-option-radio-input").forEach(radioInput=>{radioInput.addEventListener("change",event2=>{const quickCartDrawerOptionLabelSpan=event2.target.parentElement.parentElement.querySelector("legend").querySelector("[data-selected-variant]");quickCartDrawerOptionLabelSpan&&(quickCartDrawerOptionLabelSpan.innerHTML=event2.target.value);const selectedVariantId=this.querySelector(".product-card__add-to-cart--form input[name='id']").value,featuredMedia=this.querySelector("product-card").variantsObj.find(variant=>variant.id==selectedVariantId)?.featured_media;featuredMedia&&this.setActiveMedia(featuredMedia.id)})})}}setActiveMedia(id){const mediaFound=Array.from(this.querySelectorAll("[data-media-id]")).find(media=>Number(media.dataset.mediaId)===id);mediaFound&&this.sliderInstance.slideTo(Number(mediaFound.dataset.index))}toggle(){this.toggleState?this.close():this.open()}open(){this.toggleState=!0,document.querySelector("body").classList.add("overflow-hidden");const quickCartDrawer=document.querySelector(".quick-cart-drawer__blocks"),closeButton=quickCartDrawer.querySelector(".button--close");quickCartDrawer.setAttribute("tabindex","0"),closeButton.setAttribute("tabindex","0"),this.classList.add("is--open"),this.opened();const firstFocusableElement=this.querySelector('button, [href], input, select, textarea, [tabindex]:not
1([tabindex="-1"])');firstFocusableElement&&firstFocusableElement.focus()}close(){this.toggleState=!1;const shopTheLookDrawer=document.querySelector("shop-the-look-drawer");shopTheLookDrawer&&!shopTheLookDrawer.classList.contains("is--open")&&document.querySelector("body").classList.remove("overflow-hidden"),shopTheLookDrawer||document.querySelector("body").classList.remove("overflow-hidden"),this.classList.remove("is--open"),this.closed(),this.toggleAriaExpanded(),document.querySelector("card-product-slider.product--open-on-quick-cart")&&(document.querySelector("card-product-slider.product--open-on-quick-cart").slider.autoplay.start(),document.querySelector("card-product-slider.product--open-on-quick-cart").classList.remove("product--open-on-quick-cart"))}toggleAriaExpanded(event){event?(event.target.closest("button")&&event.target.closest("button").setAttribute("aria-expanded",!0),this.querySelector(".button--close").setAttribute("aria-expanded",!0)):document.querySelectorAll('[aria-controls="quick-cart-drawer"]').forEach(button=>{button.setAttribute("aria-expanded",!1)})}opened(){const openedEvent=new Event("opened",{bubbles:!0});this.dispatchEvent(openedEvent)}closed(){const closedEvent=new Event("closed",{bubbles:!0});this.dispatchEvent(closedEvent)}}customElements.define("quick-cart-drawer",QuickCartDrawer)}
2//# sourceMappingURL=/cdn/shop/t/27/assets/quick-cart-drawer.js.map?v=71185264810786434921788291218

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.