PageSourceSearch

https://yourself.health/cdn/shop/t/21/assets/v2-cart.js?v=133299159523363983031787920386

js yourself.health collected 2026-10-06 18:25:03 UTC 4,824 bytes, 2 lines download raw bytes

1(function(){const ROOT_SELECTOR="[data-v2-cart]",DESKTOP_MQ="(min-width: 1200px)";function cartRoot(){return document.querySelector(ROOT_SELECTOR)}function statusEl(root){return root.querySelector("[data-v2-cart-status]")}function setStatus(root,message){const el=statusEl(root);el&&(el.textContent=message||"")}function syncCtaOffset(root){if(!root)return;const cta=root.querySelector("[data-v2-cart-cta]");if(!cta||window.matchMedia(DESKTOP_MQ).matches){root.style.removeProperty("--v2-cart-cta-offset");return}root.style.setProperty("--v2-cart-cta-offset",`${cta.offsetHeight}px`)}function syncChromeOffset(root){if(!root||root.classList.contains("v2-cart--preview")){root&&root.style.removeProperty("--v2-cart-chrome-offset");return}const top=root.getBoundingClientRect().top+(window.scrollY||window.pageYOffset||0);root.style.setProperty("--v2-cart-chrome-offset",`${Math.max(0,Math.floor(top))}px`)}function syncStickyTop(root){if(!root||root.classList.contains("v2-cart--preview")||!window.matchMedia(DESKTOP_MQ).matches){root&&root.style.removeProperty("--v2-cart-sticky-header");return}const header=document.querySelector(".main-header-new");let offset=0;header&&!header.classList.contains("hidden")&&(offset=Math.max(0,Math.round(header.getBoundingClientRect().bottom))),root.style.setProperty("--v2-cart-sticky-header",`${offset}px`)}function syncLayout(root){syncCtaOffset(root),syncChromeOffset(root),syncStickyTop(root)}function updateHeaderCount(count){document.querySelectorAll(".header-cart-count, .main-header-new__cart-count").forEach(function(el){el.textContent=String(count),el.classList.toggle("active",count>0)}),document.querySelectorAll(".main-header-new__cart").forEach(function(el){el.classList.toggle("active",count>0)})}function changeUrl(){return`${window.Shopify&&window.Shopify.routes&&window.Shopify.routes.root?window.Shopify.routes.root:"/"}cart/change.js`}async function refreshSection(root){const sectionId=root.getAttribute("data-v2-cart-section-id");if(!sectionId)return;const url=new URL(window.location.href);url.searchParams.set("section_id",sectionId);const response=await fetch(url.toString());if(!response.ok)throw new Error("Section refresh failed");const html=await response.text(),doc=new DOMParser().parseFromString(html,"text/html"),wrapperId=`shopify-section-${sectionId}`,currentWrapper=document.getElementById(wrapperId),nextWrapper=doc.getElementById(wrapperId);if(currentWrapper&&nextWrapper)currentWrapper.replaceWith(nextWrapper);else{const nextRoot=doc.querySelector(ROOT_SELECTOR);nextRoot&&root.replaceWith(nextRoot)}const next=cartRoot();syncLayout(next)}async function changeLine(root,key,quantity){if(!root.classList.contains("is-updating")){root.classList.add("is-updating"),root.setAttribute("aria-busy","true"),setStatus(root,"");try{const response=await fetch(changeUrl(),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:String(key),quantity:Number(quantity)})}),data=await response.json();if(!response.ok||data.status){const message=data.description||data.message||"Cart Error";setStatus(root,message);return}updateHeaderCount(data.item_count),document.dispatchEvent(new CustomEvent("v2:cart:updated",{detail:data})),await refreshSection(root)}catch(error){setStatus(root,error.message||"Cart Error")}finally{const next=cartRoot();next&&(next.classList.remove("is-updating"),next.removeAttribute("aria-busy"))}}}function nextQuantity(action,current){return action==="remove"?0:action==="plus"?current+1:action==="minus"?Math.max(0,current-1):current}document.addEventListener("click",function(event){const actionEl=event.target.closest("[data-v2-cart-action]");if(!actionEl)return;const root=actionEl.closest(ROOT_SELECTOR);if(!root)return;const key=actionEl.getAttribute("data-v2-cart-item-key"),action=actionEl.getAttribute("data-v2-cart-action");if(!key||!action)return;event.preventDefault();const current=Number(actionEl.getAttribute("data-v2-cart-quantity")||"0"),quantity=nextQuantity(action,current);changeLine(root,key,quantity)});function hideIntercomLauncher(root){if(!root||root.classList.contains("v2-cart--preview"))return;function hide(){typeof window.Intercom=="function"&&window.Intercom("update",{hide_default_lau
1ncher:!0})}hide(),window.addEventListener("load",hide)}function onReady(){const root=cartRoot();syncLayout(root),hideIntercomLauncher(root)}window.addEventListener("resize",function(){syncLayout(cartRoot())});let stickyTopRaf=0;window.addEventListener("scroll",function(){stickyTopRaf||(stickyTopRaf=window.requestAnimationFrame(function(){stickyTopRaf=0,syncStickyTop(cartRoot())}))},{passive:!0}),document.readyState==="loading"?document.addEventListener("DOMContentLoaded",onReady):onReady()})();
2//# sourceMappingURL=/cdn/shop/t/21/assets/v2-cart.js.map?v=133299159523363983031787920386

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.