PageSourceSearch

https://culinaries.fr/cdn/shop/t/84/assets/preview-color-swatches.js?v=109236305638202773321788253001

js culinaries.fr collected 2026-10-02 17:52:13 UTC 4,021 bytes, 2 lines download raw bytes

1window.Eurus.loadedScript.includes("preview-color-swatches.js")||(window.Eurus.loadedScript.push("preview-color-swatches.js"),requestAnimationFrame(()=>{document.addEventListener("alpine:init",()=>{Alpine.data("xProductCard",(sectionId,productUrl,productId)=>({currentVariantCard:"",options:[],isSelect:!1,productId,showOptions:!1,init(){document.addEventListener(`eurus:product-card-variant-select:updated:${sectionId}`,e=>{this.checkVariantSelected(),this.currentVariantCard=e.detail.currentVariant,this.options=e.detail.options})},checkVariantSelected(){[...document.querySelectorAll(`#variant-update-${sectionId} fieldset`)].findIndex(item=>!item.querySelector("input:checked"))=="-1"&&(this.isSelect=!0)}})),Alpine.store("xPreviewColorSwatch",{onChangeVariant(el,productUrl,src,variantId,sectionId,isColor=!1){if(document.addEventListener(`eurus:product-card-variant-select:updated:${sectionId}`,e=>{e.detail.currentVariant==null&&this.updateImage(el,productUrl,src,variantId,sectionId)}),!isColor){let productVariants="";if(document.dispatchEvent(new CustomEvent(`eurus:product-variant-get:${sectionId}`,{detail:{callback:variants=>{productVariants=variants}}})),productVariants){let variantSrc=productVariants.reduce((acc,variant)=>(variant.featured_image&&(acc[variant.id]=variant.featured_image.src),acc),{});const swatchesContainer=el.closest(".options-container");if(swatchesContainer){const swatches=swatchesContainer.querySelectorAll("label.color-watches"),inputs=swatchesContainer.querySelectorAll("input:checked");let selectedOption=[];inputs.forEach(input=>{[...swatches].some(swatch=>swatch.dataset.optionvalue===input.value)||selectedOption.push(input.value)});let imageSrc=productVariants.filter(variant=>selectedOption.every(option=>variant.options.includes(option))).map(variant=>`url(${variantSrc[variant.id]?variantSrc[variant.id]:src})`);swatches.forEach((swatch,index)=>{swatch.style.setProperty("--bg-image",imageSrc[index])})}}}},updateImage(el,productUrl,src,variantId,sectionId,hasVariant){const cardProduct=el.closest(".card-product");let getLink=productUrl+`?variant=${variantId}`;if(!cardProduct)return;const linkVariant=cardProduct.getElementsByClassName("link-product-variant");for(var i=0;i<linkVariant.length;i++)linkVariant[i].setAttribute("href",getLink);const currentVariant=cardProduct.querySelector(".current-variant");if(currentVariant&&!hasVariant&&(currentVariant.innerText=variantId),src!=""){let media=cardProduct.querySelector(`[media="${src}"]`);if(media){let index=media.getAttribute("index"),slide2=cardProduct.querySelector(".x-splide");if(slide2){slide2.splide?slide2.splide.go(Number(index)):document.addEventListener(`eurus:${sectionId}:splide-ready`,()=>{slide2.splide.go(Number(index))});return}}const previewImg=cardProduct.getElementsByClassName("preview-img")[0];if(!previewImg)return;previewImg.removeAttribute("srcset"),previewImg.setAttribute("src",src);let slide=cardProduct.querySelector(".x-splide");slide&&slide.splide&&slide.splide.go(0)}else{let slide=cardProduct.querySelector(".x-splide");slide&&slide.splide&&slide.splide.go(0)}},updateQuickAdd(productUrl,variantId,quickAddPageParam,productId){let url=`${productUrl}?variant=${variantId}&section_id=choose-option&page=${quickAddPageParam}`;fetch(url).then(response=>response.text()).then(responseText=>{const html=new DOMParser().parseFromString(responseText,"text/html"),listCurrent=document.querySelectorAll(`#product-form-choose-option${productId}${quickAddPageParam}`),destination=html.querySelector(`#product-form-choose-option${productId}${quickAddPageParam}`);listCurrent.length>0&&destination&&listCurrent.forEach(item=>{item.innerHTML=destination.innerHTML;const currentPrice=item.closest(".card-product").querySelector(".main-product-price"),updatePrice=html.querySelector(".main-product-price");currentPrice&&updatePrice&&(currentPrice.innerHTML=updatePrice.innerHTML)})})}})})}));
2//# sourceMappingURL=/cdn/shop/t/84/assets/preview-color-swatches.js.map?v=109236305638202773321788253001

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.