PageSourceSearch

https://blog.smartgyro.com/hubfs/hub_generated/template_assets/1/7…/template_pwr-search-results.min.js

js smartgyro.com collected 2026-10-04 13:25:59 UTC 4,246 bytes, 2 lines download raw bytes

1var hsResultsPage=function(_resultsClass){function buildResultsPage(_instance){var resultTemplate=_instance.querySelector(".pwr-search-results__template"),resultsSection=_instance.querySelector(".pwr-search-results__listing"),searchPath=_instance.querySelector(".pwr-search-results__pagination").getAttribute("data-search-path"),prevLink=_instance.querySelector(".pwr-search-results__prev-page"),nextLink=_instance.querySelector(".pwr-search-results__next-page"),params=new URLSearchParams(window.location.search.slice(1));function getTerm(){return params.get("term")||""}function getOffset(){return parseInt(params.get("offset"))||0}function getLimit(){return parseInt(params.get("limit"))}function fillResults(results){results.results.forEach(function(result,i){var title,url,description,featuredImage,newResult;title=result.title,url=result.url,description=result.description,featuredImage=result.featuredImageUrl,(newResult=document.importNode(resultTemplate.content,!0)).querySelector(".pwr-search-results__entry").href=url,newResult.querySelector(".pwr-search-results__title").innerHTML=title,description&&description.length>0?newResult.querySelector(".pwr-search-results__description").innerHTML=description:newResult.querySelector(".pwr-search-results__description").remove(),newResult.querySelector(".pwr-search-results__img")&&(void 0!==featuredImage?newResult.querySelector(".pwr-search-results__img").style.backgroundImage=pwr.style.getRetinaImageUrl(featuredImage,200):newResult.querySelector(".pwr-search-results__img").remove()),resultsSection.appendChild(newResult)})}function emptyPagination(){prevLink.innerHTML="",nextLink.innerHTML=""}function httpRequest(term,offset){const data=new FormData,urlParams=new URLSearchParams(window.location.search);for(const[key,value]of urlParams.entries())data.append(key,value);data.set("offset",getOffset()),data.set("limit",getLimit()),data.set("autocomplete",!1),data.set("analytics",!0),data.set("q",term);const searchUrl=`/_hcms/v3/site-search/search?${new URLSearchParams(data).toString()}`,request=new XMLHttpRequest;request.open("GET",searchUrl,!0),request.onload=function(){if(request.status>=200&&request.status<400){var data=JSON.parse(request.responseText);searchedTerm=data.searchTerm,searchBars=document.querySelectorAll(".pwr-search-field__input"),Array.prototype.forEach.call(searchBars,function(el){el.value=decodeURIComponent(searchedTerm)}),data.total>0?(fillResults(data),function(results){var updatedLimit=getLimit()||results.limit;function hasPreviousPage(){return results.page>0}function hasNextPage(){return results.offset<results.total-updatedLimit}if(hasPreviousPage()){var prevParams=new URLSearchParams(params.toString());prevParams.set("offset",results.page*updatedLimit-parseInt(updatedLimit)),prevLink.href="/"+searchPath+"?"+prevParams}else prevLink.parentNode.removeChild(prevLink);if(hasNextPage()){var nextParams=new URLSearchParams(params.toString());nextParams.set("offset",results.page*updatedLimit+parseInt(updatedLimit)),nextLink.href="/"+searchPath+"?"+nextParams}else nextLink.parentNode.removeChild(nextLink)}(data)):(!function(searchedTerm){var excuse=_instance.querySelector("#pwr-search-results__translations").dataset.no_results_excuse,hint=_instance.querySelector("#pwr-search-results__translations").dataset.no_results_hint;""==excuse&&""==hint||(""!=excuse&&(excuse="<p>"+excuse.replace("{search_term}",searchedTerm)+"</p>"),""!=hint&&(hint="<p>"+hint.replace("{search_term}",searchedTerm)+"</p>"),resultsSection.innerHTML='<div class="hs-search__no-results">'+excuse+hint+"</div>")}(data.searchTerm),emptyPagination())}else console.error("Server reached, error retrieving results.");var searchedTerm,searchBars},request.onerror=function(){console.error("Could not reach the server.")},request.send()}getTerm()?httpRequest(getTerm(),getOffset()):emptyPagination()}var searchResults;searchResults=document.querySelectorAll(_resultsClass),Array.prototype.forEach.call(searchResults,function(el){buildResultsPage(el)})};pwr.dom.ready(()=>{hsResultsPage(".pwr-search-results")});
2//# sourceURL=https://25853954.fs1.hubspotusercontent-eu1.net/hubfs/25853954/hub_generated/template_assets/1/72029606597/1789563499235/template_pwr-search-results.js

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.