PageSourceSearch

https://hillmalaya.com.hk/cdn/shop/t/40/assets/z__jsAttach.js?v=144913782313326822391787907999

js hillmalaya.com.hk collected 2026-10-07 00:58:12 UTC 5,358 bytes, 2 lines download raw bytes

1(function(){if(window.PXUTheme=window.PXUTheme||{},window.PXUTheme.jsAttach)return;function t(key,fallback){var el=document.querySelector("[data-attach]"),v=el&&el.getAttribute("data-"+key);return v||fallback}function showError(row,message){var el=row.querySelector("[data-attach-error]");el&&(el.textContent=message,el.hidden=!1)}function clearError(row){var el=row.querySelector("[data-attach-error]");el&&(el.hidden=!0,el.textContent="")}function track(event,payload){try{window.dataLayer=window.dataLayer||[];var d={event:event};if(payload)for(var k in payload)Object.prototype.hasOwnProperty.call(payload,k)&&(d[k]=payload[k]);window.dataLayer.push(d)}catch(e){}}function rowInfo(row){var title=row.querySelector(".attach__title");return{attach_product_id:row.getAttribute("data-product-id")||"",attach_product:title?title.textContent.trim():""}}var SEEN_KEY="_attach_seen";function stampCartSeen(){try{var cartUrl=window.PXUTheme.routes&&window.PXUTheme.routes.cart_url||"/cart";fetch(cartUrl+".js",{headers:{"X-Requested-With":"XMLHttpRequest"}}).then(function(r){return r.json()}).then(function(cart){if(!(!cart||!cart.item_count)&&!(cart.attributes&&cart.attributes[SEEN_KEY])){var attrs={};return attrs[SEEN_KEY]=new Date().toISOString().slice(0,10),fetch(cartUrl+"/update.js",{method:"POST",headers:{"Content-Type":"application/json","X-Requested-With":"XMLHttpRequest"},body:JSON.stringify({attributes:attrs})})}}).catch(function(){})}catch(e){}}function watchImpression(){var mod=document.querySelector("[data-attach]");if(!(!mod||!window.IntersectionObserver)){var target=mod.querySelector(".attach__heading")||mod,fired=!1,io=new IntersectionObserver(function(entries){if(!fired){for(var i=0;i<entries.length;i++)if(entries[i].isIntersecting){fired=!0,io.disconnect();var rows=Array.prototype.slice.call(mod.querySelectorAll("[data-attach-row]"));track("attach_impression",{attach_rows:rows.length,attach_product_ids:rows.map(function(r){return r.getAttribute("data-product-id")||""}).join(",")}),stampCartSeen();break}}},{threshold:.5});io.observe(target)}}window.PXUTheme.jsAttach={variantOf:function(row){var btn=row.querySelector("[data-attach-add]"),pinned=btn&&btn.getAttribute("data-variant-id");if(pinned)return pinned;var sel=row.querySelector("[data-attach-size]");return sel&&sel.value||""},orderTypeOf:function(row){var btn=row.querySelector("[data-attach-add]");if(btn&&btn.getAttribute("data-variant-id"))return btn.getAttribute("data-order-type")||"";var sel=row.querySelector("[data-attach-size]"),opt=sel&&sel.selectedIndex>=0?sel.options[sel.selectedIndex]:null;return opt&&opt.getAttribute("data-order-type")||""},onSize:function(sel){var row=sel.closest("[data-attach-row]");if(row){var btn=row.querySelector("[data-attach-add]");btn&&(btn.disabled=!sel.value,btn.textContent=t("add","Add"),btn.classList.remove("is-added"));var opt=sel.options[sel.selectedIndex],img=row.querySelector(".attach__img"),src=opt&&opt.getAttribute("data-image");img&&src&&(img.removeAttribute("srcset"),img.removeAttribute("sizes"),img.src=src),clearError(row),sel.value&&track("attach_select",rowInfo(row))}},add:function(btn){var row=btn.closest("[data-attach-row]");if(row){var variantId=this.variantOf(row);if(variantId){clearError(row),btn.disabled=!0;var cartUrl=window.PXUTheme.routes&&window.PXUTheme.routes.cart_url||"/cart",orderType=this.orderTypeOf(row),body="id="+encodeURIComponent(variantId)+"&quantity=1&properties%5B_attach%5D=1"+(orderType?"&"+encodeURIComponent("properties[Order Type \u8A02\u55AE\u985E\u5225]")+"="+encodeURIComponent(orderType):"");fetch(cartUrl+"/add.js",{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded; charset=UTF-8","X-Requested-With":"XMLHttpRequest"},body:body}).then(function(r){return r.json().then(function(data){if(!r.ok)throw data;return data})}).then(function(item){btn.textContent=t("added","Added"),btn.classList.add("is-added"),window.PXUTheme.jsAjaxCart&&window.PXUTheme.jsAjaxCart.updateView(),track("attach_add",{attach_product_id:item&&item.product_id||"",attach_product:item&&item.product_title||"",attach_variant_id:item&&item.variant_id||"",attach_variant:item&&item.variant_title||"",attach_price:item&&item.price||""}),window.HillmalayaSearchDiscovery&&window.HillmalayaSearchDiscovery.clearCache(),window.HillmalayaRecentlyViewed&&item&&item.product_id&&window.HillmalayaRecentlyViewed.recordAdded({id:item.product_id,handle:item.handle})}
1).catch(function(err){var msg=err&&typeof err.description=="string"&&err.description||t("failed","Couldn't add that \u2014 please pick another size");showError(row,msg);var info=rowInfo(row);info.attach_error=String(msg).slice(0,120),track("attach_add_failed",info);var sel=row.querySelector("[data-attach-size]");btn.disabled=!!(sel&&!sel.value)})}}}},document.readyState==="loading"?document.addEventListener("DOMContentLoaded",function(){watchImpression()}):watchImpression(),document.addEventListener("change",function(e){var sel=e.target.closest?e.target.closest("[data-attach-size]"):null;sel&&window.PXUTheme.jsAttach.onSize(sel)}),document.addEventListener("click",function(e){var btn=e.target.closest?e.target.closest("[data-attach-add]"):null;btn&&(e.preventDefault(),window.PXUTheme.jsAttach.add(btn))})})();
2//# sourceMappingURL=/cdn/shop/t/40/assets/z__jsAttach.js.map?v=144913782313326822391787907999

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.