Numour Aria: All In One Smart Facial Device
`form[action*=’/${t}’]:not([data-nocaptcha=’true’]) input[name=’form_type’][value=’${e}’]`)).join(‘,’),a=t=>()=>t?[…document.querySelectorAll(t)].map((t=>t.form)):[];function s(){const t=[…o],e=r(t);return a(e)}const i=’password’,u=’form_key’,d=[‘recaptcha-v3-token’,’g-recaptcha-response’,’h-captcha-response’,i],f=()=>{try{return window.sessionStorage}catch{return}},m=’__shopify_v’,_=t=>t.elements[u];function p(t,e,n=!1){try{const o=window.sessionStorage,c=JSON.parse(o.getItem(e)),{data:r}=function(t){const{data:e,action:n}=t;return t[m]||n?{data:e,action:n}:{data:t,action:n}}(c);for(const[e,n]of Object.entries(r))t.elements[e]&&(t.elements[e].value=n);n&&o.removeItem(e)}catch(o){console.error(‘form repopulation failed’,{error:o})}}const l=’form_type’,E=’cptcha’;function T(t){t.dataset[E]=!0}const w=window,h=w.document,L=’Shopify’,v=’ce_forms’,y=’captcha’;let A=!1;((t,e)=>{const n=(g=’f06e6c50-85a8-45c8-87d0-21a2b65856fe’,I=’https://cdn.shopify.com/shopifycloud/storefront-forms-hcaptcha/ce_storefront_forms_captcha_hcaptcha.v1.5.2.iife.js’,D={infoText:’Protected by hCaptcha’,privacyText:’Privacy’,termsText:’Terms’},(t,e,n)=>{const o=w[L][v],c=o.bindForm;if(c)return c(t,g,e,D).then(n);var r;o.q.push([[t,g,e,D],n]),r=I,A||(h.body.append(Object.assign(h.createElement(‘script’),{id:’captcha-provider’,async:!0,src:r})),A=!0)});var g,I,D;w[L]=w[L]||{},w[L][v]=w[L][v]||{},w[L][v].q=[],w[L][y]=w[L][y]||{},w[L][y].protect=function(t,e){n(t,void 0,e),T(t)},Object.freeze(w[L][y]),function(t,e,n,w,h,L){const[v,y,A,g]=function(t,e,n){const i=e?o:[],u=t?c:[],d=[…i,…u],f=r(d),m=r(i),_=r(d.filter((([t,e])=>n.includes(e))));return[a(f),a(m),a(_),s()]}(w,h,L),I=t=>{const e=t.target;return e instanceof HTMLFormElement?e:e&&e.form},D=t=>v().includes(t);t.addEventListener(‘submit’,(t=>{const e=I(t);if(!e)return;const n=D(e)&&!e.dataset.hcaptchaBound&&!e.dataset.recaptchaBound,o=_(e),c=g().includes(e)&&(!o||!o.value);(n||c)&&t.preventDefault(),c&&!n&&(function(t){try{if(!f())return;!function(t){const e=f();if(!e)return;const n=_(t);if(!n)return;const o=n.value;o&&e.removeItem(o)}(t);const e=Array.from(Array(32),(()=>Math.random().toString(36)[2])).join(”);!function(t,e){_(t)||t.append(Object.assign(document.createElement(‘input’),{type:’hidden’,name:u})),t.elements[u].value=e}(t,e),function(t,e){const n=f();if(!n)return;const o=[…t.querySelectorAll(`input[type=’${i}’]`)].map((({name:t})=>t)),c=[…d,…o],r={};for(const[a,s]of new FormData(t).entries())c.includes(a)||(r[a]=s);n.setItem(e,JSON.stringify({[m]:1,action:t.action,data:r}))}(t,e)}catch(e){console.error(‘failed to persist form’,e)}}(e),e.submit())}));const S=(t,e)=>{t&&!t.dataset[E]&&(n(t,e.some((e=>e===t))),T(t))};for(const o of[‘focusin’,’change’])t.addEventListener(o,(t=>{const e=I(t);D(e)&&S(e,y())}));const B=e.get(‘form_key’),M=e.get(l),P=B&&M;t.addEventListener(‘DOMContentLoaded’,(()=>{const t=y();if(P)for(const e of t)e.elements[l].value===M&&p(e,B);[…new Set([…A(),…v().filter((t=>’true’===t.dataset.shopifyCaptcha))])].forEach((e=>S(e,t)))}))}(h,new URLSearchParams(w.location.search),n,t,e,[‘guest_login’])})(!0,!0)}();]]> Numour Aria: All In One Smart Facial Device { this.queryParams[key] = value; }) } this.money_format = “u003cspan class=mw-priceu003e₹{{amount}}u003c/spanu003e”, this.money_with_currency_format = “u003cspan class=mw-priceu003e₹{{amount}} INRu003c/spanu003e”, this.currencyCodeEnabled = true, this.formatMoney=function(t,e){const r=this.currencyCodeEnabled?this.money_with_currency_format:this.money_format;function a(t,e){return void 0===t?e:t}function o(t,e,r,o){if(e=a(e,2),r=a(r,”,”),o=a(o,”.”),isNaN(t)||null==t)return 0;var n=(t=(t/100).toFixed(e)).split(“.”);return n[0].replace(/(d)(?=(ddd)+(?!d))/g,”$1″+r)+(n[1]?o+n[1]:””)}”string”==typeof t&&(t=t.replace(“.”,””));var n=””,i=/{{s*(w+)s*}}/,s=e||r;switch(s.match(i)[1]){case”amount”:n=o(t,2);break;case”amount_no_decimals”:n=o(t,0);break;case”amount_with_comma_separator”:n=o(t,2,”.”,”,”);break;case”amount_with_space_separator”:n=o(t,2,” “,”,”);break;case”amount_with_period_and_space_separator”:n=o(t,2,” “,”.”);break;case”amount_no_decimals_with_comma_separator”:n=o(t,0,”.”,”,”);break;case”amount_no_decimals_with_space_separator”:n=o(t,0,” “);break;case”amount_with_apostrophe_separator”:n=o(t,2,”‘”,”.”)}return s.replace(i,n)},this.resizeImage=function(t,e){try{if(!e||”original”==e||”full”==e||”master”==e)return t;if(-1!==t.indexOf(“cdn.shopify.com”)||-1!==t.indexOf(“/cdn/shop/”)){var r=t.match(/.(jpg|jpeg|gif|png|bmp|bitmap|tiff|tif|webp)((#[0-9a-z-]+)?(?v=.*)?)?$/gim);if(null==r)return null;var a=t.split(r[0]),o=r[0];return a[0]+”_”+e+o}}catch(r){return t}return t},this.getProduct=function(t){if(!t)return!1;let e=(“/”===this.routes.root_url?””:this.routes.root_url)+”/products/”+t+”.js?shop=”+Shopify.shop;return window.ECOM_LIVE&&(e=”/shop/builder/ajax/ecom-proxy/products/”+t+”?shop=”+Shopify.shop),window.fetch(e,{headers:{“Content-Type”:”application/json”}}).then(t=>t.ok?t.json():false)}; const urlParams = new URLSearchParams(window.location.search); if (urlParams.has(‘ecom-redirect’)) { const redirectUrl = decodeURIComponent(urlParams.get(‘ecom-redirect’)); window.location.href = redirectUrl; } }).bind(window.EComposer)(); if(window.Shopify && window.Shopify.designMode && window.top && window.top.opener){ window.addEventListener(“load”, function(){ window.top.opener.postMessage({ action: “ecomposer:loaded”, }, “*”); }); } ]]> 0) { qv_buttons.forEach(function(button, index) { button.addEventListener(‘click’, quickViewHandler) }) } } } }).bind(window.EComposer)(); ]]> <![CDATA[ ]]> response.json()) .then(data => { const checkPlan = data?.howTo?.turnOn || data?.recipe?.turnOn || data?.faq?.turnOn || data?.video?.turnOn; if(!checkPlan){ return; } let schemaList = []; for (const property in data) { let schemaData = {}; if(property == ‘article’ || property == ‘siteLink’ || property == ‘breadcrumb’ || property == ‘product’){ continue; } const configs = data[property].pageList || []; const configMatchList = configs.filter(config => { return config.pageData.handle == tpPageHandle; }); const configMatch = configMatchList[0] || {}; const turnon = configMatch?.turnOn; if(!turnon) { continue; }; if(property == ‘faq’){ schemaData = { “@context”: “https://schema.org”, “@type”: “FAQPage”, “mainEntity”: configMatch[`faqList`].map(configType => { if(property == ‘faq’){ return { “@type”: “Question”, “name”: configType?.name, “acceptedAnswer”: { “@type”: “Answer”, “text”: configType?.text } } } }) } schemaList.push(schemaData || {}); } if(property == ‘video’){ const configType = configMatch?.videoConfig || {}; schemaData = { “@context”: “https://schema.org”, “@type”: “VideoObject”, “name”: configType?.title, “description”: configType?.description, “thumbnailUrl”: configType?.imageUrl, “uploadDate”: configType?.uploadDate, “duration”: configType?.duration, “contentUrl”: configType?.videoUrl, } schemaList.push(schemaData || {}); } if(property == ‘howTo’){ const configType = configMatch?.howToConfig || {}; schemaData = { “@context”: “https://schema.org”, “@type”: “HowTo”, “image”: { “@type”: “ImageObject”, “url”: configType?.imageUrl[0], }, “name”: configType?.title, “totalTime”: configType?.duration, “estimatedCost”: { “@type”: “MonetaryAmount”, “currency”: configType?.currency?.match(/((.*))/)[1], “value”: configType?.estimatedCost }, “supply”: configType?.supply?.map(supply => { return { “@type”: “HowToSupply”, “name”: supply.name } }), “tool”: configType?.tool?.map(supply => { return { “@type”: “HowToTool”, “name”: supply.name } }), “step”: configType?.sectionStep?.stepValue?.map(step => { return { “@type”: “HowToStep”, “name”: step?.name, “text”: step?.description, “image”: step?.imageUrl?.length > 0 ? step?.imageUrl[0] : ”, “url”: step?.stepUrl } }) } if(configType?.sectionVideo?.title && configType?.sectionVideo?.uploadDate && configType?.sectionVideo?.imageUrl[0]){ const videoSchema = { “@type”: “VideoObject”, “name”: configType?.sectionVideo?.title, “description”: configType?.sectionVideo?.description, “thumbnailUrl”: configType?.sectionVideo?.imageUrl[0], “uploadDate”: configType?.sectionVideo?.uploadDate, “duration”: configType?.sectionVideo?.duration, “contentUrl”: configType?.sectionVideo?.videoUrl, } schemaData.video = videoSchema; } schemaList.push(schemaData || {}); } if(property == ‘recipe’){ const configType = configMatch?.recipeConfig || {}; schemaData = { “@context”: “https://schema.org/”, “@type”: “Recipe”, “name”: configType?.name, “image”: [ configType?.imageUrls?.small?.length > 0 ? configType?.imageUrls?.small[0] : ”, configType?.imageUrls?.medium?.length > 0 ? configType?.imageUrls?.medium[0] : ”, configType?.imageUrls?.large?.length > 0 ? configType?.imageUrls?.large[0] : ”, ], “author”: { “@type”: “Person”, “name”: configType?.author }, “datePublished”: configType?.uploadDate, “description”: configType?.description, “recipeCuisine”: configType?.cuisine, “prepTime”: configType?.prepTime, “cookTime”: configType?.cookTime, “totalTime”: “”, “keywords”: configType?.keywords, “recipeYield”: configType?.totalServings, “recipeCategory”: configType?.category, “nutrition”: { “@type”: “NutritionInformation”, “calories”: configType?.caloriesPerServing }, “recipeIngredient”: configType?.ingredients?.map(ingredient => { return ingredient }), “recipeInstructions”: configType?.sectionStep?.stepValue?.map(step => { return { “@type”: “HowToStep”, “name”: step?.name, “text”: step?.description, “image”: step?.imageUrl?.length > 0 ? step?.imageUrl[0] : ”, “url”: step?.stepUrl } }) } if(configType?.sectionVideo?.title && configType?.sectionVideo?.uploadDate && configType?.sectionVideo?.imageUrl[0]){ const videoSchema = { “@type”: “VideoObject”, “name”: configType?.sectionVideo?.title, “description”: configType?.sectionVideo?.description, “thumbnailUrl”: configType?.sectionVideo?.imageUrl[0], “uploadDate”: configType?.sectionVideo?.uploadDate, “duration”: configType?.sectionVideo?.duration, “contentUrl”: configType?.sectionVideo?.videoUrl, } schemaData.video = videoSchema; } schemaList.push(schemaData || {}); } } return schemaList; }) .then(data =>{ if(!data) return; data.map(schema => { scriptEl.innerHTML = JSON.stringify(data); }) }) .then(() => { if (scriptEl.innerHTML) document.head.appendChild(scriptEl) }); } ]]> { const metaTag = document.createElement(‘meta’); metaTag.setAttribute(‘name’, ‘description’); metaTag.setAttribute(‘content’, descriptionValue); const headTag = document.querySelector(‘head’); headTag.appendChild(metaTag); } const replaceMetaTagContent = (titleValue, descriptionValue, needReplaceVar) => { const disableReplacingTitle = !!window._tpt_no_replacing_plain_title const disableReplacingDescription = !!window._tpt_no_replacing_plain_desc const config = { attributes: true, childList: true, subtree: true}; const header = document.getElementsByTagName(‘head’)[0]; let i = 0; const callback = (mutationList, observer) => { i++; const title = document.getElementsByTagName(‘title’)[0]; const ogTitle = document.querySelector(‘meta[property=”og:title”]’); const twitterTitle = document.querySelector(‘meta[name=”twitter:title”]’); const newTitle = needReplaceVar ? replaceVar(titleValue) : titleValue; const newDescription = needReplaceVar ? replaceVar(descriptionValue) : descriptionValue; if(document && document.title != newTitle && !disableReplacingTitle){ document.title = newTitle; } if(ogTitle && (ogTitle?.content != newTitle)){ ogTitle?.setAttribute(‘content’, newTitle); } if(twitterTitle && (twitterTitle?.content != newTitle)){ twitterTitle?.setAttribute(‘content’, newTitle); } const metaDescriptionTagList = document.querySelectorAll(‘meta[name=”description”]’); const ogDescriptionTagList = document.querySelector(‘meta[property=”og:description”]’); const twitterDescriptionTagList = document.querySelector(‘meta[name=”twitter:description”]’); try { if(ogDescriptionTagList && newDescription && (ogDescriptionTagList?.content != newDescription)) { ogDescriptionTagList?.setAttribute(‘content’, newDescription); } if(twitterDescriptionTagList && newDescription && (twitterDescriptionTagList?.content != newDescription)){ twitterDescriptionTagList?.setAttribute(‘content’, newDescription); } } catch (err) { } if(metaDescriptionTagList?.length == 0){ try { createMetaTag(descriptionValue); } catch (err) { // } } metaDescriptionTagList?.forEach(metaDescriptionTag=>{ if(metaDescriptionTag.content != newDescription && !disableReplacingDescription){ metaDescriptionTag.content = newDescription; } }) if(observer && i > 1000){ observer.disconnect(); } }; callback(); setTimeout(callback, 100); const observer = new MutationObserver(callback); if(observer){ observer.observe(header, config); } } if (tptMetaDataConfigUrl) { fetch(tptMetaDataConfigUrl) .then(response => response.json()) .then((data) => { if(!data) return; const language = document.documentElement.lang || ‘en’; let languageMeta = false; if (data.metaData && data.metaData[language]) { languageMeta = data.metaData[language]; } else { if (data.metaData) { languageMeta = data.metaData; } else { languageMeta = {}; } } const productTitle = languageMeta.products?.meta_title_value || ”; const productDescription = languageMeta.products?.meta_description_value || ”; const productTurnOn = data?.metaData?.turnOnObject?.products || data?.metaData?.products?.turnOn || false; const collectionTitle = languageMeta.collections?.meta_title_value || ”; const collectionDescription = languageMeta.collections?.meta_description_value || ”; const collectionTurnOn = data?.metaData?.turnOnObject?.collections || data?.metaData?.collections?.turnOn || false; const articleTitle = languageMeta.articles?.meta_title_value || ”; const articleDescription = languageMeta.articles?.meta_description_value || ”; const articleTurnOn = data?.metaData?.turnOnObject?.articles || data?.metaData?.collections?.turnOn || false; if (window.tapita_meta_page_title || window.tapita_meta_page_description) { replaceMetaTagContent(window.tapita_meta_page_title, window.tapita_meta_page_description, false); } else { if(productTurnOn){ if(pageTypeMeta == ‘product’){ replaceMetaTagContent(productTitle, productDescription, true); } } if(collectionTurnOn){ if(pageTypeMeta == ‘collection’){ replaceMetaTagContent(collectionTitle, collectionDescription, true); } } if(articleTurnOn){ if(pageTypeMeta == ‘article’){ replaceMetaTagContent(articleTitle, articleDescription, true); } } } const instantPage = data?.instantPage || false; const excludedPaths = [ ‘/cart’, ‘/checkout’, ‘/account’, ‘/account/login’, ‘/account/logout’ ]; if (!window.FPConfig || !window.FPConfig.ignoreKeywords || !Array.isArray(window.FPConfig.ignoreKeywords)) { window.FPConfig = { ignoreKeywords : excludedPaths }; } else { window.FPConfig.ignoreKeywords = window.FPConfig.ignoreKeywords.concat(excludedPaths); } var toEnableInstantPageByPath = true; if (window.location.pathname && window.location.pathname.includes) { excludedPaths.forEach(excludedPath => { if (window.location.pathname.includes(excludedPath)) { toEnableInstantPageByPath = false; } }); } if (window.document && window.document.location && window.document.location.pathname && window.document.location.pathname.includes) { excludedPaths.forEach(excludedPath => { if (window.document.location.pathname.includes(excludedPath)) { toEnableInstantPageByPath = false; } }); } if(instantPage && toEnableInstantPageByPath){ const tptAddInstantPage = setInterval(function () { if(document && document.body){ var instantScript = document.createElement(‘script’); instantScript.src = instantPageUrl; document.body.appendChild(instantScript); clearInterval(tptAddInstantPage); }}, 500); } }); } else { if (window.tapita_meta_page_title || window.tapita_meta_page_description) { replaceMetaTagContent(window.tapita_meta_page_title, window.tapita_meta_page_description, false); } } ]]> <![CDATA[ (function () { var customDocumentWrite = function(content) { var jquery = null; if (window.jQuery) { jquery = window.jQuery; } else if (window.Checkout && window.Checkout.$) { jquery = window.Checkout.$; } if (jquery) { jquery('body').append(content); } }; var hasLoggedConversion = function(token) { if (token) { return document.cookie.indexOf('loggedConversion=' + token) !== -1; } return false; } var setCookieIfConversion = function(token) { if (token) { var twoMonthsFromNow = new Date(Date.now()); twoMonthsFromNow.setMonth(twoMonthsFromNow.getMonth() + 2); document.cookie = 'loggedConversion=' + token + '; expires=' + twoMonthsFromNow; } } var trekkie = window.ShopifyAnalytics.lib = window.trekkie = window.trekkie || []; if (trekkie.integrations) { return; } trekkie.methods = [ 'identify', 'page', 'ready', 'track', 'trackForm', 'trackLink' ]; trekkie.factory = function(method) { return function() { var args = Array.prototype.slice.call(arguments); args.unshift(method); trekkie.push(args); return trekkie; }; }; for (var i = 0; i Skip to content <!– Google Tag Manager (noscript) End Google Tag Manager (noscript) –>
- Choosing a selection results in a full page refresh.
- Opens in a new window.
<![CDATA[ (function() { const ecom_announcement_bar = document.querySelector(".ecom-announcementbar"); if(!ecom_announcement_bar) return; const expiration_el = ecom_announcement_bar.querySelector("input[name='expiration_date']"), close_btn = ecom_announcement_bar.querySelector(".ecom-announcementbar__close"), contentItems = ecom_announcement_bar.querySelectorAll('.ecom-announcementbar__text–item'), day_el = ecom_announcement_bar.querySelectorAll(".ecom-announcementbar__countdown-days"), hour_el = ecom_announcement_bar.querySelectorAll(".ecom-announcementbar__countdown-hours"), minute_el = ecom_announcement_bar.querySelectorAll(".ecom-announcementbar__countdown-minutes"), second_el = ecom_announcement_bar.querySelectorAll(".ecom-announcementbar__countdown-seconds"); let time_change = "4s"; if(time_change!=''){ time_change = parseInt(time_change)*1000; } else{ time_change = 4000; } if(contentItems){ changeContent(contentItems); } function changeContent(contents){ let count = 0; changeText = setInterval(function(){ count++; contents.forEach(function(content, index){ if(count == contents.length){ count=0; } if(index == count){ content.classList.add('is-selected'); } else{ content.classList.remove('is-selected'); } }); const contentItems = ecom_announcement_bar.querySelectorAll('.ecom-announcementbar__text–item'); if(contentItems.length == 0){ clearInterval(changeText); } }, time_change); } if(expiration_el) { let ecom_announcementbar = getCookie("ecom-announcementbar"); let ver = ecom_announcement_bar.getAttribute("data-ver"); //get latest update version code let cookie_ver = getCookie("ecom-announcementbar-ver"); if(JSON.stringify(ver)===cookie_ver) return; var countDownDate = new Date(expiration_el.value).getTime(); let days = -1, hours = -1, minutes = -1, seconds = -1; var init_countdown = setInterval(function() { // Get today's date and time var now = new Date().getTime(); // Find the distance between now and the count down date var distance = countDownDate – now; //hidden announcement bar if it can find element with data-expired="true" if(document.querySelector('.ecom-announcementbar[data-expired="true"]') && distance <= 0) { ecom_announcement_bar.classList.remove('ecom-show'); clearInterval(init_countdown); } if(!document.querySelector('.ecom-announcementbar[data-expired="true"]')){ ecom_announcement_bar.classList.add('ecom-show'); } if(distance 0) { if(days_cal < 10) { item.innerHTML = "0" + days_cal; } else { item.innerHTML = days_cal; } } else if (days_cal 0) { if(hours_cal < 10) { item.innerHTML = "0" + hours_cal; } else { item.innerHTML = hours_cal; } } else if (hours_cal 0) { if(minutes_cal < 10) { item.innerHTML = "0" + minutes_cal; } else { item.innerHTML = minutes_cal; } } else if (minutes_cal 0) { if(seconds_cal < 10) { item.innerHTML = "0" + seconds_cal; } else { item.innerHTML = seconds_cal; } } else if (seconds_cal 1) { buttonLabel = ` View Detail`; link = `/products/${product.handle}`; } else if(product.available){ buttonLabel = ` Add to cart`; link = `/cart/add?id=${product.variants[0].id}&quantity=1`; } else { buttonLabel = ` Sold out`; link = “; } var price = window.EComposer.formatMoney(product.price); var compare_at_price = product.compare_at_price ? window.EComposer.formatMoney(product.compare_at_price) : ”; var product_html = ` Remove ${product.title} ${price} ${compare_at_price} ${des_html} ${buttonLabel} `; product_row_base.insertAdjacentHTML(‘beforeend’, product_html); var instock_svg = ` `; var outstock_svg = ` `; var availability_html = ` ${instock_svg}In stock` : `ecom-compare-outstock”>${outstock_svg}Out of stock`) + ` `; product_row_availability.insertAdjacentHTML(‘beforeend’, availability_html); var vendor_html = ` ${product.vendor} `; product_row_vendor.insertAdjacentHTML(‘beforeend’, vendor_html); var variant_pd_list = []; for (variant of product.options) { variant_pd_list.push(variant.name.toLowerCase()); } var html = ”; for (item of variant_list) { if (variant_pd_list.includes(item)) { for (variant of product.options) if (variant.name.toLowerCase() == item) { if (item == ‘color’ && colors) { html = “; var first_color = true; for (_variant of variant.values) { _variant = _variant.toLowerCase(); html += “; if(first_color) first_color = false; } html += ”; } else { var html = ` ${variant.values.join(‘, ‘)} `; } break; } } else var html = ` -`; var variant_class = item.trim().toLowerCase().replace(/s+/, ”); variant_list_node[variant_class].insertAdjacentHTML(‘beforeend’, html); } index++; } } // End for if(variant_list_node[‘color’]) { var i = 0; for(product of response) { if(!product) continue; var featured_image=”; for(var b of product.variants) { if(b[‘featured_image’]) { featured_image = b[‘featured_image’].src; break; } } try { if(featured_image) product_row_base.querySelectorAll(‘.ecom-compare-col:not(.ecom-compare-field)’)[i].querySelector(‘.ecom-compare-product-image img’).src = featured_image; } catch { console.log(‘ecom-compare-extention-error’); } i++; } var swatch_color_list = variant_list_node[‘color’].querySelectorAll(‘.ecom-compare-swatch-color’); swatch_color_list.forEach(function(item) { item.addEventListener(‘click’, function() { var active = item.parentElement.querySelector(‘.ecom-compare-swatch-color-active’); if(item == active) return; var product_index = item.parentElement.getAttribute(‘data-product-index’); var color_name = item.getAttribute(‘data-swatch-color’); if(active) active.classList.remove(‘ecom-compare-swatch-color-active’); item.classList.add(‘ecom-compare-swatch-color-active’); // Get color position in product.json->options var color_position = ‘option’; for(var a of response[product_index].options) { if(a.name.toLowerCase() == ‘color’) { color_position += a.position; break; } } // Get image by color var featured_image = null; for(var b of response[product_index].variants) { if(b[color_position].toLowerCase() == color_name) { if(b[‘featured_image’]) { featured_image = b[‘featured_image’].src; break; } } } try { if(featured_image) { var product_image = product_row_base.querySelectorAll(‘.ecom-compare-col:not(.ecom-compare-field)’)[product_index].querySelector(‘.ecom-compare-product-image img’); product_image.style.opacity = 0; setTimeout(function () { product_image.src = featured_image; product_image.style.opacity = 1; }, 100); } } catch { console.log(‘ecom-compare-extention-error’); } }) }) } if (response.length == 1) { var html = ` Add more products to compareShop now `; product_row_base.insertAdjacentHTML(‘beforeend’, html); notice = document.querySelector(‘.ecom-compare-col-notice’); } // Remove product and delete item in local storage var remove_icon = document.querySelectorAll(‘.ecom-compare-remove’); var compare_row = document.querySelectorAll(‘.ecom-compare-main .ecom-compare-row’); var compare_list = compare_list_storage; remove_icon.forEach(function(item, index, arr) { item.addEventListener(‘click’, function() { // Hide product and variant var i = […compare_row[0].querySelectorAll(‘.ecom-compare-col:not(:first-child)’)].indexOf(item.parentElement.parentElement.parentElement); for (a of compare_row) { a.children[i+1].classList.add(‘ecom-compare-col-hide’); } // Remove product handle in local storage compare_list_storage[i] = “”; compare_list = compare_list_storage.filter(function(handle) { return handle != “” }) var setjson = JSON.stringify(compare_list); localStorage.setItem(“compare_list”, setjson); // Add text notify when product compare has 1 or 0 left if(notice) notice.remove(); if (compare_list.length == 1) { var html = ` Add more products to compareShop now `; product_row_base.insertAdjacentHTML(‘beforeend’, html); notice = document.querySelector(‘.ecom-compare-col-notice’); } if (compare_list.length == 0) { overlay.classList.remove(‘ecom-compare-main-show’); isFetch = false; } // Hide variant not use for (b in variant_list_node) { var c = variant_list_node[b].querySelectorAll(“.ecom-compare-col:not(.ecom-compare-field, .ecom-compare-col-hide)”); var isUse = false; c.forEach(function(item) { if (item.textContent != “-“) { isUse = true; } }) if (! isUse) variant_list_node[b].remove(); } isUse = false; // Update compare button document.querySelectorAll(‘.ecom-product__compare-link’).forEach(function(compare_button) { var compare_list = JSON.parse(localStorage.getItem(“compare_list”)); var product_handle = compare_button.getAttribute(“data-product-handle”); if (compare_list.includes(product_handle)) { compare_button.classList.add(‘ecom-product__compare-link-added’, ‘ecom-button-active’); } else { compare_button.classList.remove(‘ecom-product__compare-link-added’, ‘ecom-button-active’); } }) }) }) overlay.classList.add(‘ecom-compare-main-show’); compare_button.classList.remove(‘ecom-ext-compare-icon-loading’); }) // End promise } else { overlay.classList.add(‘ecom-compare-main-show’); this.classList.remove(‘ecom-ext-compare-icon-loading’); } }) }) })() ]]> ‘); window._naviLoaded = true; }