PageSourceSearch

https://www.fostergrant.com/cdn/shop/t/75/assets/custom-predictive-search.js?v=131149745290532890201769615268

js fostergrant.com collected 2026-09-25 19:03:31 UTC 2,459 bytes, 2 lines download raw bytes

1class CustomPredictiveSearch extends PredictiveSearch{constructor(){super(),subscribe(PUB_SUB_EVENTS.noSearchResult,()=>{this.getStaticContent(!0)}),this.enable=this.dataset.enable,this.mobile=window.matchMedia("(max-width: 600px)").matches}onFocus(){const currentSearchTerm=this.getQuery();currentSearchTerm.length||this.getStaticContent(),this.searchTerm!==currentSearchTerm?this.onChange():this.getAttribute("results")==="true"?this.open():this.getSearchResults(this.searchTerm)}onFocusOut(){setTimeout(()=>{this.contains(document.activeElement)||this.close()})}onKeyup(event){switch(this.getQuery().length||event.code!=="Tab"&&(this.close(!0),this.getStaticContent()),event.preventDefault(),event.code){case"ArrowUp":this.switchOption("up");break;case"ArrowDown":this.switchOption("down");break;case"Enter":this.selectOption();break}}onKeydown(event){(event.code==="ArrowUp"||event.code==="ArrowDown")&&event.preventDefault()}getSearchResults(searchTerm){if(searchTerm===""){this.getStaticContent();return}super.getSearchResults(searchTerm)}getStaticContent(noResult=!1){if(this.enable==="desktop"&&this.mobile||this.enable==="mobile"&&!this.mobile)return;const searchTerm=this.getQuery();let url=`${routes.root_url}?section_id=static-predictive-search`;searchTerm.length>0&&(url+=`&text=on&searchterms=${encodeURIComponent(searchTerm)}`),fetch(url,{signal:this.abortController.signal}).then(response=>{if(!response.ok){const error=new Error(response.status);throw this.close(),error}return response.text()}).then(text=>{const resultsElement=new DOMParser().parseFromString(text,"text/html").querySelector("#shopify-section-static-predictive-search"),resultsMarkup=new DOMParser().parseFromString(text,"text/html").querySelector("#shopify-section-static-predictive-search").innerHTML;if(this.renderSearchResults(resultsMarkup),noResult&&this.querySelector("#text-not")){const textNotElement=resultsElement.querySelector("#text-not");this.querySelector("#text-not").innerHTML=textNotElement.innerHTML;const frameSearchElement=document.getElementById("frame-search");frameSearchElement&&(frameSearchElement.style.display="none")}else this.querySelector("#text-not").innerHTML=""}).catch(error=>{if(error?.code!==20)throw this.close(),error})}close(clear){super.close(clear)}}customElements.define("custom-predictive-search",CustomPredictiveSearch);
2//# sourceMappingURL=/cdn/shop/t/75/assets/custom-predictive-search.js.map?v=131149745290532890201769615268

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.