1class dT_CompareList{constructor(){this.CompareListData=[],this.LOCAL_STORAGE_CompareLIST_KEY="shopify-Comparelist",this.LOCAL_STORAGE_DELIMITER=","}setListLocalStorageKey(LOCAL_STORAGE_CompareLIST_KEY,LOCAL_STORAGE_DELIMITER){this.LOCAL_STORAGE_CompareLIST_KEY=LOCAL_STORAGE_CompareLIST_KEY,this.LOCAL_STORAGE_DELIMITER=LOCAL_STORAGE_DELIMITER}setupGrid(listType){var Comparelist=this.getComparelist(),requests=Comparelist.map(function(handle){var productTileTemplateUrl="/products/"+handle+"?view=json",getProductsList=this.getProductResponse(productTileTemplateUrl);return getProductsList}.bind(this));return Promise.all(requests).then(function(responses){var ComparelistProductCards=responses.join("%$$%"),ComparelistProductCards=ComparelistProductCards,a_ComparelistRecords=ComparelistProductCards.split("%$$%");let recordsObj=[];if(Array.isArray(a_ComparelistRecords)&&a_ComparelistRecords.length){var index=0;a_ComparelistRecords.forEach(record=>{var a_record=record.split("~~"),recordObj={id:a_record[0],product_title:a_record[1],product_handle:a_record[2],product_image:a_record[3],vendor:a_record[4],type:a_record[5],money_price:a_record[6],price_min:a_record[7],price_max:a_record[8],available:a_record[9],price_varies:a_record[10],variant_id:a_record[11],variant_title:a_record[12],sku:a_record[13],description:a_record[14],quantity:"1",product_url:"/products/"+a_record[2]};recordsObj[index]=recordObj,index=index+1})}return recordsObj}).then(function(data){return this.CompareListData=data,data}.bind(this))}getCompareListRecords(){return this.CompareListData}getProductResponse(url){var responseResult=fetch(url).then(response=>response.text()).then(data=>data.replace(/^\s*[\r\n]/gm,""));return responseResult}getTotalCount(){return this.getComparelist().length}getComparelist(){var Comparelist=localStorage.getItem(this.LOCAL_STORAGE_CompareLIST_KEY)||!1;return Comparelist?Comparelist.split(this.LOCAL_STORAGE_DELIMITER):[]}setComparelist(array){var Comparelist=array.join(this.LOCAL_STORAGE_DELIMITER);return array.length?localStorage.setItem(this.LOCAL_STORAGE_CompareLIST_KEY,Comparelist):localStorage.removeItem(this.LOCAL_STORAGE_CompareLIST_KEY),Comparelist}updateComparelist(handle){var Comparelist=this.getComparelist(),indexInComparelist=Comparelist.indexOf(handle);return indexInComparelist===-1?Comparelist.push(handle):Comparelist.splice(indexInComparelist,1),this.setComparelist(Comparelist)}removeComparet(handle){var Comparelist=this.getComparelist();return Comparelist=this.remove(Comparelist,handle),this.setComparelist(Comparelist)}resetComparelist(){return this.setComparelist([])}isAddedIntoList(handle){var Comparelist=this.getComparelist();return Comparelist.includes(handle)}remove(arr){for(var what,a=arguments,L=a.length,ax;L>1&&arr.length;)for(what=a[--L];(ax=arr.indexOf(what))!==-1;)arr.splice(ax,1);return arr}}async function getDTProduct(url){try{return(await fetch(url)).text().then(function(text){return text})}catch(error){console.log(error)}}class dTXCompare extends HTMLElement{constructor(){super(),this.dTCompareList=new dT_CompareList,this.dTCompareList.setListLocalStorageKey("dt-compare-list",","),this.debouncedOnSubmit=debounce(event=>{this.onSubmitHandler(event)},500),this.addCompareList=this.querySelector(".add-compare"),this.productHandle=this.addCompareList.getAttribute("data-product_handle"),this.addCompareList.addEventListener("click",this.debouncedOnSubmit.bind(this)),this.initLoad()}onSubmitHandler(event){if(event.preventDefault(),this.dTCompareList.isAddedIntoList(this.productHandle))window.location="/pages/compare";else{const CompTotal=this.dTCompareList.getTotalCount();if(console.log("CompTotal=="+CompTotal),CompTotal>3){var CompareModal=document.getElementById("compareModal"),XBtn=document.getElementById("compareModalClose");document.querySelector("body").classList.add("alert-overlay-wrapper"),CompareModal.style.display="block",XBtn.onclick=function(){CompareModal.style.display="none",document.querySelector("body").classList.remove("alert-overlay-wrapper")},console.log("LastAdded=="+this.productHandle);const AnItem=this.productHandle;delete localStorage.AnItem;return}else this.addCompareList.classList.add("adding"),this.dTCompareList.updateComparelist(this.productHandle),setTimeout(this.postAdd.bind(this),1e3)}}postAdd(){var dtxCount=document.getElementsByClassName("dtxc-compare-count");dtxCount.length>0&&document.querySelector(".dtxc-compare-count").setAttribute("count",this.dTCompareList.getTotalCount()),this.addCompareList.classList.remove("adding"),this.addCompareList.classList.add("added")}initLoad(){this.dTCompareList.isAddedIntoList(this.productHandle)&&this.addCompareList.classList.add("added")}}customElements.define("dtx-compare",dTXCompare);class dTXComparetGrid extends HTMLElement{constructor(){super(),this.gridTemplate=this.querySelector(".grid_template"),this.dtxTable=this.querySelector(".dtx-table"),this.dtxNoRecord=this.querySelector(".dtx-grid-empty"),this.grid_type=this.getAttribute("grid_type")}initLoad(){var dTCompareList=new dT_CompareList;this.grid_type=="compareList"&&dTCompareList.setListLocalStorageKey("dt-compare-list",","),dTCompareList.setupGri
1d().then(function(data){return this.generateGrid(data),data}.bind(this));var dtxCount=document.getElementsByClassName("grid-count-bubble");console.log(dtxCount)}generateGrid(a_records){var data=this.gridTemplate.innerHTML;typeof a_records[0].product_handle<"u"?a_records.length>0&&(a_records.forEach(function(record){var newRow=this.dtxTable.insertRow(this.dtxTable.rows.length);newRow.id="row_"+record.id,newRow.innerHTML=this.buidRow(record)}.bind(this)),this.dtxNoRecord.classList.add("dtx-grid-hide"),this.dtxTable.classList.add("dtx-grid-show")):(this.dtxTable.classList.add("dtx-grid-hide"),this.dtxNoRecord.classList.add("dtx-grid-show"))}buidRow(record){var templateData=this.gridTemplate.innerHTML;return templateData=templateData.replace(/{item.product_handle}/gi,record.product_handle),templateData=templateData.replace(/{item.product_url}/gi,record.product_url),templateData=templateData.replace(/{item.product_image}/gi,record.product_image),templateData=templateData.replace(/{item.product_title}/gi,record.product_title),templateData=templateData.replace(/{item.money_price}/gi,record.money_price),templateData=templateData.replace(/{item.variant_id}/gi,record.variant_id),record.type?templateData=templateData.replace(/{item.product_type}/gi,record.type):templateData=templateData.replace(/{item.product_type}/gi,"Nil"),record.sku?templateData=templateData.replace(/{item.product_sku}/gi,record.sku):templateData=templateData.replace(/{item.product_sku}/gi,"Nil"),record.vendor?templateData=templateData.replace(/{item.product_vendor}/gi,record.vendor):templateData=templateData.replace(/{item.product_vendor}/gi,"Nil"),templateData=templateData.replace(/{item.product_description}/gi,record.description),record.available=="true"?templateData=templateData.replace(/{item.available}/gi,"In Stock"):templateData=templateData.replace(/{item.available}/gi,"Sold Out"),templateData}connectedCallback(){this.initLoad()}}customElements.define("dtx-compare-grid",dTXComparetGrid);class dTXRemoveCompareItem extends HTMLElement{constructor(){super(),this.removeItem=this.querySelector(".remove-item"),this.debouncedOnSubmit=debounce(event=>{this.removeListItem(event)},500),this.grid_type=this.getAttribute("grid_type"),this.productHandle=this.removeItem.getAttribute("data-product_handle"),this.removeItem.addEventListener("click",this.debouncedOnSubmit.bind(this))}removeListItem(event){event.preventDefault();var dTCompareList=new dT_CompareList;this.grid_type=="compareList"&&dTCompareList.setListLocalStorageKey("dt-compare-list",","),dTCompareList.removeComparet(this.productHandle),window.location.reload()}}customElements.define("dtx-remove-compare-item",dTXRemoveCompareItem);class dTXCompareCount extends HTMLElement{static get observedAttributes(){return["count"]}constructor(){super(),this.gridCountBubble=this.querySelector(".grid-count-bubble"),this.grid_type=this.getAttribute("grid_type"),this.initLoad()}initLoad(){var dTCompareList=new dT_CompareList;this.grid_type=="compareList"&&dTCompareList.setListLocalStorageKey("dt-compare-list",",");var totalCount=dTCompareList.getTotalCount();this.gridCountBubble.querySelector("span").innerHTML=totalCount}attributeChangedCallback(name,oldValue,newValue){this.initLoad()}}customElements.define("dtx-compare-count",dTXCompareCount); 2//# sourceMappingURL=/cdn/shop/t/15/assets/dt_compare.js.map?v=163467864250343670201751355260
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.