1class SiccasAjaxExtraction{constructor(){if(SiccasAjaxExtraction.instance)return SiccasAjaxExtraction.instance;SiccasAjaxExtraction.instance=this,this.ajaxButtons=[],this.popupCreated=!1,this.buttonClickHandlers=new WeakMap,this.init()}static getInstance(){return SiccasAjaxExtraction.instance||new SiccasAjaxExtraction,SiccasAjaxExtraction.instance}init(){this.popupCreated||this.createPopup(),this.findAndInitButtons()}findAndInitButtons(){const buttons=document.querySelectorAll('.ajax-fetch__button[data-ajax-load="true"]');buttons.length&&buttons.forEach(button=>{if(!this.buttonClickHandlers.has(button)){const handler=this.handleButtonClick.bind(this);this.buttonClickHandlers.set(button,handler),button.addEventListener("click",handler),this.ajaxButtons.push(button)}})}reinitialize(){this.findAndInitButtons()}createPopup(){const popup=document.createElement("div");popup.className="ajax-fetch-popup";const overlay=document.createElement("div");overlay.className="ajax-fetch-popup__overlay",overlay.addEventListener("click",this.closePopup.bind(this));const content=document.createElement("div");content.className="ajax-fetch-popup__content";const closeButton=document.createElement("button");closeButton.className="ajax-fetch-popup__close",closeButton.setAttribute("aria-label","Close"),closeButton.innerHTML='<svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" class="icon icon-close" fill="none" viewBox="0 0 18 17"><path d="M.865 15.978a.5.5 0 00.707.707l7.433-7.431 7.579 7.282a.501.501 0 00.846-.37.5.5 0 00-.153-.351L9.712 8.546l7.417-7.416a.5.5 0 10-.707-.708L8.991 7.853 1.413.573a.5.5 0 10-.693.72l7.563 7.268-7.418 7.417z" fill="currentColor"></path></svg>',closeButton.addEventListener("click",this.closePopup.bind(this)),content.appendChild(closeButton),popup.appendChild(overlay),popup.appendChild(content),document.body.appendChild(popup),this.popup=popup,this.popupContent=content,this.popupCreated=!0}handleButtonClick(event){const button=event.currentTarget,valueItem=button.closest(".ajax-fetch__item"),ajaxUrl=valueItem.getAttribute("data-ajax-url");this.cropContent=valueItem.getAttribute("data-crop-content")==="true",this.readMoreText=valueItem.getAttribute("data-read-more-text"),this.openInNewTab=valueItem.getAttribute("data-open-in-new-tab")==="true",this.currentAjaxUrl=ajaxUrl,ajaxUrl&&(button.classList.add("loading"),this.fetchContent(ajaxUrl).then(content=>{this.showPopupWithContent(content),button.classList.remove("loading")}).catch(error=>{console.error("Error fetching content:",error),button.classList.remove("loading")}))}async fetchContent(url){const routesRoot=window.Shopify?.routes?.root||"/";let localizedUrl=url;url.startsWith("/")&&routesRoot!=="/"&&(localizedUrl=routesRoot+url.substring(1));const response=await fetch(localizedUrl);if(!response.ok)throw new Error("Network response was not ok");const html=await response.text(),doc=new DOMParser().parseFromString(html,"text/html"),mainContent=doc.querySelector("main")||doc.querySelector(".page-content");return mainContent||doc.body}showContentFromUrl(url,options={}){return this.cropContent=options.cropContent||!1,this.readMoreText=options.readMoreText||null,this.openInNewTab=options.openInNewTab||!1,this.currentAjaxUrl=url,this.fetchContent(url).then(content=>(this.showPopupWithContent(content),content))}showPopupWithContent(content){this.popup.classList.remove("ajax-fetch-popup--closing");const closeButton=this.popupContent.querySelector(".ajax-fetch-popup__close");this.popupContent.innerHTML="",this.popupContent.appendChild(closeButton);const contentClone=content.cloneNode(!0),contentWrapper=document.createElement("div");contentWrapper.className="ajax-fetch-popup__content-wrapper",this.cropContent&&contentWrapper.classList.add("ajax-fetch-popup__content-wrapper--cropped");const innerWrapper=document.createElement("div");if(innerWrapper.className="ajax-fetch-popup__inner-content",innerWrapper.appendChild(contentClone),contentWrapper.appendChild(innerWrapper),this.cropContent&&this.readMoreText&&this.currentAjaxUrl){const readMoreLink=document.createElement("a");readMoreLink.href=this.currentAjaxUrl,readMoreLink.className="ajax-fetch-popup__read-more",readMoreLink.textContent=this.readMoreText,this.openInNewTab&&readMoreLink.setAttribute("target","_blank"),contentWrapper.appendChild(readMoreLink)}this.popupContent.appendChild(contentWrapper),document.body.classList.add("ajax-fetch-open"),this.popup.classList.add("ajax-fetch-popup--active")}
1closePopup(){document.body.classList.remove("ajax-fetch-open"),this.popup.classList.add("ajax-fetch-popup--closing"),setTimeout(()=>{this.popup.classList.remove("ajax-fetch-popup--active"),this.popup.classList.remove("ajax-fetch-popup--closing")},300)}}let siccasAjaxExtractionInstance=null;document.addEventListener("DOMContentLoaded",function(){siccasAjaxExtractionInstance=SiccasAjaxExtraction.getInstance()}),window.SiccasAjaxExtraction=SiccasAjaxExtraction; 2//# sourceMappingURL=/cdn/shop/t/62/assets/siccas-ajax-extraction.js.map?v=174372524495197894561783105328
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.