PageSourceSearch

https://www.bonescoffee.com/cdn/shop/t/332/assets/section-ajax-cart.min.js?v=11584155393705413401787600608

js bonescoffee.com collected 2026-09-25 19:36:39 UTC 10,907 bytes, 1 lines download raw bytes

1!function(t){"function"==typeof define&&define.amd?define(t):t()}((function(){"use strict";const t=t=>{const n=document.getElementById("screenReaderStatus");n.textContent="",n.textContent=t};document.addEventListener("click",(t=>{const n=t.target.closest('[data-behavior="quantity"]');if(n){t.stopImmediatePropagation();const e=n.querySelector('input[type="number"]'),s=new Event("change",{bubbles:!0,cancellable:!0});s.clickTarget=t.target;let i,o,c=e.hasAttribute("min"),a=e.hasAttribute("max");i=c?e.getAttribute("min"):0,o=a?e.getAttribute("max"):999;const r="increment"==t.target.dataset.behavior,u="decrement"==t.target.dataset.behavior,l=parseInt(e.value,10);let d=l;u&&d--,r&&d++,d<i&&(d=i),d>o&&(d=o),d!=l&&(e.value=d,e.dispatchEvent(s))}}));const n=async(t,n=null,e=!0)=>{try{const o=await(s=t,i=n,i=i||{},new Promise((function(t,n){var e=new XMLHttpRequest,o=[],c=[],a={},r=function(){return{ok:2==(e.status/100|0),statusText:e.statusText,status:e.status,url:e.responseURL,text:function(){return Promise.resolve(e.responseText)},json:function(){return Promise.resolve(e.responseText).then(JSON.parse)},blob:function(){return Promise.resolve(new Blob([e.response]))},clone:r,headers:{keys:function(){return o},entries:function(){return c},get:function(t){return a[t.toLowerCase()]},has:function(t){return t.toLowerCase()in a}}}};for(var u in e.open(i.method||"get",s,!0),e.onload=function(){e.getAllResponseHeaders().replace(/^(.*?):[^\S\n]*([\s\S]*?)$/gm,(function(t,n,e){o.push(n=n.toLowerCase()),c.push([n,e]),a[n]=a[n]?a[n]+","+e:e})),t(r())},e.onerror=n,e.withCredentials="include"==i.credentials,i.headers)e.setRequestHeader(u,i.headers[u]);e.send(i.body||null)})));if(!o.ok)return console.error(`Error ${o.status}`),o;if(e)return await o.json();if(!e)return await o.text()}catch(t){console.error(t)}var s,i},e=t=>document.getElementById(t);const s=window.Shopify.routes.root,i=["ajaxCartContent","ajaxCartBtn","cartContent","ajaxCartModals"],o=t=>{const n=[];for(const t of i){const e=document.getElementById(t);e&&n.push({replacedContentId:t,sectionId:e.closest(".shopify-section").id.replace("shopify-section-","")})}return t?n.map((t=>t.sectionId)):n},c=async(t,e)=>{const i={method:"POST",credentials:"same-origin",body:JSON.stringify({line:t,quantity:e,sections:o(!0),sections_url:s}),headers:{"Content-Type":"application/json"}};return await n(`${s}cart/change.js`,i)},a="data-cart-line",r="data-cart-item-line",u="data-selling-plan-id",l={qtyInput:".input-qty__input",removeItem:`[data-behavior="${"remove-line"}"]`,removeBundle:`[data-behavior="${"remove-bundle"}"]`,cartItems:".js-cart-items",cartItem:".js-cart-item",subscriptionForm:".js-cart-item-subscription-form",subscriptionOption:".js-subscription-option",subscriptionUpdateBtn:".js-cart-item-subscription-update",subscriptionUpdateBtnV1:".js-v1-cart-item-subscription-update",subscriptionUpdateBtnV2:".js-v2-cart-item-subscription-update",subscriptionFormV1:".js-v1-cart-item-subscription-form",subscriptionFormV2:".js-v2-cart-item-subscription-form",addonOverlay:".overlay--above-modals.is-active.is-visible"},d="animate-slide-up",m="cart-is-loading",p=()=>{const t=e("ajaxCartBtn"),n="true"===t.getAttribute("aria-expanded");t&&!n&&t.click()},h=(n,e)=>{n?(document.body.classList.add(m),t(window.fmData.a11yStrings.cartUpdating)):(document.body.classList.remove(m),e&&t(e))},f=async(t,n)=>{h(!0),n.classList.add(d);const e=await c(t,0),s=n.closest(l.cartItems);$(e,s.id),window.EventBus.emit("cart:item:removed",e),h(!1,window.fmData.cartStrings.itemRemoved)},y=async(t,e,i,c)=>{h(!0);const a=await(async(t,e,i)=>{const c={method:"POST",credentials:"same-origin",body:JSON.stringify({line:t,quantity:e,selling_plan:i,sections:o(!0),sections_url:s}),headers:{"Content-Type":"application/json"}};return await n(`${s}cart/change.js`,c)})(t,e,i);$(a,c),h(!1)},b=t=>{const n=t.target;if(!n.closest(l.removeItem)||!n.closest(`[${a}]`))return;t.preventDefault();const e=n.closest(`[${a}]`),s=e.getAttribute(a);f(s,e)},w=async t=>{const e=t.target.dataset.bundleId,i=t.target.closest(l.cartItem),c=i.closest(l.cartItems),a=[];if(!e||!i)return;h(!0);const r=await(async()=>{const t=await n(`${s}cart.js`,{credentials:"same-origin"});return window.EventBus.emit("cart:fetched",t),t})();for(const t of r.items)t.properties._bundle_item_id!==e&&a.push(t);const u=a.map((t=>{const n={quantity:t.quantity,id:t.variant_id,selling_plan:t.selling_plan_allocation?.selling_plan?.id||null,properties:Object.keys(t.properties).length>0?t.properties:null};return n.properties&&(n.properties={_bundle_item:t.properties._bundle_item||null,_bundle_item_id:t.properties._bundle_item_id||null,_bundle_item_price:t.properties._bundle_item_price||null,_bundle_item_handle:t.properties._bundle_item_handle||null,_bundle_item_variant:t.properties._bundle_item_variant||null,_bundle_overall_qty:t.properties._bundle_overall_qty||null}),n})).map((t=>(t.selling_plan||delete t.selling_plan,t.properties||delete t.properties,t))),d=await(async()=>{const t={method:"POST",credentials:"same-origin",body:JSON.stringify({sections:o(!0),sections_url:s}),headers:{"Content-Type":"application/json"}};return await n(`${s}cart/clear.js`,t)})();if(d&&u.length>0){const t=await(async t=>{const e={method:"POST",credentials:"include",headers:{"Content-Type":"application/json"},body:JSON.stringify({items:t,sections:o(!0),sections_url:s})};return await n(`${s}cart/add.js`,e)})(u);$(t,c.id),h(!1)}d&&0===u.length&&($(d,c.id),h(!1))},$=(t,n)=>{if(!t||!t.sections)return;const s=o();console.log("Sections",s),console.log("Cart",t);for(const n of s){const e=(new DOMParser).parseFromString(t.sections[n.sectionId],"text/html").querySelector(`#${n.replacedContentId}`).innerHTML,s=document.querySelector(`#${n.replacedContentId}`);s&&(s.innerHTML=e)}const i=e(n),c=document.querySelector(l.cartItems);i?i.focus():c.focus(),window.EventBus.emit("content:changed"),window.EventBus.emit("cart:markup:updated"),document.querySelector(l.addonOverlay)&&document.querySelector(l.addonOverlay).click()},j=t=>{const n=t.target,e=n.closest(`[${a}]`),s=n.closest(l.qtyInput);if(!e||!n.value)return;if(!s)return;const i=e.getAttribute(a);if(n.getAttribute("id"),0==n.value)f(i,e);else{const e=(t.clickTarget||t.target).id;(async(t,n,e)=>{h(!0);const s=await c(t,n);$(s,e),h(!1)})(i,n.value,e)}};localStorage.getItem("showCart")&&(p(),localStorage.removeItem("showCart")),document.addEventListener("change",(t=>{j(t);const n=t.target.closest(l.subscriptionUpdateBtnV2),e=t.target.closest(l.subscriptionOption);n&&(t=>{const n=t.target;if(!n.closest(l.subscriptionFormV2))return;const e=n.closest(`[${r}]`).getAttribute(r),s=document.querySelector(l.cartItems).querySelector(`${l.cartItem}[${a}="${e}"]`),i=s.closest(l.cartItems).id,o=parseInt(s.querySelector("input[name='quantity']").value);let c;c=n.checked?parseInt(n.dataset.sellingPlanId):null,y(e,o,c,i)})(t),e&&(t=>{const n=t.target,e=n.closest(l.subscriptionFormV1),s=n.closest(l.subscriptionFormV2);if(null!==e){const t=n.value,e=n.closest(`[${r}]`).getAttribute(r),s=document.querySelector(l.cartItems).querySelector(`${l.cartItem}[${a}="${e}"]`),i=s.closest(l.cartItems).id,o=parseInt(s.querySelector("input[name='quantity']").value);y(e,o,t,i)}if(null!==s){const t=n.value,e=n.closest(`[${r}]`).getAttribute(r),s=document.querySelector(l.cartItems).querySelector(`${l.cartItem}[${a}="${e}"]`),i=s.closest(l.cartItems).id,o=parseInt(s.querySelector("input[name='quantity']").value);y(e,o,t,i)}})(t)})),document.addEventListener("click",(t=>{const n=t.target.closest(l.removeItem),e=t.target.closest(l.removeBundle),s=t.target.closest(l.subscriptionUpdateBtn),i=t.target.closest(l.subscriptionUpdateBtnV1);n&&b(t),e&&w(t),s&&(t=>{const n=t.target,e=n.closest(l.subscriptionForm);if(!e)return;const s=e.querySelector(`${l.subscriptionOption}:checked`).value,i=n.closest(`[${r}]`).getAttribute(r),o=document.querySelector(l.cartItems).querySelector(`${l.cartItem}[${a}="${i}"]`),c=o.closest(l.cartItems).id,u=parseInt(o.querySelector("input[name='quantity']").value);y(i,u,s,c)})(t),i&&(t=>{const n=t.target;if(!n.closest(l.subscriptionFormV1))return;const e=n.closest(`[${u}]`).getAttribute(u),s=n.closest(`[${r}]`).getAttribute(r),i=document.querySelector(l.cartItems).querySelector(`${l.cartItem}[${a}="${s}"]`),o=i.closest(l.cartItems).id,c=parseInt(i.querySelector("input[name='quantity']").value);y(s,c,e,o)})(t)})),window.EventBus.on("cart:updated",$),window.EventBus.on("cart:show",p),window.EventBus.on("cart:hide",(()=>{const t=e("ajaxCartBtnClose");t&&t.click()}));const v=(t,n=Shopify.currency.active,e=Shopify.locale)=>{let s=!1;"JPY"===n&&(s=!1);let i=.01*t;
1return s&&i%1==0?i.toLocaleString(e,{style:"currency",currency:n}).slice(0,-3):i.toLocaleString(e,{style:"currency",currency:n})},_=".js-price",g=".js-compare-price",C="hide";class S extends HTMLElement{constructor(){super(),this.data={imageSize:"240"},this.selectors={atc:".js-add-to-cart",option:".js-cart-upsell-option",image:".js-variant-image",variantsJSON:".js-variants-json",id:"[name='id']"},this.content={atc:this.querySelector(this.selectors.atc),price:this.querySelector(this.selectors.price),image:this.querySelector(this.selectors.image),idInput:this.querySelector(this.selectors.id)}}t(){const t=this.querySelector(this.selectors.variantsJSON).textContent;return((t,n,e=".js-product-option")=>{const s={option1:null,option2:null,option3:null};for(const n of t.querySelectorAll(e))"INPUT"===n.tagName&&!n.checked||(s[n.getAttribute("name")]=decodeURIComponent(n.value));for(const t of n)if(t.option1===s.option1&&t.option2===s.option2&&t.option3===s.option3)return t;return!1})(this,JSON.parse(t),this.selectors.option)}i(){const t=this.t(),{available:n,featured_image:e}=t;this.content.atc.disabled=!n,t&&(((t,n,e)=>{const s=v(n),i=v(e);for(const n of t.querySelectorAll(_))n.textContent=s;for(const s of t.querySelectorAll(g))!e||e<=n?s.classList.add(C):(s.textContent=i,s.classList.remove(C))})(this,t.price,t.compare_at_price),this.content.idInput.value=t.id,e&&(this.content.image.src=`${e.src}&width=${this.data.imageSize}&height=${this.data.imageSize}&crop=center`))}o(t){t.target.closest(this.selectors.option)&&this.i()}connectedCallback(){this.addEventListener("change",this.o.bind(this))}}var I,q;I="cart-upsell",q=S,void 0===customElements.get(I)&&customElements.define(I,q);const O=".js-sub-upsell-v1-show-content",x=".js-sub-upsell-v1-content",P=".js-sub-upsell-v2-show-content",T=".js-sub-upsell-v2-content",k=".js-cart-item",B="hide";document.addEventListener("click",(t=>{const n=t.target,e=n.closest(k);e&&(n.matches(O)&&((t,n)=>{n.querySelectorAll(x).forEach((n=>{n.classList.contains(B)?(n.classList.remove(B),t.textContent="Hide frequency"):(n.classList.add(B),t.textContent="Edit frequency")}))})(n,e),n.matches(P)&&((t,n)=>{n.querySelectorAll(T).forEach((t=>t.classList.remove(B))),t.classList.add(B)})(n,e))}))}));

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.