PageSourceSearch

https://www.shoppuff.com/wp-content/plugins/joint-ecommerce/public…joint-ecommerce-typeahead.min.js?ver=1.45.0

js shoppuff.com collected 2026-10-01 14:13:00 UTC 8,788 bytes, 1 lines download raw bytes

1(()=>{var i,t,e,n,a,o=window.jointTypeahead;function p(t){return o.displays&&o.displays[t]||a[t]||"rail"}function r(t,e){t=document.createElement(t);return e&&(t.className=e),t}function d(t){var e;return"specials"===t.key&&(e=document.body.classList).contains("ma-compliance-enabled")&&e.contains("joint-store-state-ma")?"Shop Offers":t.label}function s(t){return t&&"NOT_APPLICABLE"!==t?t.toLowerCase().split("_").map(function(t){return t.charAt(0).toUpperCase()+t.slice(1)}).join(" "):""}function h(t){var i,n,a;this.input=t,this.options=[],this.activeIndex=-1,this.controller=null,this.lastData=null,this.panel=r("div","joint-typeahead__panel"),this.panel.setAttribute("role","listbox"),this.panel.hidden=!0,document.body.appendChild(this.panel),t.setAttribute("role","combobox"),t.setAttribute("aria-autocomplete","list"),t.setAttribute("aria-expanded","false"),t.setAttribute("autocomplete","off"),this.onInput=(i=this.query.bind(this),n=250,function(){var t=this,e=arguments;clearTimeout(a),a=setTimeout(function(){i.apply(t,e)},n)}),t.addEventListener("input",this.onInput),t.addEventListener("keydown",this.onKeyDown.bind(this)),t.addEventListener("focus",this.query.bind(this)),this.onDocClick=this.onDocClick.bind(this),document.addEventListener("click",this.onDocClick),this.reposition=this.reposition.bind(this),window.addEventListener("resize",this.reposition,!0),window.addEventListener("scroll",this.reposition,!0),this.mq=window.matchMedia("(min-width: 1024px)"),this.onBreakpoint=this.onBreakpoint.bind(this),this.mq.addEventListener?this.mq.addEventListener("change",this.onBreakpoint):this.mq.addListener(this.onBreakpoint)}function l(){document.querySelectorAll(o.inputSelector).forEach(function(t){t.dataset.jointTypeahead||(t.dataset.jointTypeahead="1",new h(t))})}o&&o.suggestUrl&&o.inputSelector&&(i=o.minChars||2,t=o.mode||"classic",e=[{key:"categories",label:"Categories"},{key:"specials",label:"Specials"},{key:"brands",label:"Brands"},{key:"products",label:"Products"}],n=[{key:"categories",label:"Categories"},{key:"specials",label:"Specials"},{key:"brands",label:"Brands"}],a={categories:"rail",specials:"rail",brands:"rail",products:"card"},h.prototype.isMega=function(){return"mega_menu"===t&&this.mq.matches&&"card"===p("products")},h.prototype.onBreakpoint=function(){!this.panel.hidden&&this.lastData&&this.render(this.lastData)},h.prototype.query=function(){var e,t=this.input.value.trim();t.length<i?this.close():(this.controller&&this.controller.abort(),this.controller=new AbortController,t=o.suggestUrl+"?q="+encodeURIComponent(t),e=this,fetch(t,{credentials:"same-origin",signal:this.controller.signal}).then(function(t){return t.ok?t.json():null}).then(function(t){t&&(e.lastData=t,e.render(t))}).catch(function(){}))},h.prototype.render=function(t){this.panel.textContent="",this.options=[],this.activeIndex=-1,this.isMega()?(this.panel.classList.add("joint-typeahead__panel--mega"),this.renderMega(t)):(this.panel.classList.remove("joint-typeahead__panel--mega"),this.renderList(t)),this.options.length?this.panel.appendChild(this.buildFooter()):(this.panel.textContent="",this.panel.classList.remove("joint-typeahead__panel--mega"),this.renderEmpty()),this.open()},h.prototype.renderEmpty=function(){var t=r("div","joint-typeahead__empty");t.textContent="No matches found",this.panel.appendChild(t)},h.prototype.renderList=function(a){e.forEach(function(e){var t,i,n;"hidden"!==p(e.key)&&(t=a[e.key])&&t.length&&(i=r("div","joint-typeahead__group"),(n=r("div","joint-typeahead__group-label")).textContent=d(e),i.appendChild(n),t.forEach(function(t){t.url&&i.appendChild(this.buildOption(t,e.key))}.bind(this)),this.panel.appendChild(i))},this)},h.prototype.renderMega=function(t){var e=r("div","joint-typeahead__mega"),i=this.buildRail(t),i=(i&&e.appendChild(i),t.products||[]),t=r("div","joint-typeahead__mega-main"),n=r("div","joint-typeahead__group-label"),a=(n.textContent="Products",t.appendChild(n),r("div","joint-typeahead__cards"));i.forEach(function(t){t.url&&a.appendChild(this.buildCard(t))},this),t.appendChild(a),e.appendChild(t),this.panel.appendChild(e)},h.prototype.buildRail=function(a){var o=r("div","joint-typeahead__rail"),s=!1;
1return n.forEach(function(t){var e,i,n;"rail"===p(t.key)&&(e=a[t.key])&&e.length&&(s=!0,i=r("div","joint-typeahead__rail-group"),(n=r("div","joint-typeahead__group-label")).textContent=d(t),i.appendChild(n),e.forEach(function(t){t.url&&i.appendChild(this.buildRailLink(t))},this),o.appendChild(i))},this),s?o:null},h.prototype.buildRailLink=function(t){var e=r("a","joint-typeahead__rail-link"),i=(e.href=t.url,e.setAttribute("role","option"),r("span","joint-typeahead__rail-text"));return i.textContent=t.name,e.appendChild(i),this.wireOption(e,t.url),e},h.prototype.buildCard=function(t){var e,i=r("a","joint-typeahead__card"),n=(i.href=t.url,i.setAttribute("role","option"),r("div","joint-typeahead__card-image-wrap")),a=(t.image&&((a=r("img","joint-typeahead__card-image")).src=t.image,a.alt="",a.loading="lazy",n.appendChild(a)),i.appendChild(n),r("div","joint-typeahead__card-body")),n=(t.brand&&((n=r("span","joint-typeahead__card-brand")).textContent=t.brand,a.appendChild(n)),r("span","joint-typeahead__card-name")),n=(n.textContent=t.name,a.appendChild(n),r("div","joint-typeahead__card-meta")),o=(t.price&&((o=r("span","joint-typeahead__card-price")).textContent=t.price,n.appendChild(o)),s(t.strain));return o&&((e=r("span","joint-typeahead__card-strain")).textContent=o,n.appendChild(e)),a.appendChild(n),i.appendChild(a),this.wireOption(i,t.url),i},h.prototype.searchUrl=function(t){var e=o.menuUrl||"/menu/",i=-1===e.indexOf("?")?"?":"&";return e+i+"s="+encodeURIComponent(t)},h.prototype.buildFooter=function(){var t=r("a","joint-typeahead__footer"),e=this.input.value.trim(),i=this.searchUrl(e),n=(t.href=i,r("span","joint-typeahead__footer-text")),a=(n.textContent='See all results for "'+e+'"',t.appendChild(n),this);return t.addEventListener("mousedown",function(t){t.preventDefault(),a.go(i)}),t},h.prototype.wireOption=function(t,e){var i=this.options.length,n=this;t.addEventListener("mousemove",function(){n.setActive(i)}),t.addEventListener("mousedown",function(t){t.preventDefault(),n.go(e)}),this.options.push(t)},h.prototype.buildOption=function(t,e){var i,n=r("a","joint-typeahead__option"),a=(n.href=t.url,n.setAttribute("role","option"),"products"===e&&t.image&&((a=r("img","joint-typeahead__option-image")).src=t.image,a.alt="",a.loading="lazy",n.appendChild(a)),r("span","joint-typeahead__option-text")),o=r("span","joint-typeahead__option-name");return o.textContent=t.name,a.appendChild(o),t.brand&&((o=r("span","joint-typeahead__option-brand")).textContent=t.brand,a.appendChild(o)),"products"===e&&(o=s(t.strain),t.price||o)&&(e=r("div","joint-typeahead__option-meta"),t.price&&((i=r("span","joint-typeahead__option-price")).textContent=t.price,e.appendChild(i)),o&&((i=r("span","joint-typeahead__option-strain")).textContent=o,e.appendChild(i)),a.appendChild(e)),n.appendChild(a),this.wireOption(n,t.url),n},h.prototype.setActive=function(t){-1<this.activeIndex&&this.options[this.activeIndex]&&this.options[this.activeIndex].classList.remove("joint-typeahead__option--active"),this.activeIndex=t;t=this.options[t];t&&(t.classList.add("joint-typeahead__option--active"),this.input.setAttribute("aria-activedescendant",""),t.scrollIntoView({block:"nearest"}))},h.prototype.move=function(t){this.options.length&&((t=this.activeIndex+t)<0?t=this.options.length-1:t>=this.options.length&&(t=0),this.setActive(t))},h.prototype.onKeyDown=function(t){if(!this.panel.hidden)switch(t.key){case"ArrowDown":t.preventDefault(),this.move(1);break;case"ArrowUp":t.preventDefault(),this.move(-1);break;case"Enter":-1<this.activeIndex&&this.options[this.activeIndex]&&(t.preventDefault(),this.go(this.options[this.activeIndex].href));break;case"Escape":this.close()}},h.prototype.go=function(t){window.location.assign(t)},h.prototype.reposition=function(){var t,e,i;this.panel.hidden||(t=(this.input.form||this.input).getBoundingClientRect(),this.panel.style.top=t.bottom+4+"px",this.panel.classList.contains("joint-typeahead__panel--mega")?(e=window.innerWidth-16-16,e=Math.min(920,e),i=Math.max(16,t.right-e),this.panel.style.left=i+"px",this.panel.style.width=e+"px"):(this.panel.style.left=t.left+"px",this.panel.style.width=t.width+"px"))},h.prototype.open=function(){this.panel.hidden=!1,this.reposition(),this.input.setAttribute("aria-expanded","true")},h.prototype.close=function(){this.panel.hidden=!0,this.activeIndex=-1,this.input.setAttribute("aria-expanded","fal
1se")},h.prototype.onDocClick=function(t){this.input===t.target||this.panel.contains(t.target)||this.close()},"loading"===document.readyState?document.addEventListener("DOMContentLoaded",l):l())})();

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.