PageSourceSearch

https://www.elegoo.com/cdn/shop/t/141/assets/predictive-search.js?v=25591409121090521281782966570

js elegoo.com collected 2026-09-24 09:43:42 UTC 3,236 bytes, 2 lines download raw bytes

1class PredictiveSearch{constructor(){this.container=document.getElementById("Search-Drawer"),this.form=this.container.querySelector("form.searchform"),this.button=document.querySelectorAll(".thb-quick-search"),this.input=this.container.querySelector('input[type="search"]'),this.defaultTab=this.container.querySelector(".side-panel-content--initial"),this.predictiveSearchResults=this.container.querySelector(".side-panel-content--has-tabs"),this.setupEventListeners()}setupEventListeners(){this.form.addEventListener("submit",this.onFormSubmit.bind(this)),this.input.addEventListener("input",debounce(event=>{this.onChange(event)},300).bind(this)),this.button.forEach((item,i)=>{item.addEventListener("click",event=>{var _this=this;return event.preventDefault(),document.getElementsByTagName("body")[0].classList.toggle("open-cc"),this.container.classList.toggle("active"),this.container.classList.contains("active")&&(setTimeout(function(){_this.input.focus({preventScroll:!0})},100),dispatchCustomEvent("search:open")),!1})})}getQuery(){return this.input.value.trim()}onChange(){const searchTerm=this.getQuery();if(!searchTerm.length){this.predictiveSearchResults.classList.remove("active");return}this.predictiveSearchResults.classList.add("active"),this.getSearchResults(searchTerm)}onFormSubmit(event){this.getQuery().length||event.preventDefault()}onFocus(){const searchTerm=this.getQuery();searchTerm.length&&this.getSearchResults(searchTerm)}getSearchResults(searchTerm){const queryKey=searchTerm.replace(" ","-").toLowerCase();this.predictiveSearchResults.classList.add("loading"),fetch(`${theme.routes.predictive_search_url}?q=${encodeURIComponent(searchTerm)}&${encodeURIComponent("resources[type]")}=product,article,page,query&${encodeURIComponent("resources[limit]")}=10&${encodeURIComponent("resources[limit_scope]")}=each&${encodeURIComponent("resources[options][fields]")}=author,body,product_type,tag,title,variants.barcode,variants.sku,variants.title,vendor&section_id=predictive-search`).then(response=>{if(this.predictiveSearchResults.classList.remove("loading"),!response.ok){var error=new Error(response.status);if(response.status===417)return fetch(`${theme.routes.search_url}?q=${encodeURIComponent(searchTerm)}`).then(resp=>resp.text());throw error}return response.text()}).then(text=>{let resultsMarkup=new DOMParser().parseFromString(text,"text/html").querySelector("#shopify-section-predictive-search")?.innerHTML;resultsMarkup||(resultsMarkup=new DOMParser().parseFromString(text,"text/html").querySelector("#product-grid.products").innerHTML,resultsMarkup=`<ul class="side-panel-content--inner" style="overflow-y: scroll; padding: 24px 0 0; list-style: none;">${resultsMarkup}</ul>`),this.renderSearchResults(resultsMarkup)}).catch(error=>{throw error})}renderSearchResults(resultsMarkup){this.predictiveSearchResults.innerHTML=resultsMarkup;let _this=this;this.container.querySelector("#search-results-submit").addEventListener("click",()=>{_this.form.submit()})}close(){this.container.classList.remove("active")}}window.addEventListener("load",()=>{typeof PredictiveSearch<"u"&&new PredictiveSearch});
2//# sourceMappingURL=/cdn/shop/t/141/assets/predictive-search.js.map?v=25591409121090521281782966570

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.