PageSourceSearch

https://shop.pook.ca/cdn/shop/t/16/assets/selectFx.js?v=131400943184630685371591936499

js pook.ca collected 2026-09-26 07:36:14 UTC 5,038 bytes, 2 lines download raw bytes

1(function(window2){"use strict";function hasParent(e,p){if(!e)return!1;for(var el=e.target||e.srcElement||e||!1;el&&el!=p;)el=el.parentNode||!1;return el!==!1}function extend(a,b){for(var key in b)b.hasOwnProperty(key)&&(a[key]=b[key]);return a}function SelectFx(el,options){this.el=el,this.options=extend({},this.options),extend(this.options,options),this._init()}SelectFx.prototype.options={newTab:!0,stickyPlaceholder:!0,onChange:function(val){return!1}},SelectFx.prototype._init=function(){var selectedOpt=this.el.querySelector("option[selected]");this.hasDefaultPlaceholder=selectedOpt&&selectedOpt.disabled,this.selectedOpt=selectedOpt||this.el.querySelector("option"),this._createSelectEl(),this.selOpts=[].slice.call(this.selEl.querySelectorAll("li[data-option]")),this.selOptsCount=this.selOpts.length,this.current=this.selOpts.indexOf(this.selEl.querySelector("li.cs-selected"))||-1,this.selPlaceholder=this.selEl.querySelector("span.cs-placeholder"),this._initEvents()},SelectFx.prototype._createSelectEl=function(){var self=this,options="",createOptionHTML=function(el){var optclass="",classes="",link="";return el.selectedOpt&&!this.foundSelected&&!this.hasDefaultPlaceholder&&(classes+="cs-selected ",this.foundSelected=!0),el.getAttribute("data-class")&&(classes+=el.getAttribute("data-class")),el.getAttribute("data-link")&&(link="data-link="+el.getAttribute("data-link")),classes!==""&&(optclass='class="'+classes+'" '),"<li "+optclass+link+' data-option data-value="'+el.value+'"><span>'+el.textContent+"</span></li>"};[].slice.call(this.el.children).forEach(function(el){if(!el.disabled){var tag=el.tagName.toLowerCase();tag==="option"?options+=createOptionHTML(el):tag==="optgroup"&&(options+='<li class="cs-optgroup"><span>'+el.label+"</span><ul>",[].slice.call(el.children).forEach(function(opt){options+=createOptionHTML(opt)}),options+="</ul></li>")}});var opts_el='<div class="cs-options"><ul>'+options+"</ul></div>";this.selEl=document.createElement("div"),this.selEl.className=this.el.className,this.selEl.tabIndex=this.el.tabIndex,this.selEl.innerHTML='<span class="cs-placeholder">'+this.selectedOpt.textContent+"</span>"+opts_el,this.el.parentNode.appendChild(this.selEl),this.selEl.appendChild(this.el)},SelectFx.prototype._initEvents=function(){var self=this;this.selPlaceholder.addEventListener("click",function(){self._toggleSelect()}
1),this.selOpts.forEach(function(opt,idx){opt.addEventListener("click",function(){self.current=idx,self._changeOption(),self._toggleSelect()})}),document.addEventListener("click",function(ev){var target=ev.target;self._isOpen()&&target!==self.selEl&&!hasParent(target,self.selEl)&&self._toggleSelect()}),this.selEl.addEventListener("keydown",function(ev){var keyCode=ev.keyCode||ev.which;switch(keyCode){case 38:ev.preventDefault(),self._navigateOpts("prev");break;case 40:ev.preventDefault(),self._navigateOpts("next");break;case 32:ev.preventDefault(),self._isOpen()&&typeof self.preSelCurrent!="undefined"&&self.preSelCurrent!==-1&&self._changeOption(),self._toggleSelect();break;case 13:ev.preventDefault(),self._isOpen()&&typeof self.preSelCurrent!="undefined"&&self.preSelCurrent!==-1&&(self._changeOption(),self._toggleSelect());break;case 27:ev.preventDefault(),self._isOpen()&&self._toggleSelect();break}})},SelectFx.prototype._navigateOpts=function(dir){this._isOpen()||this._toggleSelect();var tmpcurrent=typeof this.preSelCurrent!="undefined"&&this.preSelCurrent!==-1?this.preSelCurrent:this.current;(dir==="prev"&&tmpcurrent>0||dir==="next"&&tmpcurrent<this.selOptsCount-1)&&(this.preSelCurrent=dir==="next"?tmpcurrent+1:tmpcurrent-1,this._removeFocus(),classie.add(this.selOpts[this.preSelCurrent],"cs-focus"))},SelectFx.prototype._toggleSelect=function(){this._removeFocus(),this._isOpen()?(this.current!==-1&&(this.selPlaceholder.textContent=this.selOpts[this.current].textContent),classie.remove(this.selEl,"cs-active")):(this.hasDefaultPlaceholder&&this.options.stickyPlaceholder&&(this.selPlaceholder.textContent=this.selectedOpt.textContent),classie.add(this.selEl,"cs-active"))},SelectFx.prototype._changeOption=function(){typeof this.preSelCurrent!="undefined"&&this.preSelCurrent!==-1&&(this.current=this.preSelCurrent,this.preSelCurrent=-1);var opt=this.selOpts[this.current];this.selPlaceholder.textContent=opt.textContent,this.el.value=opt.getAttribute("data-value");var oldOpt=this.selEl.querySelector("li.cs-selected");oldOpt&&classie.remove(oldOpt,"cs-selected"),classie.add(opt,"cs-selected"),opt.getAttribute("data-link")&&(this.options.newTab?window2.open(opt.getAttribute("data-link"),"_blank"):window2.location=opt.getAttribute("data-link")),this.options.onChange(this.el.value)},SelectFx.prototype._isOpen=function(opt){return classie.has(this.selEl,"cs-active")},SelectFx.prototype._removeFocus=function(opt){var focusEl=this.selEl.querySelector("li.cs-focus");focusEl&&classie.remove(focusEl,"cs-focus")},window2.SelectFx=SelectFx})(window);
2//# sourceMappingURL=/cdn/shop/t/16/assets/selectFx.js.map?v=131400943184630685371591936499

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.