PageSourceSearch

https://geekworm.com/cdn/shop/t/64/assets/add-gift-wrap.js?v=88660618615121164941720182837

js geekworm.com collected 2026-10-02 06:48:08 UTC 2,548 bytes, 2 lines download raw bytes

1class AddGiftWrap extends HTMLElement{constructor(){super(),this.giftWrapProductId=parseInt(this.dataset.giftWrapProductId),this.cartDrawer=document.querySelector("cart-notification"),this.querySelector('[name="attributes[gift-wrapping]"]').addEventListener("change",event=>{event.target.checked?this.setGiftWrap():this.removeGiftWrap()}),this.cartItemsSize=this.dataset.cartItemsSize,this.giftWrapsInCart=this.dataset.giftWrapInCart,this.giftWrapProduct=this.dataset.giftWrapProduct=="true",this.cartItemsSize==1&&this.giftWrapsInCart>0?this.removeGiftWrap():this.giftWrapsInCart>1?this.setGiftWrap():this.giftWrapsInCart>0&&this.giftWrapProduct===!1?this.setGiftWrap():this.giftWrapsInCart==0&&this.giftWrapProduct&&this.setGiftWrap()}renderContents(parsedState){this.getSectionsToRender().forEach(section=>{let renderSelector=document.getElementById(section.id);renderSelector&&(renderSelector.innerHTML=this.getSectionInnerHTML(parsedState.sections[section.id]))})}setGiftWrap(){document.querySelector(".cart_action_drawer_overlay").classList.add("active");const body=JSON.stringify({updates:{[this.giftWrapProductId]:1},attributes:{"gift-wrapping":!0},sections:this.getSectionsToRender().map(section=>section.id),sections_url:window.location.pathname});fetch(`${routes.cart_update_url}`,{...fetchConfig(),body}).then(response=>response.text()).then(state=>{let parsedState=JSON.parse(state);this.renderContents(parsedState)}).catch(()=>{console.error(e)}).finally(()=>{document.querySelector(".cart_action_drawer_overlay").classList.remove("active")})}removeGiftWrap(){document.querySelector(".cart_action_drawer_overlay").classList.add("active");const body=JSON.stringify({updates:{[this.giftWrapProductId]:0},attributes:{"gift-wrapping":""},sections:this.getSectionsToRender().map(section=>section.id),sections_url:window.location.pathname});fetch(`${routes.cart_update_url}`,{...fetchConfig(),body}).then(response=>response.text()).then(state=>{let parsedState=JSON.parse(state);this.renderContents(parsedState)}).catch(()=>{console.error(e)}).finally(()=>{document.querySelector(".cart_action_drawer_overlay").classList.remove("active")})}getSectionsToRender(){return[{id:"mini-cart-drawer"},{id:"cart-notification-count"},{id:"gift-wrapping"}]}getSectionInnerHTML(html,selector=".shopify-section"){return new DOMParser().parseFromString(html,"text/html").querySelector(selector).innerHTML}}customElements.define("add-gift-wrap",AddGiftWrap);
2//# sourceMappingURL=/cdn/shop/t/64/assets/add-gift-wrap.js.map?v=88660618615121164941720182837

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.