PageSourceSearch

https://bmola.hk/cdn/shop/t/6/assets/comparable.js?v=102955284606594669881635163230

js bmola.hk collected 2026-10-10 01:53:14 UTC 13,541 bytes, 1 lines download raw bytes

1function comparableInit(){function e(){const t=document.querySelector('[data-behavior="comparison_data"]');if(t){y||(y=t.parentElement);try{const e=JSON.parse(t.dataset.products.replace(/\\([^"\\])/g,"/$1"));L=L.concat(e)}catch(a){console.log(a)}t.remove()}else y||(y=document.querySelector(".grid--view-items"));setInterval(e,1e3)}function t(){function e(t,a=0){if(t===document.body)return{wrap:undefined,deep:a,productCount:0};const o=[...t.querySelectorAll('a[href*="/products/"]')].map(e=>(matchResult=e.href.match(/\/products\/(.+)\??/),matchResult[1].split("#")[0])),c=new Set(o);return c.size>1&&t.querySelectorAll("img").length>1?{wrap:t,deep:a,productCount:c.size}:e(t.parentElement,a+1)}let t=[];[...document.querySelectorAll('a[href*="/products/"]')].forEach(a=>{a.parentElement.querySelector("img")&&(occurrence=e(a),t.find(e=>e.wrap===occurrence.wrap)||t.push(e(a)))}),t.length&&(t.sort((e,t)=>e.deep-t.deep||t.productCount-e.productCount),y=t[0].wrap)}function a(){const e=document.createElement("div");e.className=["comparable-collection-button",comparableConfig.stickyButton.useIcon?"with-icon":"",comparableConfig.stickyButton.position].filter(e=>e).join(" "),e.dataset.behavior="comparable-collection-add-to-compare",e.innerHTML=`\n      <a title="${comparableLocales.collection_compare_btn}">${p()}</a>\n    `,document.body.append(e),e.addEventListener("click",()=>{w?d():(c(),s())})}function o(){window.onpopstate=function(){w&&setTimeout(()=>{y&&!document.body.contains(y)&&(c(),s())},1e3)}}function c(){y&&!document.body.contains(y)&&(y=undefined),y||!(y=document.querySelector(".grid--view-items")||document.querySelector(".product_listing__main")||document.querySelector(".lh-collection-items"))&&t();const e=v.getData();_||(y?[...y.children].filter(e=>e.querySelector('a[href*="/products/"]')||"A"===e.tagName).forEach(t=>{if(!t.querySelector(".comparable-products")){t.classList.add("comparable-products-wrap"),(t=[...t.children].find(e=>e.querySelector("img"))||t.children[0]).classList.add("comparable-products");try{const o=(t.querySelector('a[href*="/products/"]')||"A"===t.tagName&&t).href.match(/.*\/products\/([\S-]+)/),c=decodeURI(o[1].split("?")[0]),i=o[1].split("?")[1];let l=null;if(i){const e=i.match(/variant=(\d+)/);l=e&&e[1]}if(e.length){const a=e.find(e=>e.handle==c&&(!l||e.currentVariantId==l));a&&(n(a,t),a.shownInBar=!0)}t.addEventListener("click",e=>{w&&(e.preventDefault(),e.target.classList.contains("add-to-comparable")||e.target.closest(".add-to-comparable")||r(c,t,l))})}catch(a){console.log(a)}}}):console.log("Comparable: product list is not defined"));let a=!1;e.forEach(e=>{e.shownInBar||(_&&e.handle===decodeURI(_[1])?(n(e,undefined,()=>{h()}),a=!0):n(e))}),_&&!a&&h()}function r(e,t,a=null){function o(o){if(t.classList.contains("in-comparison")){i(t,!1);const o=document.querySelector(`.compare-products-item-${e}-variant-${a}`)||document.querySelector(`.compare-products-item-${e}`);o?o.remove():console.log("Bar element not found"),v.remove(e)}else{const{imageSrc:a}=n(o,t);v.add({id:o.id,title:o.title,imageSrc:a,handle:e,currentVariantId:o.currentVariantId})}}let c=L.find(t=>t.handle==e);c?(a&&c.currentVariantId!==a&&(c={...c,currentVariantId:a}),o(c)):f(e,o,+a)}function n(e,t,a){const o=t&&t.querySelector("img")||{src:""},c=document.createElement("div"),r=o.currentSrc||o.src||e.imageSrc||e.featured_image||"https://cdn.shopify.com/s/images/admin/no-image-compact.gif",n=decodeURI(e.handle);return!document.querySelector(`.compare-products-item-${n}`)||document.querySelector(".variable-products")&&!document.querySelector(`.compare-products-item-${n}-variant-${e.currentVariantId}`)?(c.className="compare-products-item"+` compare-products-item-${n}`+` compare-products-item-${n}-variant-${e.currentVariantId}`,c.innerHTML=`\n      <div class="compare-products-item-content">\n        <img class="compare-products-item-image" src="${r}" />\n        <div class="compare-products-item-text">${e.title.trim()}</div>\n      </div>\n      <div class="compare-products-item-remove-btn" data-behavior="compare-bar-products-item-remove">&#10005;</div>\n    `,document.querySelector('[data-behavior="comparable-bar-products-list"]').prepend(c),c.querySelector('[data-behavior="compare-bar-products-item-remove"]').addEventListener("click",()=>{c.remove(),i(t,!1),v.remove(n),a&&a()}),i(t,!0),{imageSrc:r}):{imageSrc:r}}function i(e,t,a){function o(e){t?e.classList.add("in-comparison"):e.classList.remove("in-comparison")}if(e){o(e);const c=a||e.closest(".comparable-products-wrap")&&e.closest(".comparable-products-wrap").querySelector(".add-to-comparable");c&&(o(c),"checkbox"===c.type&&(c.checked=t))}else a&&o(a)}function l(){const e=document.createElement("div");
1e.className="compare-bar comparable-hidden"+("left"==comparableConfig.styles.barActionsPosition?" reverse-bar":""),e.dataset.behavior="comparable-bar",e.innerHTML=`\n      <div class="compare-products-list-wrapper">\n        <div class="compare-products-list" data-behavior="comparable-bar-products-list"></div>\n      </div>\n      <div class="compare-products-actions">\n        <a class="compare-link" data-behavior="comparable-bar-compare">${comparableLocales.bar_compare_btn}</a>\n        <div class="bottom-actions">\n          <a class="close-bar" data-behavior="comparable-bar-close">${comparableLocales.bar_close_btn}</a>\n          <a class="clear-bar" data-behavior="comparable-bar-clear">\n            <svg viewBox="-40 0 427 427.00131" xmlns="http://www.w3.org/2000/svg" fill="#fff">\n              <path d="m232.398438 154.703125c-5.523438 0-10 4.476563-10 10v189c0 5.519531 4.476562 10 10 10 5.523437 0 10-4.480469 10-10v-189c0-5.523437-4.476563-10-10-10zm0 0"/><path d="m114.398438 154.703125c-5.523438 0-10 4.476563-10 10v189c0 5.519531 4.476562 10 10 10 5.523437 0 10-4.480469 10-10v-189c0-5.523437-4.476563-10-10-10zm0 0"/><path d="m28.398438 127.121094v246.378906c0 14.5625 5.339843 28.238281 14.667968 38.050781 9.285156 9.839844 22.207032 15.425781 35.730469 15.449219h189.203125c13.527344-.023438 26.449219-5.609375 35.730469-15.449219 9.328125-9.8125 14.667969-23.488281 14.667969-38.050781v-246.378906c18.542968-4.921875 30.558593-22.835938 28.078124-41.863282-2.484374-19.023437-18.691406-33.253906-37.878906-33.257812h-51.199218v-12.5c.058593-10.511719-4.097657-20.605469-11.539063-28.03125-7.441406-7.421875-17.550781-11.5546875-28.0625-11.46875h-88.796875c-10.511719-.0859375-20.621094 4.046875-28.0625 11.46875-7.441406 7.425781-11.597656 17.519531-11.539062 28.03125v12.5h-51.199219c-19.1875.003906-35.394531 14.234375-37.878907 33.257812-2.480468 19.027344 9.535157 36.941407 28.078126 41.863282zm239.601562 279.878906h-189.203125c-17.097656 0-30.398437-14.6875-30.398437-33.5v-245.5h250v245.5c0 18.8125-13.300782 33.5-30.398438 33.5zm-158.601562-367.5c-.066407-5.207031 1.980468-10.21875 5.675781-13.894531 3.691406-3.675781 8.714843-5.695313 13.925781-5.605469h88.796875c5.210937-.089844 10.234375 1.929688 13.925781 5.605469 3.695313 3.671875 5.742188 8.6875 5.675782 13.894531v12.5h-128zm-71.199219 32.5h270.398437c9.941406 0 18 8.058594 18 18s-8.058594 18-18 18h-270.398437c-9.941407 0-18-8.058594-18-18s8.058593-18 18-18zm0 0"/><path d="m173.398438 154.703125c-5.523438 0-10 4.476563-10 10v189c0 5.519531 4.476562 10 10 10 5.523437 0 10-4.480469 10-10v-189c0-5.523437-4.476563-10-10-10zm0 0"/>\n            </svg>\n          </a>\n        </div>\n      </div>\n    `,document.body.append(e),document.querySelector('[data-behavior="comparable-bar-compare"]').addEventListener("click",()=>{document.querySelector('[data-behavior="comparable-bar-products-list"]').childElementCount&&(window.location.pathname="/pages/compare")}),document.querySelector('[data-behavior="comparable-bar-close"]').addEventListener("click",()=>{d()}),document.querySelector('[data-behavior="comparable-bar-clear"]').addEventListener("click",()=>{m()})}function s(){w=!0,document.querySelector('[data-behavior="comparable-bar"]').classList.remove("comparable-hidden");const e=document.querySelector('[data-behavior="comparable-collection-add-to-compare"]');e&&e.classList.add("comparable-hidden"),y&&y.classList.add("compare_mode-collection")}function d(){w=!1,document.querySelector('[data-behavior="comparable-bar"]').classList.add("comparable-hidden"),[...document.querySelectorAll('[data-behavior="comparable-collection-add-to-compare"]')].forEach(e=>{e.classList.remove("comparable-hidden"),document.querySelector('[data-behavior="comparable-collection-add-to-compare"] a').innerHTML=p()}),y&&y.classList.remove("compare_mode-collection")}function m(){v.setData([]),[...document.querySelector('[data-behavior="comparable-bar-products-list"]').children].forEach(e=>{e.classList.contains("add-to-compare")||e.remove()}
1),[...document.querySelectorAll(".comparable-products")].forEach(e=>{e.classList.remove("in-comparison")}),document.querySelectorAll(".add-to-comparable").forEach(e=>{e.classList.remove("in-comparison"),"checkbox"===e.type&&(e.checked=!1)})}function p(){const e=v.getData().length;if(comparableConfig.stickyButton.useIcon){const t=e?`<span class='products-count'>${e}</span>`:"",a=comparableConfig.stickyButton.content.includes("text")?`<div class="text-content">${comparableLocales.collection_compare_btn}</div>`:"";return comparableConfig.stickyButton.iconSvg+t+a}{let t=comparableLocales.collection_compare_btn;return e&&(t+=` (${e})`),t}}function u(){function e(){document.querySelectorAll(".add-to-comparable:not(.comparable-inited)").forEach(function(e){e.classList.add("comparable-inited");const a=e.dataset.product;if(t.length){t.find(e=>e.handle==a)&&(e.classList.add("in-comparison"),"checkbox"===e.type&&(e.checked=!0))}const o=()=>{const t=e.closest(".comparable-products-wrap");return t&&t.querySelector(".comparable-products")};e.addEventListener("click",t=>{"checkbox"===t.target.type&&(t.preventDefault(),t.target.checked=e.classList.contains("in-comparison")),f(a,t=>{if(e.classList.contains("in-comparison")){const t=document.querySelector(`.compare-products-item-${a}`);t&&t.remove(),v.remove(a),i(o(),!1,e)}else n(t,o(),()=>{i(o(),!1,e)}),v.add({id:t.id,title:t.title,imageSrc:t.featured_image,handle:a,currentVariantId:null}),i(null,!0,e)}),w||(c(),s())})})}const t=v.getData();e(),setInterval(e,1e3)}function b(e){e||document.querySelectorAll(".add-to-comparable").forEach(e=>e.remove())}function h(){if(!g||document.querySelector('[data-behavior="add-to-compare"]'))return;const e=document.createElement("div");e.className="compare-products-item add-to-compare",e.innerHTML=`\n      <div class="compare-products-item-content" data-behavior="add-to-compare">\n        <span>${comparableLocales.bar_add_to_compare_btn}</span>\n      </div>\n    `,document.querySelector('[data-behavior="comparable-bar-products-list"]').prepend(e),e.querySelector('[data-behavior="add-to-compare"]').addEventListener("click",()=>{function e(e){let t;const a=window.location.search.match(/variant=(\d+)/);t=a?a[1]:(e.variants.find(e=>e.available)||e.variants[0]).id;const o={id:e.id,title:e.title,imageSrc:e.featured_image,handle:e.handle,currentVariantId:t};v.add(o),n(o,undefined,()=>{h()}),document.querySelector('[data-behavior="add-to-compare"]').parentElement.remove()}S?e(S):"undefined"!=typeof fetch?fetch(_[0]+".js").then(e=>e.json()).then(t=>{e(S=t)}):$.getJSON(_[0]+".js",function(t){e(S=t)})})}function f(e,t,a){let o=E.find(t=>t.handle===e);if(o)a&&(o={...o,currentVariantId:a}),t(o);else{let o=`/products/${e}`;"undefined"!=typeof fetch?fetch(o+".js").then(e=>e.json()).then(e=>{t&&(a&&(e={...e,currentVariantId:a}),t(e)),E.push(e)}):$.getJSON(o+".js",function(e){t&&t(e),E.push(e)})}}if(!comparableConfig.enabled||comparableInit.inited)return;comparableInit.inited=!0;const v=new SessionData({sessionKey:"comparableProducts"}),g=comparableConfig.enableStickyButton;let y,S,q=!1,w=!1,L=[],E=[];const I=window.location.pathname.match(/.*\/collections\/([\w\d-%]+)/)||decodeURI(window.location.pathname).match(/.*\/collections\/((\w|[^\x00-\x7F]|-)+)/),C=I&&!window.location.pathname.match(/.*\/products\//),_=window.location.pathname.match(/.*\/products\/([\w\d-%]+)/),k=comparableConfig.enablePages.enableOnHomepage&&!window.location.pathname.match(/(collections|pages|products)/);if(_&&comparableConfig.enablePages.enableOnProductPages)try{const e=document.querySelector(".product-single__meta");if(e){const t=e.dataset.collections;t&&!t.split(",").includes("b-mola")&&(comparableConfig.enablePages.enableOnProductPages=!1)}}catch(D){console.log(`Custom: ${D}`)}(C&&(comparableConfig.enablePages.enableOnAllCollections||comparableConfig.enablePages.exceptCollections.includes(I[1]))||k)&&(e(),g&&(a(),l(),b(q)),g&&!q||u(),l(),o()),_&&comparableConfig.enablePages.enableOnProductPages&&(g&&(a(),b(q)),g&&!q||u(),l())}class SessionData{constructor(e){this.sessionKey=e.sessionKey}getData(){const e=localStorage.getItem(this.sessionKey);return e&&JSON.parse(e)||[]}setData(e){localStorage.setItem(this.sessionKey,JSON.stringify(e))}add(e){const t=this.getData();t.push(e),this.setData(t)}remove(e){const t=this.getData().filter(t=>t.handle!==e);this.setData(t)}}document.addEventListener("DOMContentLoaded",function(){function e(){const e=document.querySelector('[data-behavior="comparison_data"]');e&&e.remove(),document.querySelectorAll(".add-to-comparable").forEach(e
1=>e.remove())}if("undefined"!=typeof comparableConfig&&comparableConfig.enabled&&document.head.innerText.match(/comparable-loader.js/))try{comparableInit()}catch(t){console.log(t),e()}else 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.