PageSourceSearch

https://skateparkoftampa.com/cdn/shop/t/3/assets/custom-sidecart.js?v=22619284755612197251737372610

js skateparkoftampa.com collected 2026-10-02 06:41:32 UTC 11,372 bytes, 2 lines download raw bytes

1(function(){const selectors={sidebarSection:".custom-sidecart-section",sidebarContainer:".custom-sidecart",sidebarQty:"sidecart-qty",headerCartButton:".site-header-cart--button",closeSidebarElement:"[data-close-sidebar]",orderNoteBlock:".custom-sidecart-ordernote",orderNoteOpen:".custom-sidecart__ordernote-open",orderNoteClose:"[data-close-ordernote]",addToSidecart:"data-add-to-sidecart",formError:".product-form-error",removeProduct:"data-remove-item",qtyInput:"[data-quantity-input]"};let scrollbarWidth=window.innerWidth-document.body.offsetWidth;window.addEventListener("resize",()=>{scrollbarWidth=window.innerWidth-document.body.offsetWidth},!0);const openSidebar=e=>{document.body.classList.contains("template-cart")||(e&&e.preventDefault(),document.querySelector("body").classList.add("sidebar-opened"),document.querySelector(selectors.sidebarSection).classList.add("is-open"),document.querySelector("html").style.paddingRight=scrollbarWidth+"px")},closeSidebar=e=>{e.preventDefault(),document.querySelector("body").classList.remove("sidebar-opened"),document.querySelector(selectors.sidebarSection).classList.remove("is-open"),document.querySelector("html").style.paddingRight=0},showError=(el,desc)=>{const errorWrapper=el.closest("div"),productFormError=document.querySelector(selectors.formError);if(errorWrapper&&!productFormError){const formError=document.createElement("p");formError.classList.add("product-form-error"),formError.innerHTML=desc,errorWrapper.insertAdjacentElement("afterend",formError)}else productFormError.innerHTML=desc},productOverlay=(item,status)=>{status?item.classList.add("is-loading"):item.classList.remove("is-loading")},checkQty=(eventType,thisInput)=>{thisInput.classList.contains("sidecart-item-qty__input")&&(thisInput.value.match(/[^0-9]/g)&&(thisInput.value=thisInput.value.replace(/[^0-9]/g,"")),thisInput.value>1&&thisInput.value>=Number(thisInput.getAttribute("data-max-qty"))?(thisInput.value=Number(thisInput.getAttribute("data-max-qty")),thisInput.previousElementSibling.removeAttribute("disabled"),thisInput.nextElementSibling.setAttribute("disabled","disabled")):thisInput.value>1&&thisInput.value!==Number(thisInput.getAttribute("data-max-qty"))?(thisInput.previousElementSibling.removeAttribute("disabled"),thisInput.nextElementSibling.removeAttribute("disabled")):thisInput.value===1&&Number(thisInput.getAttribute("data-max-qty"))===1?(thisInput.previousElementSibling.setAttribute("disabled","disabled"),thisInput.nextElementSibling.setAttribute("disabled","disabled")):(thisInput.previousElementSibling.setAttribute("disabled","disabled"),thisInput.nextElementSibling.removeAttribute("disabled")),eventType==="change"&&(thisInput.value<1&&(thisInput.value=1),setTimeout(()=>{updateProduct(thisInput.closest(".sidecart-item"))},300)))};document.addEventListener("input",e=>{checkQty("input",e.target)}),document.addEventListener("change",e=>{checkQty("change",e.target)}),document.addEventListener("click",e=>{if(e.target.classList.contains("sidecart-item-qty__btn")){const thisInput=e.target.closest(".sidecart-item-qty").querySelector(selectors.qtyInput);e.target.hasAttribute("data-quantity-minus")?thisInput.value=--thisInput.value:e.target.hasAttribute("data-quantity-plus")&&(thisInput.value=++thisInput.value),thisInput.dispatchEvent(new Event("change",{bubbles:!0}))}}),window.updateCustomSideCart=function(options){const message=options&&options.message,lineItem=options&&options.lineItem;
1let config;config={method:"POST",headers:{Accept:"application/javascript","X-Requested-With":"XMLHttpRequest"}},config.headers["X-Requested-With"]="XMLHttpRequest",config.headers["Content-Type"]="application/json",fetch("?sections=custom-sidecart,static-header").then(data=>data.json()).then(response=>{renderContents({sections:response},!0),openSidebar(),setTimeout(()=>{if(options&&lineItem){const lineItemDiv=document.querySelector('.sidecart-item[data-id="'+lineItem.variant_id+'"]'),error=document.createElement("div");error.classList.add("product-message--error"),error.textContent=message,lineItemDiv.parentNode.insertBefore(error,lineItemDiv)}})})};const getVariantData=async({productHandle,variantId})=>{const html=await(await fetch(`/products/${productHandle}?variant=${variantId}&view=variant-data`)).text(),json=new DOMParser().parseFromString(html,"text/html").getElementById("variant-data");return JSON.parse(json.innerHTML)};window.getVariantData=getVariantData;const addProduct=async event=>{const thisBtn=event,thisForm=event.closest("[data-product-form]"),productFormError=document.querySelector(selectors.formError);let config,productHandle,quantity,nowInCart=0,variantId;if(thisBtn.classList.add("is-loading"),productFormError&&productFormError.remove(),thisForm){config={method:"POST",headers:{Accept:"application/javascript","X-Requested-With":"XMLHttpRequest"}};const formData=new FormData(thisForm);formData.append("sections",getSectionsToRender().map(section=>section.id)),formData.append("sections_url",window.location.pathname),config.body=formData,productHandle=thisForm.dataset.productHandle,quantity=parseInt(formData.get("quantity"),10),variantId=formData.get("id")}else if(thisBtn.hasAttribute("data-variant-id")){const productId=thisBtn.getAttribute("data-variant-id");config=fetchConfig("javascript"),config.headers["X-Requested-With"]="XMLHttpRequest",config.headers["Content-Type"]="application/json",config.body=JSON.stringify({id:productId,quantity:1,sections:getSectionsToRender().map(section=>section.id),sections_url:window.location.pathname}),productHandle=thisBtn.dataset.productHandle,quantity=1,variantId=productId}await fetch("/cart.js").then(data=>data.json()).then(cart=>{nowInCart=cart.items.reduce((acc,i)=>(i.variant_id===variant_id&&(acc+=i.quantity),acc),0)});const{inventory_quantity,inventory_management,inventory_policy,product_title}=await getVariantData({productHandle,variantId});if(inventory_management&&inventory_policy==="deny"&&inventory_quantity<=nowInCart+quantity){new MessageBanner(`You can't add more "${product_title}" to the cart`,"error");return}fetch(`${window.Theme.routes.cart_add_url}`,config).then(response=>response.json()).then(response=>{response.status===422&&showError(thisBtn,response.description),renderContents(response,!0),openSidebar()}).catch(e=>{console.error(e)}).finally(()=>{thisBtn.classList.remove("is-loading"),document.querySelector("body").classList.contains("modal-visible")&&event.closest("[data-modal-container]")&&document.querySelector(".allow-scroll-while-locked .modal-close")&&document.querySelector(".allow-scroll-while-locked .modal-close").click()})},updateProduct=event=>{const productLine=event.getAttribute("data-line-item"),productQty=event.querySelector(selectors.qtyInput).value,config=fetchConfig("javascript");config.body=JSON.stringify({line:productLine,quantity:productQty,sections:getSectionsToRender().map(section=>section.id),sections_url:window.location.pathname}),productOverlay(event,!0),fetch(`${window.Theme.routes.cart_change_url}`,config).then(response=>response.json()).then(response=>{renderContents(response),productOverlay(event)}).catch(e=>{console.error(e)})},removeProduct=event=>{const productLine=event.getAttribute("data-line-item");productOverlay(event,!0);const config=fetchConfig("javascript");config.body=JSON.stringify({line:productLine,quantity:0,sections:getSectionsToRender().map(section=>section.id),sections_url:window.location.pathname}),fetch(`${window.Theme.routes.cart_change_url}`,config).then(response=>response.json()).then(response=>{renderContents(response,!0)}).catch(e=>{console.error(e)})},fetchConfig=(type="json")=>({method:"POST",headers:{"Content-Type":"application/json",Accept:`application/${type}`}}),renderContents=(parsedState,event=!1)=>
1{getSectionsToRender().forEach((section=>{section.selector.forEach(selector=>{selector!=="#sidecart-related"&&(document.querySelector(selector).innerHTML=getSectionInnerHTML(parsedState.sections[section.id],selector)),selector==="#sidecart-related"&&event===!0&&document.querySelector(selector)&&(document.querySelector(selector).innerHTML=getSectionInnerHTML(parsedState.sections[section.id],selector))})})),parsedState.item_count===0&&document.querySelector(".custom-sidecart__related-product")&&document.querySelector(".custom-sidecart__related-product").remove();const sidecartFooter=document.getElementById("sidecart-footer");parsedState.item_count===0?sidecartFooter.classList.add("is-empty"):sidecartFooter.classList.remove("is-empty")},getSectionsToRender=()=>[{id:"custom-sidecart",selector:["#sidecart-products","#sidecart-free-shipping","#sidecart-total-value","#sidecart-title","#sidecart-related"]},{id:"static-header",selector:[".site-header-cart--button"]}],getSectionInnerHTML=(html,selector=".shopify-section")=>{let doc=new DOMParser().parseFromString(html,"text/html");return doc.querySelector(selector)?doc.querySelector(selector).innerHTML:""},relatedProductsInit=()=>
1{const relatedSlider=new Swiper(".cart-also-like",{slidesPerView:1,spaceBetween:10,autoHeight:!0,navigation:{prevEl:".custom-sidecart__slider-nav-prev",nextEl:".custom-sidecart__slider-nav-next"}})};class ProductRecommendations extends HTMLElement{constructor(){super();const handleIntersection=(entries,observer)=>{entries[0].isIntersecting&&(observer.unobserve(this),fetch(this.dataset.url).then(response=>response.text()).then(text=>{const html=document.createElement("div");html.innerHTML=text;const recommendations=html.querySelector("product-recommendations");recommendations&&recommendations.innerHTML.trim().length&&(this.innerHTML=recommendations.innerHTML),relatedProductsInit()}).catch(e=>{console.error(e)}))};new IntersectionObserver(handleIntersection.bind(this)).observe(this)}}customElements.define("product-recommendations",ProductRecommendations),window.addEventListener("DOMContentLoaded",()=>{const cartBtn=document.querySelector(selectors.headerCartButton);cartBtn&&cartBtn.addEventListener("click",e=>{e.preventDefault(),e.stopPropagation(),openSidebar(e)});const closeEl=document.querySelectorAll(selectors.closeSidebarElement);closeEl!==void 0&&closeEl.forEach(el=>{el.addEventListener("click",e=>{closeSidebar(e)})});const orderNoteBtns=document.querySelectorAll([selectors.orderNoteOpen,selectors.orderNoteClose]);orderNoteBtns&&orderNoteBtns.forEach(el=>{el.addEventListener("click",e=>{document.querySelector(selectors.sidebarContainer).classList.toggle("order-note-opened")})}),document.addEventListener("click",e=>{if((e.target.hasAttribute(selectors.addToSidecart)||e.target.closest("button")&&e.target.closest("button").hasAttribute(selectors.addToSidecart))&&(e.preventDefault(),e.stopPropagation(),e.stopImmediatePropagation(),addProduct(e.target.hasAttribute(selectors.addToSidecart)?e.target:e.target.closest("button"))),(e.target.hasAttribute(selectors.removeProduct)||e.target.closest("button")&&e.target.closest("button").hasAttribute(selectors.removeProduct))&&removeProduct(e.target.closest(".sidecart-item")),e.target.classList.contains("custom-sidecart__ordernote-save")){const noteField=document.querySelector(".custom-sidecart-ordernote__textarea");if(noteField){const body=JSON.stringify({note:noteField.value});fetch("/cart/update.js",{...fetchConfig(),body})}}})})})();
2//# sourceMappingURL=/cdn/shop/t/3/assets/custom-sidecart.js.map?v=22619284755612197251737372610

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.