PageSourceSearch

https://www.dreamweave.co/cdn/shop/t/5/assets/quick-add.js?v=42542036387708553681707714237

js dreamweave.co collected 2026-10-10 01:44:08 UTC 2,476 bytes, 2 lines download raw bytes

1import"@archetype-themes/scripts/config";import Product from"@archetype-themes/scripts/modules/product";class QuickAdd extends HTMLElement{constructor(){super(),this.selectors={quickAddBtn:"[data-single-variant-quick-add]",quickAddHolder:"[data-tool-tip-content]"},theme.settings.quickAdd&&(this.container=this,this.init())}init(){const quickAddBtn=this.container.querySelector(this.selectors.quickAddBtn);quickAddBtn?quickAddBtn.addEventListener("click",this.addToCart.bind(this)):(this.addEventListener("tooltip:interact",async e=>{e.detail.context==="QuickAdd"&&(this.quickAddData||(this.quickAddData=await this.loadQuickAddForm(e)))}),this.addEventListener("tooltip:open",async e=>{if(e.detail.context==="QuickAdd"){this.quickAddData||(this.quickAddData=await this.loadQuickAddForm(e));const quickAddContainer=document.querySelector(this.selectors.quickAddHolder);quickAddContainer.innerHTML=this.quickAddData.outerHTML,new Product(quickAddContainer),document.dispatchEvent(new CustomEvent("quickshop:opened")),Shopify&&Shopify.PaymentButton&&Shopify.PaymentButton.init()}}))}addToCart(evt){const btn=evt.currentTarget,visibleBtn=btn.querySelector(".btn"),id=btn.dataset.id;visibleBtn.classList.add("btn--loading");const data={items:[{id,quantity:1}]};fetch(theme.routes.cartAdd,{method:"POST",body:JSON.stringify(data),credentials:"same-origin",headers:{"Content-Type":"application/json"}}).then(response=>response.json()).then(data2=>{data2.status===422||data2.status==="bad_request"?data2.description&&alert(data2.description):document.dispatchEvent(new CustomEvent("ajaxProduct:added",{detail:{product:data2,addToCartBtn:btn}})),visibleBtn.classList.remove("btn--loading")})}async loadQuickAddForm(evt){const gridItem=evt.currentTarget.closest(".grid-product"),handle=gridItem.getAttribute("data-product-handle"),prodId=gridItem.getAttribute("data-product-id");let url=`${theme.routes.home}/products/${handle}?view=form`;url=url.replace("//","/");try{const html=await(await fetch(url)).text(),div=new DOMParser().parseFromString(html,"text/html").querySelector(`.product-section[data-product-handle="${handle}"]`);return window.dispatchEvent(new CustomEvent(`quickadd:loaded:-${prodId}`)),document.dispatchEvent(new CustomEvent("quickadd:loaded",{detail:{productId:prodId,handle}})),div}catch(error){console.error("Error:",error)}}}customElements.define("quick-add",QuickAdd);
2//# sourceMappingURL=/cdn/shop/t/5/assets/quick-add.js.map?v=42542036387708553681707714237

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.