PageSourceSearch

https://www.chaserhq.com/hubfs/hub_generated/module_assets/1/21666…/module_CHQ_filter_search.min.js

js chaserhq.com collected 2026-09-24 22:03:55 UTC 3,817 bytes, 2 lines download raw bytes

1var module_216666621033=function(){var blogTagSelect;(blogTagSelect=document.querySelector("#blog-filter__category"))&&blogTagSelect.addEventListener("change",function(){return blogTagSelect.value&&(window.location=blogTagSelect.value),!1});var hsSearch=function(_instance){var func,wait,immediate,timeout,searchTerm="",searchForm=_instance,searchField=_instance.querySelector(".hs-search-field__input"),searchResults=_instance.querySelector(".hs-search-field__suggestions"),emptySearchResults=function(){searchResults.innerHTML="",searchField.focus(),searchForm.classList.remove("hs-search-field--open")},getSearchResults=function(){var request=new XMLHttpRequest,requestUrl="/_hcms/search?&term="+encodeURIComponent(searchTerm)+"&limit="+encodeURIComponent(3)+"&autocomplete=true&analytics=true&"+function(){for(var formParams=[],form=_instance.querySelector("form"),i=0;i<form.querySelectorAll("input[type=hidden]").length;i++){var e=form.querySelectorAll("input[type=hidden]")[i];"limit"!==e.name&&formParams.push(encodeURIComponent(e.name)+"="+encodeURIComponent(e.value))}return formParams.join("&")}();request.open("GET",requestUrl,!0),request.onload=function(){if(request.status>=200&&request.status<400){var data=JSON.parse(request.responseText);data.total>0?((items=[]).push("<li id='results-for'>Results for \""+(response=data).searchTerm+'"</li>'),response.results.forEach(function(val,index){items.push("<li id='result"+index+"'><a href='"+val.url+"'>"+val.title+"</a></li>")}),emptySearchResults(),searchResults.innerHTML=items.join(""),searchForm.classList.add("hs-search-field--open"),trapFocus()):emptySearchResults()}else console.error("Server reached, error retrieving results.");var response,items},request.onerror=function(){console.error("Could not reach the server.")},request.send()},trapFocus=function(){var tabbable=[];tabbable.push(searchField);for(var tabbables=searchResults.getElementsByTagName("A"),i=0;i<tabbables.length;i++)tabbable.push(tabbables[i]);var firstTabbable=tabbable[0],lastTabbable=tabbable[tabbable.length-1];searchForm.addEventListener("keydown",function(e){switch(e.which){case 9:!function(e){e.target!=lastTabbable||e.shiftKey?e.target==firstTabbable&&e.shiftKey&&(e.preventDefault(),lastTabbable.focus()):(e.preventDefault(),firstTabbable.focus())}(e);break;case 27:emptySearchResults();break;case 38:!function(e){e.preventDefault(),e.target==firstTabbable?lastTabbable.focus():tabbable.forEach(function(el){el==e.target&&tabbable[tabbable.indexOf(el)-1].focus()})}(e);break;case 40:!function(e){e.preventDefault(),e.target==lastTabbable?firstTabbable.focus():tabbable.forEach(function(el){el==e.target&&tabbable[tabbable.indexOf(el)+1].focus()})}(e)}})},isSearchTermPresent=(func=function(){(searchTerm=searchField.value).length>2?getSearchResults():0==searchTerm.length&&emptySearchResults()},wait=250,function(){var context=this,args=arguments,callNow=immediate&&!timeout;clearTimeout(timeout),timeout=setTimeout(function(){timeout=null,immediate||func.apply(context,args)},wait||200),callNow&&func.apply(context,args)});searchField.addEventListener("input",function(e){9!=e.which&&40!=e.which&&38!=e.which&&27!=e.which&&searchTerm!=searchField.value&&isSearchTermPresent()})};if(document.attachEvent?"complete"===document.readyState:"loading"!==document.readyState){var searchResults=document.querySelectorAll(".hs-search-field");Array.prototype.forEach.call(searchResults,function(el){hsSearch(el)})}else document.addEventListener("DOMContentLoaded",function(){var searchResults=document.querySelectorAll(".hs-search-field");Array.prototype.forEach.call(searchResults,function(el){hsSearch(el)})})}();
2//# sourceURL=https://7233458.fs1.hubspotusercontent-na1.net/hubfs/7233458/hub_generated/module_assets/1/216666621033/1784638171476/module_CHQ_filter_search.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.