PageSourceSearch

https://felgeo.pl/gfx/eng/menu_filter.js.gzip?r=1783590932

js felgeo.pl collected 2026-10-04 04:09:54 UTC 10,287 bytes, 1 lines download raw bytes

1const filtersActionsCall=()=>{document.querySelectorAll(".filters__options .--show-hidden").forEach((e=>{e.addEventListener("click",(e=>{e.preventDefault();const t=e.target.closest(".--show-hidden"),{id:r}=t.dataset,s=document.querySelector(`#${r}_content`);s?.classList.toggle("--shown"),t.classList.toggle("--shown")}))}));document.querySelectorAll(".filters__toggler:not(.--not-expandable)").forEach((e=>{e.addEventListener("click",(e=>{e.preventDefault();const t=e.target.closest(".filters__toggler:not(.--not-expandable)");t.classList.toggle("--not-expanded"),t.setAttribute("aria-expanded",t.classList.contains("--not-expanded")?"false":"true")}))}));document.querySelectorAll(".filters__item .f-control[type=checkbox]").forEach((e=>{e.addEventListener("change",(e=>{const t=e.target.closest(".filters__content:not(.--group)");if(!t)return;const r=t.nextElementSibling;if(!r)return;const s=r.querySelector(".--submit.d-none");s&&s.classList.remove("d-none")}))}));document.querySelectorAll("#filter_xpress_expand input").forEach((e=>{e.addEventListener("change",(e=>{const{checked:t}=e.target;if(!t)return;const{localized:r}=e.target.dataset;if(!r||"true"===r)return;const s=document.querySelector("#xpress_modal");s&&(app_shop.vars.xpressClicked=e.target.id,Modal({element:s,classList:"--xpress"}))}))}))},Filters=function(e){this.params=e,this.isFilterRange=document.querySelector(".filters__content.--range"),this.vars={timer:"",timerInterval:700},this.setInputValue=e=>{const{id:t}=e.dataset,r=[...document.querySelectorAll(`input[data-id="${t}"]:checked`)].map((e=>e.value)).join(",");document.querySelector(`#${t}_input`).value=r},this.setLabeLsQuantity=async()=>{clearTimeout(this.vars.timer),this.vars.timer=setTimeout((async()=>{const e=await fetch(`/search.php?${this.serialize()}&getProductXML=true&xmlType=filtering`),t=await e.text();[...(new DOMParser).parseFromString(t,"text/xml").querySelectorAll("filter")].forEach((e=>{const{type:t}=e.attributes;let r=e.id.replace(/\[(.*?)\]/g,"$1"),s=document.querySelector(`#${r}_expand`);if("dual"===t.value&&(r="filter_dual",s=document.querySelector("#filter_dual_expand")),s&&"filter_text"!==r){const t=e.querySelectorAll("item");t.length&&[...t].forEach((e=>{const{value:t,quantity:n}=e.attributes,i='label[for="'+r+"_"+t.value+'"] .--quantity',a=s.querySelector(i);if(a){const e=a.closest("label");n?(e.classList.remove("--disabled"),a.classList.remove("d-none"),a.innerHTML=n.value):(e.classList.add("--disabled"),a.classList.add("d-none"),a.innerHTML=0)}}))}}))}),this.vars.timerInterval)},this.serialize=(e=".__serialize")=>[...this.filtersForm.querySelectorAll(e)].filter((e=>"checkbox"===e.type?e.checked:e.value)).map((e=>`${e.name}=${e.value}`)).join("&"),this.setVisibleExpand=()=>{const e=document.querySelectorAll(".--not-expanded");if(!e.length)return app_shop.fn.cookie.set("filterHidden","",355),!1;const t=[...e].map((e=>e.nextSibling.id));app_shop.fn.cookie.set("filterHidden",t,355)},this.getVisibleExpand=()=>{const e=app_shop.fn.cookie.get("filterHidden");e&&e.split(",").forEach((e=>{const t=document.querySelector(`.filters__expand#${e}`);if(null!==t){const e=t.previousSibling;e.classList.add("--not-expanded"),e.setAttribute("aria-expanded","false")}}))},this.start=()=>{this.filtersForm.querySelectorAll('input[type="checkbox"]').forEach((e=>{e.addEventListener("change",(e=>{const{target:t}=e,{id:r}=t.dataset;r&&this.setInputValue(t),this.getQuantity&&this.setLabeLsQuantity()}))})),this.actionsCall&&this.actionsCall();document.querySelectorAll(".filters__toggler:not(.--not-expandable)").forEach((e=>{e.addEventListener("click",(()=>{this.setVisibleExpand()}))})),this.getVisibleExpand()},this.rangeSetValues=e=>{const t=e.closest(".filters__block").querySelector("input.__serialize"),r=e.closest(".filters__content").querySelector(".filters__range_slider"),s=getComputedStyle(r).getPropertyValue("--value-min"),n=getComputedStyle(r).getPropertyValue("--value-max");if(!e.closest(".filters__content").getAttribute("data-names"))return t.value=`${s}-${n}`,!1;const i=e.closest(".filters__content").getAttribute("data-values").split(";");return t.value=i.filter(((e,t)=>t>=s&&t<=n)).join(","),!0},this.rangeFindClosestValue=(e,t)=>
1{const r=e.closest(".filters__content").getAttribute("data-names");if(!r)return t;return r.split(";").reduce(((e,r)=>Math.abs(r-t)<Math.abs(e-t)?r:e))},this.rangeGetName=(e,t)=>{const r=e.closest(".filters__content").getAttribute("data-names");if(!r)return this.rangeCheckValue(e);return r.split(";")[t]},this.rangeGetPosition=(e,t)=>{const r=e.closest(".filters__content").getAttribute("data-names");if(!r)return this.rangeCheckValue(e);return r.split(";").indexOf(t)},this.rangeCheckValue=e=>{let{value:t}=e;const{type:r}=e,s=e.closest(".filters__content");if(e.classList.contains("--min")){const n=e.closest(".--inputs-wrapper").querySelector("input.--max").value;+t>+n&&(t=n);const i="range"===r?0:s.getAttribute("data-min");return+t<+i&&(t=i),t}const n=e.closest(".--inputs-wrapper").querySelector("input.--min").value;+t<+n&&(t=n);const i=s.querySelector(".filters__range_slider"),a=getComputedStyle(i).getPropertyValue("--max"),o="range"===r?a:s.getAttribute("data-max");return+t>+o&&(t=o),t},this.rangeSetInputs=e=>{const t=this.rangeCheckValue(e),{type:r}=e,s=e.classList.contains("--min")?"min":"max",n=e.closest(".filters__content").querySelector(`.--input-range.--${s}`),i=e.closest(".filters__content").querySelector(`.--input-number.--${s}`);if("range"===r)return i.value=this.rangeGetName(e,t),n.value=t,n.parentNode.style.setProperty(`--value-${s}`,t),this.rangeEvents.setWidth(i),!1;const a=this.rangeFindClosestValue(e,t);i.value=a;const o=this.rangeGetPosition(e,a);return n.value=o,n.parentNode.style.setProperty(`--value-${s}`,o),this.rangeEvents.setWidth(i),!0},this.rangeZindex=e=>{const t=e.closest(".filters__content").querySelector(".--input-range.--min"),r=e.closest(".filters__content").querySelector(".filters__range_slider");return+getComputedStyle(r).getPropertyValue("--max")===+getComputedStyle(r).getPropertyValue("--value-min")||e===t?(t.classList.add("--z-index"),!1):(t.classList.remove("--z-index"),!0)},this.rangeClear=e=>{const t=e.closest(".filters__block").querySelector(".--input-range.--min"),r=e.closest(".filters__block").querySelector(".--input-range.--max");t.value=t.min,r.value=r.max,this.rangeSetInputs(t),this.rangeSetInputs(r),e.closest(".filters__block").querySelector(".__serialize").value="",this.setLabeLsQuantity()},this.rangeEvents={inputs:e=>{const{target:t}=e;return this.rangeSetInputs(t),this.rangeZindex(t),this.rangeSetValues(t),this.setLabeLsQuantity(),!0},setWidth:e=>{const t=e.target||e;t.style.width=`${t.value.length+1}ch`},submit:e=>{e.preventDefault();const t=e.target.closest(".filters__expand").querySelector(".--input-range.--min");return this.rangeSetValues(t),document.querySelector(".filters__buttons button")?.click(),!1},clear:e=>{const{target:t}=e;return e.preventDefault(),this.rangeClear(t),!1},focus:e=>!(app_shop.vars.view>2)&&(setTimeout((()=>{e.target.scrollIntoView({behavior:"smooth",block:"center"})}),"150"),!0)},this.rangeInitEvents=()=>{document.querySelectorAll(".filters__range_slider input").forEach((e=>{e.addEventListener("input",this.rangeEvents.inputs)})),document.querySelectorAll(".filters__range input").forEach((e=>{e.addEventListener("change",this.rangeEvents.inputs),e.addEventListener("input",this.rangeEvents.setWidth)})),document.querySelectorAll(".filters__range input.--input-number").forEach((e=>{e.addEventListener("focus",this.rangeEvents.focus)})),document.querySelectorAll(".filters__options.--range a.--submit-range").forEach((e=>{e.addEventListener("click",this.rangeEvents.submit)}))},this.rangeSlider=()=>!!document.querySelectorAll(".filters__content.--range").length&&(this.rangeInitEvents(),!0),this.init=()=>{this.filtersForm=document.querySelector(".filters__form"),this.filtersForm&&(this.actionsCall=filtersActionsCall||null,this.getQuantity=!0,this.rangeSlider(),this.start())}};app_shop.run((()=>{app_shop.vars.filtersRef=new Filters,app_shop.vars.filtersRef.init()}),"all","#Filters",!0);const xpressText={geolocationError:"An error occurred checking the postal code. Please try again",zipcodeError:"Unable to retrieve ZIP code"};app_shop.fn.xpressCouriersInit=()=>{const e=document.querySelector("#xpress_modal");if(!e)return;const t=new FormValidation({form:e});t.init();const r=()=>{const e=document.querySelector(".modal");e&&e.classList.add("--loading")},s=()=>{const e=document.querySelector(".modal");e&&e.classList.remove("--loading")},n=()=>{const e=document.querySelector("#xpress_error_modal");e&&Modal({element:e,classList:"--xpress-error"})};if(!navigator.geolocation){const e=document.querySelector(".xpress__geolocation");if(!e)return;e.remove()}e.addEventListener("click",(e=>{const{target:i}=e;i.closest(".xpress_submit")&&(e.preventDefault(),(async()=>{const e=document.querySelector("#xpress_zipcode_input");if(!e)return;if(r(),!await t.validateForm())return void s();const{value:i}=e;if(!(await fetch(`/ajax/client-new.php?setClientSamedayLocation=1&zipcode=${i}`,{method:"POST"})).ok)return void n();const a=await fetch("/search.php?&getProductXML=true&xmlType=filtering");if(!a.ok)return void n();const o=await a.text(),l=(new DOMParser).parseFromString(o,"text/xml"),c=l.querySelector("sameday")||l.querySelector("nextday");if(!c)return void n();const u=c.getAttribute("client_localized"),d=c.getAttribute("service_available_for_current_location");if("false"===u||"false"===d)return void n();const p=document.querySelector("#Filters form");p&&p.submit()})()),i.closest(".xpress__get_geo")&&(e.preventDefault(),navigator.geolocation&&(r(),navigator.geolocation.getCurrentPosition((async e=>{const{latitude:r,longitude:n}=e.coords||{},i=`https://nominatim.openstreetmap.org/reverse?format=json&lat=${r}&lon=${n}`,a=await fetch(i),o=await a.json(),{address:{postcode:l}={}}=o||{};if(!l)return s(),void Alertek.show_alert(xpressText.zipcodeError);s();const c=document.querySelector("#xpress_zipcode_input");c&&(c.value=l,c.classList.add("focused"),t.validateForm())}),(()=>{s(),Alertek.show_alert(xpressText.geolocationError)}))))}))},app_shop.run((()=>{app_shop.fn.xpressCouriersInit()}),"all","#xpress_modal",!0);

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.