1var cartItemsContainer=null,quantity=0;$(document).ready(function(){cartItemsContainer=$(".drawer__content"),addEventListenerForProductAddToCart(cartItemsContainer),addEventListenersForCart()});function addEventListenersForCart(){addEventListenerForRemoveProduct(cartItemsContainer),addEventListenerForAddProduct(cartItemsContainer),addEventListenerForSubtractProduct(cartItemsContainer)}function addEventListenerForRemoveProduct(cartItemsContainer2){$(".remove-button").click(function(event){let variantId=event.target.getAttribute("data-variant-id");fetch(`/cart/change.js?quantity=0&id=${variantId}`,{method:"POST"}).then(response=>response.json()).then(r=>{console.log("Product removed from cart:",r),updateCartHtml(r,0)})})}function addEventListenerForAddProduct(cartItemsContainer2){$(".plus").click(function(event){let variantId=event.target.getAttribute("data-variant-id"),variantQuantity=document.querySelector(`#Quantity-${variantId}`).value;fetch(`/cart/change.js?quantity=${variantQuantity}&id=${variantId}`,{method:"POST"}).then(response=>response.json()).then(r=>{console.log("Product added to cart:",r),updateCartHtml(r,0)})})}function addEventListenerForSubtractProduct(cartItemsContainer2){$(".minus").click(function(event){let variantId=event.target.getAttribute("data-variant-id"),variantQuantity=document.querySelector(`#Quantity-${variantId}`).value;fetch(`/cart/change.js?quantity=${variantQuantity}&id=${variantId}`,{method:"POST"}).then(response=>response.json()).then(r=>{console.log("Product removed from cart:",r),updateCartHtml(r,0)})})}function addEventListenerForProductAddToCart(cartItemsContainer2){$('button[type="submit"]').click(function(event){const addToCartButton=$(this);cartItemsContainer2.html("Updating cart...");const form=addToCartButton.closest("form"),variantId=form.find('input[name="id"]').val();quantity=form.find('input[name="quantity"]').val(),addVariantToCart(variantId,quantity)})}function addVariantToCart(variantId,quantity2){const requestData={items:[{id:variantId,quantity:quantity2}]};$.ajax({url:"/cart/add.js",type:"GET",dataType:"json",data:requestData,success:function(addToCartResponse){console.log("Product added to cart:",addToCartResponse),updateCartHtml(addToCartResponse,0)},error:function(addToCartError){console.error("Error adding product to cart:",addToCartError),cartItemsContainer.html("Error adding product to cart")}})}function updateHeaderCount(quantity2){const headerCount=$("span#cart-icon-bubble"),currentCount=parseInt(headerCount.text()),newCount=parseInt(quantity2);return headerCount.text(newCount),console.log(newCount),headerCount.addClass("shown"),newCount}function updateCartHtml(addToCartResponse,newCount){$.ajax({url:"/cart.js",type:"GET",dataType:"json",success:function(getCartResponse){let cartItemsHtml="",totalPrice=0;newCount=getCartResponse.item_count;for(let i=0;i<getCartResponse.items.length;i++){const item=getCartResponse.items[i],itemHtml=getItemHTML(getCartResponse,item,i);cartItemsHtml+=itemHtml,totalPrice+=item.price*item.quantity}const freeShippingThreshold=7500,remainingForFreeShipping=freeShippingThreshold-totalPrice,progressBarHtml=` 2 <div class="progress-bar"> 3 <div class="progress" style="width: ${Math.min(totalPrice/freeShippingThreshold*100,100)}%;"></div> 4 5 </div> 6 <div class="remaining-for-free-shipping"> 7 ${remainingForFreeShipping<=0?"You qualify for free shipping!":`Spend $${remainingForFreeShipping/100} more for free shipping`} 8 </div> 9 `,totalHtml=`<div class="total-price">Estimated total: $ ${totalPrice/100}</div>`,viewCart=`<a id="view_cart_btn" href="/cart" class="btn btn--has-icon-after cart__continue-btn" style="width:100%;">View Cart(${newCount})</a>`,checkBtn='<a id="cart__checkout_btn" href="/checkout" class="btn btn--has-icon-after cart__continue-btn" style="width:100%;">Proceed Checkout</a>',cartHtml=`${progressBarHtml}${cartItemsHtml}`,buttonsDiv=document.createElement("div");buttonsDiv.classList.add("bottom-container"),buttonsDiv.innerHTML=`${totalHtml}${viewCart}${checkBtn}`,updateHeaderCount(newCount),cartItemsContainer.html(cartHtml),cartItemsContainer.append(buttonsDiv),addEventListenersForCart(cartItemsContainer)},error:function(getCartError){console.error("Error updating cart:",getCartError),cartItemsContainer.html("Error updating cart")}})}function getItemHTML(getCartResponse,item,i){const imageHtml=`<img class="item-image" src="${item.image?item.image.replace(/(\.[^\.]+)$/,"_medium$1"):""}" alt="${item.title}" 10width="100" height="100">`,titleHtml=`<div class="item-title">${item.title}</div>`,priceHtml=`<div class="item-price">$ ${item.price/100}</div>`;let itemQty=item.quantity;const quantityHtml=` 11<quantity-input class="quantity"> 12<button class="quantity__button no-js-hidden minus" 13data-variant-id="${item.variant_id}" name="minus" type="button"> 14<span class="visually-hidden">Decrease quantity for ${item.title}</span> 15<svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" 16role="presentation" class="icon icon-minus" fill="none" viewBox="0 0 10 2"> 17<path fill-rule="evenodd" clip-rule="evenodd" d="M.5 1C.5.7.7.5 1 .5h8a.5.5 0 110 181H1A.5.5 0 01.5 1z" fill="currentColor"></path> 19</svg> 20</button> 21<input class="quantity__input" 22type="number" 23name="updates[]" 24value="${itemQty}" 25min="0" 26aria-label="Quantity for ${item.title}" 27id="Quantity-${item.variant_id}" 28data-index="${quantity}"> 29<button class="quantity__button no-js-hidden plus" 30data-variant-id="${item.variant_id}" name="plus" type="button"> 31<span class="visually-hidden">Increase quantity for ${item.title}</span> 32<svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" 33role="presentation" class="icon icon-plus" fill="none" viewBox="0 0 10 10"> 34<path fill-rule="evenodd" clip-rule="evenodd" d="M1 4.51a.5.5 0 000 1h3.5l.01 353.5a.5.5 0 001-.01V5.5l3.5-.01a.5.5 0 00-.01-1H5.5L5.49.99a.5.5 0 00-1 36.01v3.5l-3.5.01H1z" fill="currentColor"></path> 37</svg> 38</button> 39</quantity-input> 40`,removeButton=`<button class="remove-button" 41data-variant-id="${item.variant_id}">Remove</button>`,containerDiv=document.createElement("div");return containerDiv.classList.add("item-container"),containerDiv.innerHTML=`${imageHtml}${titleHtml}${priceHtml}${quantityHtml}${removeButton}`,containerDiv.outerHTML}document.addEventListener("DOMContentLoaded",()=>{setTimeout(()=>{document.querySelectorAll(".cart__remove-btn").forEach(button=>{button.addEventListener("click",event=>{event.preventDefault();const variantId=button.dataset.variantId;fetch(`/cart/change.js?quantity=0&id=${variantId}`,{method:"POST"}).then(response=>response.json()).then(data=>{const cartCount=document.querySelector("span#cart-icon-bubble");cartCount.textContent=data.item_count;const item=document.querySelector(`.item-container-${variantId}`);item.parentNode.removeChild(item);const totalPrice=document.querySelector("#cart__total_price");totalPrice.textContent=formatMoney(data.total_price)}).catch(error=>{console.error(error)})})})},2e3);function formatMoney(amount){return`$${(amount/100).toFixed(2)}`}}); 42//# sourceMappingURL=/cdn/shop/t/41/assets/drawer-scripts.js.map?v=25599172051185435691778611836
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.