PageSourceSearch

https://ttracing.my/cdn/shop/t/526/assets/custom.js?v=179820028850128592431788770261

js ttracing.my collected 2026-09-28 15:14:03 UTC 9,147 bytes, 7 lines download raw bytes

1document.addEventListener("DOMContentLoaded",function(){function updateCartItemCount(){fetch("/cart.js").then(response=>response.json()).then(cart=>{const itemCountElement=document.querySelector(".cart-count b");if(itemCountElement){const label=cart.item_count===1?"item":"items";itemCountElement.textContent=`${cart.item_count} ${label}`}const cartLinkBubble=document.querySelector(".cart-link__bubble");cart.item_count===0?(addEmptyCartCSS(),cartLinkBubble&&cartLinkBubble.classList.remove("cart-link__bubble--visible")):(removeEmptyCartCSS(),cartLinkBubble&&cartLinkBubble.classList.add("cart-link__bubble--visible"))})}function addEmptyCartCSS(){let styleTag=document.getElementById("empty-cart-style");styleTag||(styleTag=document.createElement("style"),styleTag.id="empty-cart-style",styleTag.textContent=`
2        .custom-cart { display: block; }
3        #convx-style-by-us .convx-style-by-us { display: none; }
4      `,document.head.appendChild(styleTag))}function removeEmptyCartCSS(){const styleTag=document.getElementById("empty-cart-style");styleTag&&styleTag.remove();let nonEmptyStyleTag=document.getElementById("non-empty-cart-style");nonEmptyStyleTag||(nonEmptyStyleTag=document.createElement("style"),nonEmptyStyleTag.id="non-empty-cart-style",nonEmptyStyleTag.textContent=`
5        #convx-style-by-us .convx-style-by-us { display: block; }
6      `,document.head.appendChild(nonEmptyStyleTag))}function monitorCartUpdates(){const originalFetch=window.fetch;window.fetch=function(...args){return originalFetch(...args).then(response=>((args[0].includes("/cart/add")||args[0].includes("/cart/change")||args[0].includes("/cart/update"))&&updateCartItemCount(),args[0].includes("/cart/add")&&window.theme.cartPageForm&&window.theme.cartPageForm.buildCart(),response))}}monitorCartUpdates(),updateCartItemCount()}),document.addEventListener("DOMContentLoaded",function(){function checkCartAndReloadIfEmpty(){fetch("/cart.js").then(res=>res.json()).then(cart=>{cart.items.length===0&&location.reload()})}document.body.addEventListener("click",function(e){e.target.closest(".js-qty__adjust")&&setTimeout(()=>{checkCartAndReloadIfEmpty()},600)}),document.querySelectorAll(".js-qty__num").forEach(input=>{input.addEventListener("change",()=>{setTimeout(()=>{checkCartAndReloadIfEmpty()},600)})})}),document.addEventListener("DOMContentLoaded",function(){document.body.addEventListener("click",function(e){const deleteBtn=e.target.closest(".cart__item-delete");if(!deleteBtn)return;e.preventDefault();const cartItem=deleteBtn.closest(".cart__item");if(!cartItem||cartItem.classList.contains("is-deleting"))return;const itemKey=cartItem.dataset.key;itemKey&&(cartItem.classList.add("is-deleting"),deleteBtn.innerHTML='<svg class="cart-delete-spinner" viewBox="0 0 18 18" width="18" height="18" fill="none" stroke="currentColor" stroke-width="2"><circle cx="9" cy="9" r="7" stroke-dasharray="32" stroke-dashoffset="10" stroke-linecap="round"/></svg>',fetch("/cart/change.js",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:itemKey,quantity:0})}).then(function(res){return res.json()}).then(function(cart){document.dispatchEvent(new CustomEvent("cart:updated")),window.theme&&window.theme.cartPageForm&&window.theme.cartPageForm.buildCart(),cart.items.length===0&&location.reload()}).catch(function(){cartItem.classList.remove("is-deleting")}))})});let cartObserver=null,isObserverActive=!1;function setupCartObserver(){const cartElement=document.querySelector(".ast-cart"),body=document.body;if(!cartElement){console.log("Cart element not found, retrying..."),setTimeout(setupCartObserver,500);return}if(isObserverActive){console.log("Observer already active");return}console.log("Setting up cart observer"),cartObserver&&cartObserver.disconnect(),cartObserver=new MutationObserver(function(mutations){mutations.forEach(function(mutation){mutation.type==="attributes"&&mutation.attributeName==="class"&&(mutation.target.classList.contains("ast-open")?(body.classList.add("cart-is-open"),console.log("Cart opened - added cart-is-open class to body")):(body.classList.remove("cart-is-open"),console.log("Cart closed - removed cart
6-is-open class from body")))})}),cartObserver.observe(cartElement,{attributes:!0,attributeFilter:["class"]}),isObserverActive=!0,console.log("Cart observer is now active"),cartElement.classList.contains("ast-open")&&(body.classList.add("cart-is-open"),console.log("Initial state: cart is open"))}function setupEventDelegation(){console.log("Setting up event delegation fallback"),document.addEventListener("click",function(e){[".ast-cart-menu-wrap",".ast-cart-trigger",".astra-cart-drawer-trigger",'[data-toggle-target*="ast-cart"]',".ast-addon-cart-wrap"].some(selector=>e.target.closest(selector))&&(console.log("Cart trigger clicked"),setTimeout(function(){const cart=document.querySelector(".ast-cart"),body=document.body;cart&&(cart.classList.contains("ast-open")?(body.classList.add("cart-is-open"),console.log("Event delegation: Cart opened")):(body.classList.remove("cart-is-open"),console.log("Event delegation: Cart closed")))},150))}),document.addEventListener("keydown",function(e){e.key==="Escape"&&setTimeout(function(){const cart=document.querySelector(".ast-cart");cart&&!cart.classList.contains("ast-open")&&(document.body.classList.remove("cart-is-open"),console.log("Cart closed via Escape key"))},150)})}function initCartBodyClass(){console.log("Initializing cart body class functionality"),setupCartObserver(),setupEventDelegation(),setInterval(function(){const cart=document.querySelector(".ast-cart"),body=document.body;if(cart){const shouldHaveClass=cart.classList.contains("ast-open"),currentlyHasClass=body.classList.contains("cart-is-open");shouldHaveClass&&!currentlyHasClass?(body.classList.add("cart-is-open"),console.log("Periodic check: Added cart-is-open class")):!shouldHaveClass&&currentlyHasClass&&(body.classList.remove("cart-is-open"),console.log("Periodic check: Removed cart-is-open class"))}},2e3)}function startInitialization(){document.readyState==="complete"?initCartBodyClass():document.readyState==="interactive"?setTimeout(initCartBodyClass,100):document.addEventListener("DOMContentLoaded",function(){setTimeout(initCartBodyClass,100)}),window.addEventListener("load",function(){setTimeout(function(){isObserverActive||(console.log("Retry initialization after window load"),initCartBodyClass())},500)}),typeof jQuery<"u"&&jQuery(document).ready(function(){setTimeout(function(){isObserverActive||(console.log("Retry initialization via jQuery"),initCartBodyClass())},200)})}startInitialization();class ProductUpdater{constructor(){document.addEventListener("variant:change",this.onVariantChange.bind(this))}async onVariantChange(event){const variantId=event.detail.variant.id,text=await(await fetch(window.location.pathname+"?variant="+variantId)).text(),doc=new DOMParser().parseFromString(text,"text/html");this.updateStockIndicator(doc),this.updateStockPrice(doc),this.updateStickySection(doc)}updateStickySection(doc){const oldTitle=document.querySelector(".titus-sticky-navbar span"),newTitle=doc.querySelector(".titus-sticky-navbar span");oldTitle&&newTitle&&(oldTitle.textContent=newTitle.textContent);const oldInput=document.querySelector('.titus-sticky-navbar input[name="id"]'),newInput=doc.querySelector('.titus-sticky-navbar input[name="id"]');oldInput&&newInput&&(oldInput.value=newInput.value);const oldButton=document.querySelector(".titus-sticky-navbar .add-to-cart-button"),newButton=doc.querySelector(".titus-sticky-navbar .add-to-cart-button");oldButton&&newButton&&oldButton.setAttribute("data-product-id",newButton.getAttribute("data-product-id"))}updateStockIndicator(doc){const oldStockIndicator=document.querySelector(".stock-indicator");if(!oldStockIndicator)return;const newStockIndicator=doc.querySelector(".stock-indicator");oldStockIndicator.parentNode.replaceChild(newStockIndicator,oldStockIndicator)}updateStockPrice(doc){const oldStockPrice=document.querySelector(".add-to-cart");if(!oldStockPrice)return;const newStockPrice=doc.querySelector(".add-to-cart");oldStockPrice.parentNode.replaceChild(newStockPrice,oldStockPrice)}}window.productUpdater||(window.productUpdater=new ProductUpdater),(function(){var isAvailable=!0;function syncZakekeButton(){document.querySelectorAll(".zakeke-product-button").forEach(function(btn
6){btn.disabled=!isAvailable,btn.style.opacity=isAvailable?"":"0.5",btn.style.cursor=isAvailable?"":"not-allowed",btn.style.pointerEvents=isAvailable?"":"none"})}document.addEventListener("variant:change",function(e){var variant=e.detail&&e.detail.variant;isAvailable=variant?!!variant.available:!1,syncZakekeButton()}),document.addEventListener("DOMContentLoaded",function(){var atcBtn=document.querySelector("[data-add-to-cart]");if(atcBtn&&atcBtn.disabled){isAvailable=!1;var obs=new MutationObserver(function(){document.querySelector(".zakeke-product-button")&&(syncZakekeButton(),obs.disconnect())});obs.observe(document.body,{childList:!0,subtree:!0}),syncZakekeButton()}})})();
7//# sourceMappingURL=/cdn/shop/t/526/assets/custom.js.map?v=179820028850128592431788770261

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.