PageSourceSearch

https://youha.nl/cdn/shop/t/58/assets/predictive-search.js?v=39296678119028973811789493194

js youha.nl collected 2026-10-09 04:15:36 UTC 4,550 bytes, 2 lines download raw bytes

1if(!customElements.get("search-form")){class SearchForm extends HTMLElement{constructor(){super()}connectedCallback(){this.is_drawer=this.dataset.drawer,this.drawer=this.closest("#Search-Drawer"),this.form=this.querySelector("form"),this.button=document.querySelectorAll(".thb-quick-search"),this.input=this.querySelector(".search-field"),this.defaultTab=this.querySelector(".side-panel-content--initial"),this.predictiveSearchResults=this.is_drawer?this.querySelector(".side-panel-content--has-tabs"):this.querySelector(".thb-predictive-search"),this.cc=this.querySelector(".searchform--click-capture"),this.promotionTemplate=this.querySelector(".thb-predictive-search--promotion-template"),this.promotionHydrated=!1,this.cache=new Map,this.cacheLimit=50,this.lastSearchTerm="",this.setupEventListeners()}hydratePromotion(){this.promotionTemplate&&(this.promotionTemplate.parentNode.insertBefore(this.promotionTemplate.content,this.promotionTemplate),this.promotionTemplate.remove(),this.promotionTemplate=null,this.promotionHydrated=!0)}setupEventListeners(){this.form.addEventListener("submit",this.onFormSubmit.bind(this)),this.input.addEventListener("input",debounce(event=>{this.onChange(event)},300).bind(this)),this.input.addEventListener("focus",debounce(event=>{this.onChange(event)},300).bind(this)),this.button.forEach(item=>{item.addEventListener("click",event=>(event.preventDefault(),this.hydratePromotion(),this.is_drawer?(OverlayManager.open(this.drawer),setTimeout(()=>{this.input.focus({preventScroll:!0})},100)):document.body.classList.add("open-cc"),!1))}),this.is_drawer||(this.onCcClickBound=this.close.bind(this),this.onKeyUpBound=e=>{e.code&&e.code.toUpperCase()==="ESCAPE"&&this.close()},this.cc?.addEventListener("click",this.onCcClickBound),document.addEventListener("keyup",this.onKeyUpBound))}disconnectedCallback(){this.onKeyUpBound&&document.removeEventListener("keyup",this.onKeyUpBound),this.onCcClickBound&&this.cc&&this.cc.removeEventListener("click",this.onCcClickBound)}getQuery(){return this.input.value.trim()}onChange(){const searchTerm=this.getQuery();if(!searchTerm.length){this.lastSearchTerm="",this.showDefaultContent();return}this.is_drawer||this.open(),searchTerm!==this.lastSearchTerm&&(this.lastSearchTerm=searchTerm,this.showSearchResults(),this.getSearchResults(searchTerm))}showDefaultContent(){this.predictiveSearchResults&&(this.predictiveSearchResults.classList.remove("active"),this.predictiveSearchResults.innerHTML=""),this.defaultTab&&(this.defaultTab.style.display=""),this.is_drawer||this.close()}showSearchResults(){this.defaultTab&&(this.defaultTab.style.display="none"),this.predictiveSearchResults&&this.predictiveSearchResults.classList.add("active")}onFormSubmit(event){this.getQuery().length||event.preventDefault()}getSearchResults(searchTerm){const cached=this.cache.get(searchTerm);if(cached){this.renderSearchResults(cached);return}this.predictiveSearchResults&&this.predictiveSearchResults.classList.add("loading"),fetch(`${theme.routes.predictive_search_url}?q=${encodeURIComponent(searchTerm)}&${encodeURIComponent("resources[type]")}=product,article,query,page&${encodeURIComponent("resources[limit]")}=10&resources[options][fields]=title,product_type,vendor,variants.title,variants.sku&section_id=predictive-search`).then(response=>{if(this.predictiveSearchResults&&this.predictiveSearchResults.classList.remove("loading"),!response.ok){var error=new Error(response.status);throw error}return response.text()}).then(text=>{const resultsMarkup=new DOMParser().parseFromString(text,"text/html").querySelector("#shopify-section-predictive-search").innerHTML;this.cache.size>=this.cacheLimit&&this.cache.delete(this.cache.keys().next().value),this.cache.set(searchTerm,resultsMarkup),this.renderSearchResults(resultsMarkup)}).catch(error=>{throw error})}renderSearchResults(resultsMarkup){this.predictiveSearchResults.innerHTML=resultsMarkup;const submitBtn=this.predictiveSearchResults.querySelector("#search-results-submit");submitBtn&&(this.is_drawer||submitBtn.classList.remove("button"),submitBtn.addEventListener("click",()=>{this.form.submit()}))}close(){this.predictiveSearchResults&&this.predictiveSearchResults.setAttribute("inert",""),document.body.classList.remove("open-search")}open(){document.body.classList.add("open-search"),this.predictiveSearchResults&&this.predictiveSearchResults.removeAttribute("inert")}}customElements.define("search-form",SearchForm)}
2//# sourceMappingURL=/cdn/shop/t/58/assets/predictive-search.js.map?v=39296678119028973811789493194

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.