PageSourceSearch

https://wiha.com/theme/d526f1b6dff22d973abb0afcbfa55c26/js/storefr…front.filter-rating-select.plugin.9857ab.js

js wiha.com collected 2026-09-24 10:11:50 UTC 7,297 bytes, 1 lines download raw bytes

1"use strict";(self.webpackChunk=self.webpackChunk||[]).push([[94643,400],{9304:(t,e,i)=>{i.d(e,{Z:()=>n});var s=i(9568),l=i(4049);class n extends s.Z{_init(){super._init(),this._validateMethods();let t=l.Z.querySelector(document,this.options.parentFilterPanelSelector);this.listing=window.PluginManager.getPluginInstanceFromElement(t,"Listing"),this.listing.registerFilter(this),this._preventDropdownClose()}_preventDropdownClose(){let t=l.Z.querySelector(this.el,this.options.dropdownSelector,!1);t&&t.addEventListener("click",t=>{t.stopPropagation()})}_validateMethods(){if("function"!=typeof this.getValues)throw Error("[".concat(this._pluginName,'] Needs the method "getValues"\''));if("function"!=typeof this.getLabels)throw Error("[".concat(this._pluginName,'] Needs the method "getLabels"\''));if("function"!=typeof this.reset)throw Error("[".concat(this._pluginName,'] Needs the method "reset"\''));if("function"!=typeof this.resetAll)throw Error("[".concat(this._pluginName,'] Needs the method "resetAll"\''))}}n.options={parentFilterPanelSelector:".cms-element-product-listing-wrapper",dropdownSelector:".filter-panel-item-dropdown"}},400:(t,e,i)=>{i.r(e),i.d(e,{default:()=>a});var s=i(4049),l=i(3266),n=i(9304),o=i(1857),r=i.n(o);class a extends n.Z{init(){this.selection=[],this.counter=s.Z.querySelector(this.el,this.options.countSelector),this.mainFilterButton=s.Z.querySelector(this.el,this.options.mainFilterButtonSelector,!1),this._registerEvents()}_registerEvents(){let t=s.Z.querySelectorAll(this.el,this.options.checkboxSelector);l.Z.iterate(t,t=>{t.addEventListener("change",this._onChangeFilter.bind(this))})}getValues(){let t=s.Z.querySelectorAll(this.el,"".concat(this.options.checkboxSelector,":checked"),!1),e=[];t?l.Z.iterate(t,t=>{e.push(t.id)}):e=[],this.selection=e,this._updateCount();let i={};return i[this.options.name]=e,i}getLabels(){let t=s.Z.querySelectorAll(this.el,"".concat(this.options.checkboxSelector,":checked"),!1),e=[];return t?l.Z.iterate(t,t=>{e.push({label:t.dataset.label,id:t.id})}):e=[],e}setValuesFromUrl(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=!1,i=t[this.options.name],l=i?i.split("|"):[],n=this.selection.filter(t=>!l.includes(t)),o=l.filter(t=>!this.selection.includes(t));return(n.length>0||o.length>0)&&(e=!0),o.forEach(t=>{let e=s.Z.querySelector(this.el,'[id="'.concat(t,'"]'),!1);e&&(e.checked=!0,this.selection.push(e.id))}),n.forEach(t=>{this.reset(t),this.selection=this.selection.filter(e=>e!==t)}),this._updateCount(),e}_onChangeFilter(){this.listing.changeListing(!0,{p:1})}reset(t){let e=s.Z.querySelector(this.el,'[id="'.concat(t,'"]'),!1);e&&(e.checked=!1)}resetAll(){this.selection.filter=[];let t=s.Z.querySelectorAll(this.el,"".concat(this.options.checkboxSelector,":checked"),!1);t&&l.Z.iterate(t,t=>{t.checked=!1})}refreshDisabledState(t){let e=t[this.options.name];if(!e.entities||e.entities.length<1){this.disableFilter();return}this.enableFilter(),this._disableInactiveFilterOptions(e.entities.map(t=>t.id))}_disableInactiveFilterOptions(t){let e=s.Z.querySelectorAll(this.el,this.options.checkboxSelector);l.Z.iterate(e,e=>{!0!==e.checked&&(t.includes(e.id)?this.enableOption(e):this.disableOption(e))})}disableOption(t){let e=t.closest(this.options.listItemSelector);e.classList.add("disabled"),e.setAttribute("title",this.options.snippets.disabledFilterText),t.disabled=!0}enableOption(t){let e=t.closest(this.options.listItemSelector);e.removeAttribute("title"),e.classList.remove("disabled"),t.disabled=!1}enableAllOptions(){let t=s.Z.querySelectorAll(this.el,this.options.checkboxSelector);l.Z.iterate(t,t=>{this.enableOption(t)})}disableFilter(){let t=s.Z.querySelector(this.el,this.options.mainFilterButtonSelector);t.classList.add("disabled"),t.setAttribute("disabled","disabled"),t.setAttribute("title",this.options.snippets.disabledFilterText)}enableFilter(){let t=s.Z.querySelector(this.el,this.options.mainFilterButtonSelector);t.classList.remove("disabled"),t.removeAttribute("disabled"),t.removeAttribute("title")}_updateCount(){this.counter.textContent=this.selection.length?"(".concat(this.selection.length,")"):"",this._updateAriaLabel()}_updateAriaLabel(){if(this.options.snippets.ariaLabel){if(0===this.selection.length){this.mainFilterButton.setAttribute("aria-label",this.options.snippets.ariaLabel);return}this.mainFilterButton.setAttribute("aria-label","".concat(this.options.snippets.ariaLabel," (").concat(this.options.snippets.ariaLabelCount.replace("%count%",this.selection.length.toString()),")"))}}}a.options=r()(n.Z.options,{checkboxSelector:".filter-multi-select-checkbox",countSelector:".filter-multi-select-count",listItemSelector:".filter-multi-select-list-item",snippets:{disabledFilterText:"Filter not active",ariaLabel:"",ariaLabelCount:""},mainFilterButtonSelector:".filter-panel-item-toggle"})}
1,5430:(t,e,i)=>{i.r(e),i.d(e,{default:()=>a});var s=i(400),l=i(3266),n=i(4049),o=i(1857),r=i.n(o);class a extends s.default{getValues(){let t={},e=n.Z.querySelector(this.el,"".concat(this.options.checkboxSelector,":checked"),!1);return this.currentRating=e.value,this._updateCount(),t[this.options.name]=this.currentRating?this.currentRating.toString():"",t}setValuesFromUrl(t){let e=!1;return Object.keys(t).forEach(i=>{if(i===this.options.name){this.currentRating=t[i],this._updateCount();let s=n.Z.querySelectorAll(this.el,this.options.checkboxSelector,!1);s&&l.Z.iterate(s,t=>{t.value===this.currentRating&&(t.checked=!0)}),e=!0}}),e}getLabels(){let t=n.Z.querySelector(this.el,this.options.checkboxSelector+":checked",!1).value,e=[];if(t){let i=this.options.snippets.filterRatingActiveLabelEnd;1===parseInt(t)&&(i=this.options.snippets.filterRatingActiveLabelEndSingular),e.push({label:"".concat(this.options.snippets.filterRatingActiveLabelStart,"\n                        ").concat(t,"/").concat(this.options.maxPoints,"\n                        ").concat(i),id:"rating"})}else e=[];return e}refreshDisabledState(t){let e=t[this.options.name].max;if(e&&e>0){this.enableFilter(),this._disableInactiveFilterOptions(e);return}this.disableFilter()}_disableInactiveFilterOptions(t){let e=n.Z.querySelectorAll(this.el,this.options.checkboxSelector);l.Z.iterate(e,e=>{!0!==e.checked&&(t>=e.value?this.enableOption(e):this.disableOption(e))})}reset(){this.resetAll()}_updateCount(){this.counter.textContent=this.currentRating?"(".concat(this.currentRating,"/").concat(this.options.maxPoints,")"):"",this._updateAriaLabel()}_updateAriaLabel(){if(this.options.snippets.ariaLabel){if(void 0===this.currentRating){this.mainFilterButton.setAttribute("aria-label",this.options.snippets.ariaLabel);return}if(1===parseInt(this.currentRating)){this.mainFilterButton.setAttribute("aria-label","".concat(this.options.snippets.ariaLabel," (").concat(this.options.snippets.ariaLabelCountSingular,")"));return}this.mainFilterButton.setAttribute("aria-label","".concat(this.options.snippets.ariaLabel," (").concat(this.options.snippets.ariaLabelCount.replace("%stars%",this.currentRating),")"))}}}a.options=r()(s.default.options,{maxPoints:5,snippets:{filterRatingActiveLabelStart:"Minimum",filterRatingActiveLabelEndSingular:"star",filterRatingActiveLabelEnd:"stars",disabledFilterText:"Filter not active",ariaLabel:"",ariaLabelCount:"",ariaLabelCountSingular:""}})}}]);

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.