1let popup,closeBtn,continueBtn;window.addToCartAndShowPopup=function(button){if(!button.dataset.productHandle){console.error("Product handle non trouv\xE9");return}const card=button.closest(".product-card, .js-product-card"),variantInput=card?.querySelector('input[name="id"]'),ceramicInput=card?.querySelector('input[name="properties[_isCeramicProduct]"]');if(!variantInput){console.error("Variant ID non trouv\xE9");return}const data={id:variantInput.value,quantity:1,properties:{_isCeramicProduct:ceramicInput?ceramicInput.value:"false"}};fetch("/cart/add.js",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(data)}).then(response=>response.json()).then(data2=>{data2&&(typeof updateCartCount=="function"&&updateCartCount(),mmShowPopupProduct(button))}).catch(error=>{console.error("Erreur lors de l'ajout au panier:",error)})},window.handleProductCardAddToCart=function(button){let productHandle=button.dataset.productHandle;if(!productHandle){const productLink=button.closest(".product-card, .js-product-card")?.querySelector('a[href*="/products/"]');if(productLink){const match=productLink.getAttribute("href").match(/\/products\/([^\/\?]+)/);match&&(productHandle=match[1])}}if(!productHandle){console.error("Product handle non trouv\xE9");return}const card=button.closest(".product-card, .js-product-card"),variantInput=card?.querySelector('input[name="id"]'),ceramicInput=card?.querySelector('input[name="properties[_isCeramicProduct]"]');if(!variantInput){console.error("Variant ID non trouv\xE9");return}const data={id:variantInput.value,quantity:1,properties:{_isCeramicProduct:ceramicInput?ceramicInput.value:"false"}};fetch("/cart/add.js",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(data)}).then(response=>response.json()).then(data2=>{if(data2){const headerCartCount=document.querySelector("#js-header-cart-count");if(headerCartCount){const currentCount=parseInt(headerCartCount.innerText)||0;headerCartCount.innerText=currentCount+1}typeof updateCartCount=="function"&&fetch("/cart.js").then(res=>res.json()).then(cart=>{updateCartCount(cart.item_count)}).catch(err=>console.error("Erreur lors de la r\xE9cup\xE9ration du panier:",err));const tempButton=document.createElement("button");tempButton.dataset.productHandle=productHandle,mmShowPopupProduct(tempButton)}}).catch(error=>{console.error("Erreur lors de l'ajout au panier:",error)})};function getLocalePrefix(){if(window.shopifyLocale&&window.shopifyLocale.rootUrl)return window.shopifyLocale.rootUrl;const firstPart=window.location.pathname.split("/")[1];return["en","de","es","it","nl","fr"].includes(firstPart)?`/${firstPart}`:""}function mmShowPopupProduct(button){console.log("Popup demand\xE9e");const productHandle=button.dataset.productHandle;if(!productHandle){console.error("Product handle non trouv\xE9");return}const localePrefix=getLocalePrefix(),popupUrl=`${localePrefix}/products/${productHandle}?view=popup`;console.log("Locale d\xE9tect\xE9e:",{shopifyLocale:window.shopifyLocale,localePrefix,popupUrl,currentPath:window.location.pathname}),fetch(popupUrl,{credentials:"same-origin",headers:{Accept:"text/html","X-Requested-With":"XMLHttpRequest"}}).then(res=>{if(!res.ok)throw new Error(`HTTP error! status: ${res.status}`);return res.text()}).then(html=>{const tempDiv=document.createElement("div");tempDiv.innerHTML=html;const popupContent=tempDiv.querySelector("[data-product-popup]");if(popupContent){const existingPopup=document.querySelector("[data-product-popup]");existingPopup&&existingPopup.remove(),document.body.appendChild(popupContent),popup=popupContent,closeBtn=popup.querySelector("[data-product-popup-close]"),continueBtn=popup.querySelector("[data-product-popup-continue]"),attachPopupEvents(),openPopup()}else console.error("Contenu de popup non trouv\xE9 dans la r\xE9ponse")}).catch(error=>{console.error("Erreur lors du chargement de la popup:",error)})}async function loadComplementaryProducts(){console.log("Produits compl\xE9mentaires charg\xE9s c\xF4t\xE9 serveur via Liquid")}function attachComplementaryProductEvents(){document.querySelectorAll("[data-accessory-btn]").forEach(button=>{const form=button.closest("form");form&&form.addEventListener("submit",function(e){e.preventDefault(),button.disabled=!0;const formData=new FormData(form);fetch("/cart/add.js",{method:"POST",body:formData}).then(response=>response.json()).then(data=>{const addedText=button.dataset.addedText;button.innerHTML=addedText;const headerCartCount=document.querySelector("#js-header-cart-count");if(headerCartCount){const currentCount=parseInt(headerCartCount.innerText)||0;headerCartCount.innerText=currentCount+1}}).catch(error=>{console.error("Erreur lors de l'ajout au panier:",error),button.disabled=!1})})})}window.openPopup=function(){if(!popup){console.error("Popup non trouv\xE9e");return}popup.setAttribute("aria-hidden","false"),popup.style.display="flex",document.querySelectorAll('a[href], button, textarea, input, select, [tabindex]:not
1([tabindex="-1"])').forEach(el=>{!popup.contains(el)&&!el.closest(".mm-cart")&&!el.closest(".mm-drawer-cart")&&(el.setAttribute("data-original-tabindex",el.getAttribute("tabindex")||"0"),el.setAttribute("tabindex","-1"))}),setTimeout(()=>{popup.classList.add("show");const firstFocusable=popup.querySelector('button, a, input, select, textarea, [tabindex]:not([tabindex="-1"])');firstFocusable&&firstFocusable.focus()},10),document.body.style.overflow="hidden"},window.closePopup=function(){if(!popup){console.error("Popup non trouv\xE9e");return}popup.setAttribute("aria-hidden","true"),popup.classList.remove("show"),document.querySelectorAll("[data-original-tabindex]").forEach(el=>{const originalTabindex=el.getAttribute("data-original-tabindex");originalTabindex==="0"?el.removeAttribute("tabindex"):el.setAttribute("tabindex",originalTabindex),el.removeAttribute("data-original-tabindex")}),document.body.style.overflow="",setTimeout(()=>{popup&&popup.parentNode&&popup.remove(),popup=null,closeBtn=null,continueBtn=null},300)};function attachPopupEvents(){const closeBtn2=document.querySelector("[data-product-popup-close]"),continueBtn2=document.querySelector("[data-product-popup-continue]"),popup2=document.querySelector("[data-product-popup]");closeBtn2&&(closeBtn2.removeEventListener("click",closePopup),closeBtn2.addEventListener("click",closePopup)),continueBtn2&&(continueBtn2.removeEventListener("click",closePopup),continueBtn2.addEventListener("click",closePopup)),popup2&&(popup2.removeEventListener("click",handleOverlayClick),popup2.addEventListener("click",handleOverlayClick)),attachComplementaryProductEvents()}function handleOverlayClick(e){e.target===e.currentTarget&&closePopup()}document.addEventListener("DOMContentLoaded",function(){document.querySelectorAll("[data-product-popup-trigger]").forEach(trigger=>{const form=trigger.closest("form");form&&form.addEventListener("submit",function(e){e.preventDefault();const formData=new FormData(form);fetch("/cart/add.js",{method:"POST",body:formData}).then(response=>response.json()).then(data=>{const productHandle=window.location.pathname.includes("/products/")?window.location.pathname.split("/products/")[1].split("?")[0]:null;if(productHandle){const tempButton=document.createElement("button");tempButton.dataset.productHandle=productHandle,mmShowPopupProduct(tempButton)}else console.error("Handle du produit non trouv\xE9 pour la popup");typeof updateCartCount=="function"&&updateCartCount()}).catch(error=>{console.error("Erreur lors de l'ajout au panier:",error),form.submit()})})}),document.addEventListener("cartItemAdded",function(e){if(console.log("\xC9v\xE9nement cartItemAdded re\xE7u:",e.detail),e.detail&&e.detail.source==="product-card"){console.log("Ouverture de la popup depuis product-card via \xE9v\xE9nement");const productHandle=window.location.pathname.includes("/products/")?window.location.pathname.split("/products/")[1].split("?")[0]:null;if(productHandle){const tempButton=document.createElement("button");tempButton.dataset.productHandle=productHandle,mmShowPopupProduct(tempButton)}}}),document.addEventListener("keydown",function(e){if(e.key==="Escape"&&popup&&popup.classList.contains("show")&&closePopup(),popup&&popup.classList.contains("show")&&e.key==="Tab"){const focusableElements=popup.querySelectorAll('button, a, input, select, textarea, [tabindex]:not([tabindex="-1"])'),firstElement=focusableElements[0],lastElement=focusableElements[focusableElements.length-1];e.shiftKey?document.activeElement===firstElement&&(e.preventDefault(),lastElement.focus()):document.activeElement===lastElement&&(e.preventDefault(),firstElement.focus())}})}); 2//# sourceMappingURL=/cdn/shop/t/114/assets/mm-popup.js.map?v=69207234621065344631777257768
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.