PageSourceSearch

https://wolfgreenfield.com/hubfs/hub_generated/module_assets/1/815…/1743267583932/module_team-search.min.js

js wolfgreenfield.com collected 2026-10-03 22:06:21 UTC 5,137 bytes, 1 lines download raw bytes

1var module_81549851446=function(){class ProfessionalsSearch extends HTMLElement{static get observedAttributes(){return["open","query"]}constructor(){super(),this.cachedResults={},this.searchInput=this.querySelector('input[name="q"]'),this.form=this.querySelector("form"),this.advInputs=this.querySelectorAll('input:not([name="q"]):not([type="hidden"]), select'),this.advInputs&&this.form&&this.setupEventListeners()}setupEventListeners(){this.form.addEventListener("reset",this.onFormReset.bind(this))}onFormSubmit(event){this.querySelector('[role="option"][aria-selected="true"] a')&&event.preventDefault()}onFormReset(event){event.preventDefault(),this.advInputs.forEach((el=>{"select"==el.tagName.toLowerCase()?el.selectedIndex=0:"radio"==el.type||"checkbox"==el.type?el.checked=!1:(el.value="",this.searchInput.value="")}))}onChange(){this.open&&this.suggest()}onFocus(e){this.term.length&&(this.open||(this.open=!0))}onFocusOut(){setTimeout((()=>{this.contains(document.activeElement)||(this.open=!1)}))}onKeyup(event){if(this.term.length)switch(event.preventDefault(),event.code){case"ArrowUp":this.switchOption("up");break;case"ArrowDown":this.switchOption("down");break;case"Escape":this.open=!1;break;case"Enter":this.selectOption()}else this.open=!1}onKeydown(event){"ArrowUp"!==event.code&&"ArrowDown"!==event.code||event.preventDefault()}renderSearchResults(resultsMarkup){this.suggestions.innerHTML=resultsMarkup,this.setAttribute("results",!0)}async suggest(){const formData=new FormData(this.form);formData.set("limit",3),formData.set("autocomplete",!0),formData.set("analytics",!0);const queryString=new URLSearchParams(formData).toString();console.log("Predicting...",queryString);const queryKey=queryString.replace(" ","-").toLowerCase();console.log("el query string: ",queryString);const fetchURL=`/_hcms/v3/site-search/search?${queryString}`;if(this.cachedResults[queryKey])return void this.renderSuggestions(this.cachedResults[queryKey]);const response=await fetch(fetchURL);if(!response.ok){const error=new Error(`${response.status} set hubdb table ${this.table} to "allow public api access".`);throw this.open=!1,error}const data=await response.json(),hubdbRowIds=data.results.map((result=>result.rowId.toString())),hubdbValues=await this.batchRetrieve(hubdbRowIds),resultsMarkup=data.results.map(((result,index)=>{result.values=hubdbValues[index],console.log(result);const start=new Date(result.values.start);return`\n        <div id="${this.id}-option-${index}" role="option" aria-selected="false">\n          <a href="/professionals/${result.path}" class="professionals-search__suggestion" tabindex="-1">\n            <svg height="18" width="18"><use href="#calendar"></use></svg>\n            <h3 class="font-body unstyled">${result.values.name}</h3>\n            <div class="p-sm">${start.toLocaleString("default",{month:"long"})} ${start.getUTCDate()}, ${start.getUTCFullYear()} ${result.values.time_zone?result.values.time_zone:""}</div>\n          </a>\n        </div>\n      `})).join("");this.cachedResults[queryKey]=resultsMarkup,this.renderSuggestions(resultsMarkup)}renderSuggestions(resultsMarkup){this.suggestions.innerHTML=resultsMarkup,this.setAttribute("results",!0),this.open=!0}switchOption(direction){if(!this.open)return;const moveUp="up"===direction,selectedElement=this.querySelector('[aria-selected="true"]'),allElements=this.querySelectorAll('[role="option"]');let activeElement=this.querySelector('[role="option"]');moveUp&&!selectedElement||(!moveUp&&selectedElement?activeElement=selectedElement.nextElementSibling||allElements[0]:moveUp&&(activeElement=selectedElement.previousElementSibling||allElements[allElements.length-1]),activeElement!==selectedElement&&(activeElement.setAttribute("aria-selected",!0),selectedElement&&selectedElement.setAttribute("aria-selected",!1),this.searchInput.setAttribute("aria-activedescendant",activeElement.id)))}selectOption(){const selectedResult=this.querySelector('[aria-selected="true"] a, [aria-selected="true"] button');selectedResult&&selectedResult.click()}close(clearSearchTerm=!1){clearSearchTerm&&(this.searchInput.value="");const selected=this.querySelector('[aria-selected="true"]');selected&&selected.setAttribute("aria-selected",!1),this.searchInput.setAttribute("aria-activedescendant",""),this.searchInput.setAttribute("aria-expanded",!1)}get term(){return this.searchInput.value.trim()}get target(){return this.getAttribute("target")}get query(){return this.getAttribute("query")}set query(val){null==val?this.removeAttribute("query"):this.setAttribute("query",val)}get open(){return!!this.hasAttribute("open")}set open(bool){!1===bool?(this.removeAttribute("open"),this.searchInput.setAttribute("aria-expanded",!1)):(this.setAttribute("open",""),this.searchInput.setAttribute("aria-expanded",!0))}attributeChangedCallback(attr,oldVal,newVal){console.log(attr,oldVal,newVal),"open"!==attr||this.open||oldVal===newVal||(console.log("closing",this.open),this.close()),"open"===attr&&this.open&&oldVal!==newVal&&(console.log("opening",this.open),this.suggest())}}customElements.define("professionals-search",ProfessionalsSearch)}();

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.