PageSourceSearch

https://bpn.gov.pl/build/assets/shopSearch-69327fad.js

js bpn.gov.pl collected 2026-10-02 18:29:59 UTC 2,974 bytes, 1 lines download raw bytes

1const T=()=>{const o=document.getElementById("shop-search-form"),h=document.getElementById("shop-search-results-form"),r=document.getElementById("js-shop-serach-list"),k=r==null?void 0:r.getAttribute("data-action"),u=document.querySelectorAll(".js-shop-search-change-category"),A=document.getElementById("js-results-category-results-count"),p=document.getElementById("js-shop-search-per-page"),m=document.getElementById("js-shop-search-word-type"),i=document.getElementById("js-shop-search-results-sort");let v=1;const C=p?parseInt(p.value,10):10;let I=null;const n=h?h==null?void 0:h.querySelectorAll('input[name="categories[]"]'):o==null?void 0:o.querySelectorAll('input[name="categories[]"]'),f=n?Array.from(n).find(t=>t.value==="all"):null,l=document.querySelectorAll(".js-shop-search-status"),s=l?Array.from(l).find(t=>t.value==="all"):null,y=o==null?void 0:o.querySelectorAll(".js-top-shop-search"),d=document.getElementById("js-shop-search-word");let j;const L=()=>{const t=document.querySelectorAll(".js-pagination-value");t==null||t.forEach(c=>{c.addEventListener("click",a=>{c.getAttribute("data-prevent-default")!=="0"&&a.preventDefault();const e=c==null?void 0:c.getAttribute("data-value");if(!e){console.error("Pagination button has no value");return}const g=parseInt(e,10);g!==v&&(v=g,E())})})},E=(t=!1)=>{clearTimeout(j),j=setTimeout(()=>{if(!k)return;const c={};c.page=t?1:v,c.perPage=C,c.category=I,c.word=d==null?void 0:d.value,c.wordType=m==null?void 0:m.value,c.sort=i==null?void 0:i.value;const a=[];n.forEach(e=>{e.checked&&e.value!=="all"&&a.push(parseInt(e.value,10))}),c.categories=a,l==null||l.forEach(e=>{e.checked&&(c[e.name]=!0)}),fetch(k,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(c)}).then(e=>{if(e.ok)return e.json();throw new Error("An error occurred.")}).then(e=>{console.log(r),console.log(e==null?void 0:e.html),r&&(r.innerHTML=e==null?void 0:e.html);const g=`${e==null?void 0:e.maxItems} ${e==null?void 0:e.maxItemsTrans}`;A&&(A.innerHTML=g),L()}).catch(e=>{console.error(e)})},200)};n==null||n.forEach(t=>{t.addEventListener("change",()=>{t.value==="all"?t.checked&&n.forEach(c=>{c!==t&&(c.checked=!1)}):t.checked&&f?f.checked=!1:!Array.from(n).some(a=>a.checked&&a.value!=="all")&&f&&(f.checked=!0)})}),l==null||l.forEach(t=>{t.addEventListener("change",()=>{t.value==="all"?t.checked&&l.forEach(c=>{c!==t&&(c.checked=!1)}):t.checked&&s?s.checked=!1:!Array.from(l).some(a=>a.checked&&a.value!=="all")&&s&&(s.checked=!0)})}),y==null||y.forEach(t=>{t.addEventListener("click",()=>{if(d){d.value=t.innerHTML;const a=d.getBoundingClientRect().top+window.scrollY-50;window.scrollTo({top:a,behavior:"smooth"})}})}),u==null||u.forEach(t=>{t.addEventListener("click",c=>{c.preventDefault();const a=t.getAttribute("data-category");a&&(I=parseInt(a,10),u.forEach(e=>{e.classList.remove("active")}),t.classList.add("active"),E(!0))})}),i==null||i.addEventListener("change",()=>{E(!0)}),L()};export{T as init};

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.