PageSourceSearch

https://www.calpaktravel.com/cdn/shop/t/3471/assets/collection-filters.js?v=173537187157596185181790184691

js calpaktravel.com collected 2026-09-24 21:16:33 UTC 5,698 bytes, 2 lines download raw bytes

1import{PopupModal}from"./popup-modal.js";if(!customElements.get("collection-filters")){class CollectionFilters extends PopupModal{#onGridUpdated=null;#onFormSubmit=null;#onClick=null;constructor(){super()}connectedCallback(){super.connectedCallback(),this.elSection=this.closest("section"),this.elGrid=this.closest("collection-grid"),this.elToggle=this.elSection?.querySelector("[data-filters-toggle]"),this.elForm=this.querySelector(".collection-filters--form"),this.elApply=this.querySelector(".collection-filters--apply"),this.elToggle?.addEventListener("click",()=>this.setAttribute("open",!0)),this.#syncToggleState(),this.#onFormSubmit=event=>{event.preventDefault(),this.#setFormBusy(!0),this.elGrid?.applyFilters(this.elForm)?.finally(()=>{this.#setFormBusy(!1)})},this.elForm?.addEventListener("submit",this.#onFormSubmit),this.#onClick=event=>{if(event.target.closest("[data-clear]")){event.preventDefault(),this.#clearActiveFilters(),this.#clearFilters();return}const elLink=event.target.closest("[data-active]");elLink?.href&&(event.preventDefault(),this.#removeActiveFilter(elLink.href),this.#setFormBusy(!0),this.elGrid?.applyFromUrl(elLink.href)?.finally(()=>{this.#setFormBusy(!1)}))},this.elGrid?.addEventListener("click",this.#onClick),this.#onGridUpdated=event=>{const source=event.detail?.source;source!=="filter"&&source!=="popstate"||(this.#syncFromSection(event.detail.elSection),source==="filter"&&this.close())},this.elGrid?.addEventListener("collection-grid:updated",this.#onGridUpdated),this.#bindPriceRangeFilters()}disconnectedCallback(){this.elForm&&this.#onFormSubmit&&this.elForm.removeEventListener("submit",this.#onFormSubmit),this.elGrid&&this.#onClick&&this.elGrid.removeEventListener("click",this.#onClick),this.elGrid&&this.#onGridUpdated&&this.elGrid.removeEventListener("collection-grid:updated",this.#onGridUpdated)}attributeChangedCallback(name,oldValue,newValue){name==="open"&&newValue==="true"&&this.#syncPromoOffset(),super.attributeChangedCallback(name,oldValue,newValue),name==="open"&&this.#syncToggleState()}#syncToggleState(){this.elToggle?.setAttribute("aria-expanded",String(this.getAttribute("open")==="true"))}#syncPromoOffset(){const elPromo=document.querySelector("promo-bar, [data-promo-banner], #FreeShippingBanner"),offset=elPromo?Math.max(0,Math.round(elPromo.getBoundingClientRect().bottom)):0;this.style.setProperty("--collection-filters-promo-offset",`${offset}px`)}#setFormBusy(isBusy){this.elForm&&this.elForm.setAttribute("aria-busy",String(isBusy)),this.elApply&&(this.elApply.disabled=isBusy);for(const elControl of this.elGrid?.querySelectorAll("[data-active], [data-clear]")??[]){if(elControl.matches("[data-clear]")){elControl.disabled=isBusy;continue}elControl.setAttribute("aria-disabled",String(isBusy)),isBusy?elControl.style.pointerEvents="none":elControl.style.pointerEvents=""}}#removeActiveFilter(removeUrl){const targetHref=new URL(removeUrl,window.location.origin).href;for(const elLink of this.elGrid?.querySelectorAll("[data-active]")??[])new URL(elLink.href,window.location.origin).href===targetHref&&elLink.closest(".collection-filters--active-value")?.remove();this.#updateClearButtons()}#clearActiveFilters(){for(const elActive of this.elGrid?.querySelectorAll(".collection-filters--active")??[])elActive.querySelector(".collection-filters--active-values")?.replaceChildren(),elActive.querySelector("[data-clear]")?.remove()}#updateClearButtons(){for(const elActive of this.elGrid?.querySelectorAll(".collection-filters--active")??[])elActive.querySelector(".collection-filters--active-value")||elActive.querySelector("[data-clear]")?.remove()}#syncFromSection(elSection){if(!elSection)return;const elNewFilters=elSection.querySelector("collection-filters");if(!elNewFilters)return;const elNewForm=elNewFilters.querySelector(".collection-filters--form");elNewForm&&this.elForm&&(this.elForm.innerHTML=elNewForm.innerHTML);for(const className of["mobile","desktop"]){const elNewActive=elNewFilters.querySelector(`.collection-filters--active.${className}`),elActive=this.querySelector(`.collection-filters--active.${className}`);elNewActive&&elActive&&(elActive.innerHTML=elNewActive.innerHTML)}const elNewHeaderActive=elSection.querySelector(".collection-grid--filters > .collection-filters--active"),elHeaderActive=this.elSection?.querySelector(".collection-grid--filters > .collection-filters--active");elNewHeaderActive&&elHeaderActive&&(elHeaderActive.innerHTML=elNewHeaderActive.innerHTML),this.elApply=this.querySelector(".collection-filters--apply"),this.#bindPriceRangeFilters()}#bindPriceRangeFilters(){this.elPriceRangeFilters=this.querySelectorAll("[data-price-range-option]");for(const el of this.elPriceRangeFilters)el.addEventListener("change",event=>this.#onPriceRangeFilterChange(event))}#clearFilters(){for(const checkbox of this.elForm.querySelectorAll('input[type="checkbox"]:checked'))checkbox.checked=!1;for(const radio of this.elForm.querySelectorAll("[data-price-range-option]:checked"))radio.checked=!1;for(const input of this.elForm.querySelectorAll("[data-price-filter-gte], [data-price-filter-lte]"))input.value="",input.disabled=!0;this.elForm.requestSubmit()}#onPriceRangeFilterChange(event){const radio=event.currentTarget,fieldset=radio.closest("fieldset"),gteInput=fieldset.querySelector("[data-price-filter-gte]"),lteInput=fieldset.querySelector("[data-price-filter-lte]"),[min,max]=radio.value.split(":");gteInput.disabled=!1,lteInput.disabled=!1,gteInput.value=Number(min)/100,lteInput.value=Number(max)/100}}customElements.define("collection-filters",CollectionFilters)}
2//# sourceMappingURL=/cdn/shop/t/3471/assets/collection-filters.js.map?v=173537187157596185181790184691

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.