PageSourceSearch

https://chinookautosupplies.com/cdn/shop/t/13/assets/predictive-se…?v=150185749331475142821773899422

js chinookautosupplies.com collected 2026-09-30 10:39:10 UTC 5,607 bytes, 5 lines download raw bytes

1/*
2Generated time: July 18, 2025 00:18
3This file was created by the app developer. Feel free to contact the original developer with any questions. It was minified (compressed) by AVADA. AVADA do NOT own this script.
4*/
5if(!customElements.get("predictive-search")){class a extends HTMLElement{constructor(){super(),this.cachedResults={},this.input=this.querySelector(".js-search-input"),this.productTypeSelect=this.querySelector(".js-search-product-types"),this.productTypeInput=document.getElementById("product_type_input"),this.resetBtn=this.querySelector(".js-search-reset"),this.results=this.querySelector(".js-search-results"),this.overlay=this.querySelector(".js-search-overlay"),this.statusEl=this.querySelector(".js-search-status"),this.loadingText=this.getAttribute("data-loading-text"),this.addListeners()}disconnectedCallback(){this.close()}addListeners(){this.input.addEventListener("focus",this.handleFocus.bind(this)),this.input.addEventListener("input",debounce(this.handleInput.bind(this))),this.productTypeSelect&&this.productTypeSelect.addEventListener("change",this.handleProductTypeChange.bind(this)),this.querySelector(".search").addEventListener("submit",this.handleSubmit.bind(this))}getQuery(){return this.input.value.trim()}handleSubmit(e){this.getQuery().length&&!this.querySelector('.predictive-search__item[aria-selected="true"]:not(.js-submit)')||e.preventDefault()}handleInput(){this.input.setAttribute("value",this.input.value);var e=this.getQuery();e.length?this.getResults(e):this.close()}handleProductTypeChange(e){this.productTypeInput.value=e.detail.selectedValue;e=this.getQuery();0<e.length&&this.getResults(e)}handleFocus(){var e=this.getQuery();e.length&&("true"===this.getAttribute("results")?this.open():this.getResults(e))}handleKeydown(e){if(!e.target.matches(".tablist__tab"))switch(e.key){case"ArrowUp":case"ArrowDown":e.preventDefault(),this.hasAttribute("open")&&this.handleResultsNav(e.key);break;case"Enter":this.selectOption();break;case"Escape":this.close()}}handleKeyup(){this.getQuery().length||this.close()}handleResultsNav(e){var t=this.querySelector('[role="tabpanel"]:not([hidden]) [aria-selected="true"]'),s=this.querySelectorAll('[role="tabpanel"]:not([hidden]) .predictive-search__item');let i=s[0];if("ArrowUp"===e){if(!t)return;i=t.previousElementSibling||s[s.length-1]}else"ArrowDown"===e&&t&&(i=t.nextElementSibling||s[0]);this.statusEl.textContent="",i&&i!==t&&(i.setAttribute("aria-selected","true"),t&&t.setAttribute("aria-selected","false"),this.setLiveRegionText(i.textContent),this.input.setAttribute("aria-activedescendant",i.id))}selectOption(){var e=this.querySelector('[aria-selected="true"] > .js-search-link');e&&e.click()}async getResults(e){this.setLiveRegionLoadingState();let t="title,product_type,variants.title,vendor",s=(theme.settings.pSearchIncludeSkus&&(t+=",variants.sku"),theme.settings.pSearchIncludeTags&&(t+=",tag"),"");s=this.productTypeInput&&""!==this.productTypeInput.value?`q=product_type:${encodeURIComponent(this.productTypeInput.value)} AND `+encodeURIComponent(e):"q="+encodeURIComponent(e);e=(s=(s=(s+=`&${encodeURIComponent("resources[limit]")}=`+theme.settings.pSearchLimit)+(`&${encodeURIComponent("resources[limit_scope]")}=`+theme.settings.pSearchLimitScope))+(`&${encodeURIComponent("resources[options][fields]")}=`+t)+"&section_id=predictive-search").replace(" ","-").toLowerCase();if(this.cachedResults[e])this.renderResults(this.cachedResults[e]);else try{var i=await fetch(theme.routes.predictiveSearch+"?"+s);if(!i.ok)throw new Error(i.status);var r=document.createElement("template");r.innerHTML=await i.text();var n=r.content.querySelector("#shopify-section-predictive-search").innerHTML.replace(/psearch/g,this.input.id);this.cachedResults[e]=n,this.renderResults(n)}catch(e){throw this.close(),e}}setLiveRegionLoadingState(){this.setLiveRegionText(this.loadingText)}setLiveRegionText(e){this.statusEl.setAttribute("aria-hidden","false"),this.statusEl.textContent=e,setTimeout(()=>{this.statusEl.setAttribute("aria-hidden","true")},1e3)}renderResults(e){this.results.innerHTML=e,this.setAttribute("results",!0),this.open()}open(){this.overlay.classList.add("is-visible"),this.getQuery().length&&(this.resetBtn.hidden=!1),this.input.setAttribute("aria-expanded","true"),this.setAttribute("open",""),document.body.classList.add("overlay-predictive-search"),this.keydownHandler=this.keydownHandler||this.handleKeydown.bind(this),this.keyupHandler=this.keyupHandler||this.handleKeyup.bind(this),this.resetBtnClickHandler=this.resetBtnClickHandler||this.close.bind(this),this.overlayClickHandler=this.overlayClickHandler||this.close.bind(this),this.addEventListener("keydown",this.keydownHandler),this.addEventListener("keyup",this.keyupHandler),this.resetBtn.addEventListener("click",this.resetBtnClickHandler),this.overlay.addEventListener("click",this.overlayClickHandler)}close(e){e&&e.target===this.resetBtn&&(this.input.value="",this.removeAttribute("results"),this.input.focus());e=this.querySelector('.predictive-search__item[aria-selected="true"]');e&&e.setAttribute("aria-selected","false"),this.removeAttribute("open"),this.resetBtn.hidden=!0,this.overlay.classList.remove("is-visible"),this.input.setAttribute("aria-activedescendant",""),this.input.setAttribute("aria-expanded","fal
5se"),document.body.classList.remove("overlay-predictive-search"),this.removeEventListener("keydown",this.keydownHandler),this.resetBtn.removeEventListener("click",this.resetBtnClickHandler),this.overlay.removeEventListener("click",this.overlayClickHandler)}}customElements.define("predictive-search",a)}

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.