PageSourceSearch

https://adreno.com.au/cdn/shop/t/224/assets/element.error-page-rec…?v=125667799607716317591788836371

js adreno.com.au collected 2026-10-02 21:34:32 UTC 2,690 bytes, 2 lines download raw bytes

1const GENERIC_WORDS=new Set(["mens","womens","unisex","kids","boys","girls","junior","adult"]);class ErrorPageRecommendations extends HTMLElement{async connectedCallback(){this.spinner=this.querySelector("[data-recommendations-spinner]"),this.headerEl=this.querySelector("[data-recommendations-header]"),this.heading=this.querySelector("[data-recommendations-heading]"),this.grid=this.querySelector("[data-recommendations-grid]"),this.searchUrl=this.dataset.searchUrl||"/search";const candidates=this.guessWordsFromPath(window.location.pathname);if(!candidates.length)return;this.hidden=!1;let initial=null;for(const query2 of this.buildQueries(candidates))if(initial=await this.fetchResults(query2),initial&&initial.hasResults)break;if(!initial||!initial.hasResults){this.hidden=!0;return}let query=initial.term,result=initial;if(initial.type){const typeQuery=`product_type:"${initial.type.replace(/"/g,"")}"`,typed=await this.fetchResults(typeQuery);typed&&typed.hasResults&&(result=typed,query=typeQuery)}this.show(result.markup,initial.type,query)}guessWordsFromPath(pathname){if(!pathname.includes("/products/")&&!pathname.includes("/collections/"))return[];const segments=pathname.split("/").filter(Boolean);return(segments[segments.length-1]||"").split(/[-_]+/).filter(word=>word.length>2&&!/^\d+$/.test(word))}buildQueries(words){const queries=[];words.length>1&&queries.push(words.join(" "));const specific=words.filter(word=>!GENERIC_WORDS.has(word.toLowerCase())).sort((a,b)=>b.length-a.length);return queries.concat(specific)}fetchResults(term){const params=new URLSearchParams({q:term,type:"product",section_id:"main-404-recommendations"});return fetch(`${window.Shopify.routes.root}search?${params.toString()}`).then(response=>response.ok?response.text():"").then(text=>{if(!text)return null;const doc=new DOMParser().parseFromString(text,"text/html"),typeTag=doc.querySelector("[data-404-recommendations-type]"),items=doc.querySelector("[data-404-recommendations-items]");let type="";if(typeTag)try{type=JSON.parse(typeTag.textContent||'""')}catch{type=""}return{term,type,hasResults:!!items,markup:items?items.innerHTML:""}}).catch(()=>null)}show(markup,type,query){this.spinner&&(this.spinner.hidden=!0),this.grid&&(this.grid.innerHTML=markup,this.heading&&(this.heading.textContent=type?`${this.dataset.heading} \u2014 ${type}`:this.dataset.heading,this.heading.href=`${this.searchUrl}?q=${encodeURIComponent(query)}&type=product`),this.headerEl&&(this.headerEl.hidden=!1))}}customElements.define("error-page-recommendations",ErrorPageRecommendations);
2//# sourceMappingURL=/cdn/shop/t/224/assets/element.error-page-recommendations.js.map?v=125667799607716317591788836371

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.