PageSourceSearch

https://remmiebyriley.com/cdn/shop/t/79/assets/filters.js?v=30761986573945986961790045858

js remmiebyriley.com collected 2026-10-08 20:24:28 UTC 18,257 bytes, 1 lines download raw bytes

1!function(){"use strict";customElements.get("collection-filters")||customElements.define("collection-filters",class extends HTMLElement{constructor(){super(),this.sortDropdownEvent=()=>this.sortDropdownToggle(),this.onTabHandlerEvent=t=>this.onTabHandler(t),this.updateCollectionFormSortEvent=t=>this.updateCollectionFormSort(t),this.bodyClickEvent=t=>this.bodyClick(t),this.onFilterResetClick=this.onFilterResetClick.bind(this),this.onFilterTagResetClick=this.onFilterTagResetClick.bind(this),this.onFilterTagClearClick=this.onFilterTagClearClick.bind(this),this.onFilterToggleClick=this.onFilterToggleClick.bind(this),this.onKeyUpHandler=this.onKeyUpHandler.bind(this),this.updateRangeEvent=this.updateRange.bind(this),this.onHistoryChangeBound=this.onHistoryChange.bind(this),this.debouncedSubmitEvent=window.theme.debounce((t=>{this.onSubmitHandler(t)}),500),this.debouncedSortEvent=window.theme.debounce((t=>{this.onSortChange(t)}),500)}connectedCallback(){this.container=this.closest("[data-section-id]"),this.sectionId=this.container.dataset.sectionId,this.enableFilters="true"===this.container.dataset.enableFilters,this.enableSorting="true"===this.container.dataset.enableSorting,this.filterMode=this.container.dataset.filterMode,this.collectionHandle=this.container.dataset.collection,this.isSearchPage=null!=this.container.closest("[data-search-performed]"),this.productGrid=this.container.querySelector("[data-collection-products]"),this.productsCount=this.container.querySelector("[data-products-count]"),this.groupTagFilters=this.container.querySelectorAll("[data-collection-filter]"),this.filters=this.container.querySelector("[data-collection-filters]"),this.filterTriggers=this.container.querySelectorAll("[data-collapsible-trigger]"),this.filtersStickyBar=this.container.querySelector("[data-collection-sticky-bar]"),this.filtersForm=this.container.querySelector("[data-collection-filters-form]"),this.inputSort=this.container.querySelectorAll("[data-input-sort]"),this.sortToggle=this.container.querySelector("[data-sort-toggle]"),this.collectionSortOptions=this.container.querySelector("[data-collection-sort-options]"),this.ajaxinateItems=this.container.querySelector("ajaxinate-items[data-collection-products]"),this.a11y=window.theme.a11y,this.filterData=[],this.filters&&(this.hideFiltersDrawer=this.hideFiltersDrawer.bind(this),this.showFiltersDrawer=this.show
1FiltersDrawer.bind(this),this.resizeEvent=window.theme.debounce((()=>{this.filtersResizeEvents()}),500),this.filtersResizeEvents(),document.addEventListener("theme:resize:width",this.resizeEvent)),this.initTagFilters(),window.addEventListener("popstate",this.onHistoryChangeBound),this.bindToggleButtonsEvents(),this.bindFilterButtonsEvents(),this.initProductGridEvents(),window.theme.setVars(),this.sortToggle?.addEventListener("click",this.sortDropdownEvent),document.addEventListener("click",this.bodyClickEvent),this.filterShowMore()}handleVisibleTooltips(){const t=document.querySelector("[data-tooltip-container]");t?.classList.contains("is-visible")&&t.classList.remove("is-visible")}updateRange(){const t=this.filtersForm.querySelector("[data-se-min-value]"),e=this.filtersForm.querySelector("[data-se-max-value]"),i=this.filtersForm.querySelector("[data-field-price-min]"),s=this.filtersForm.querySelector("[data-field-price-max]");if(t.hasAttribute("data-se-min-value")&&e.hasAttribute("data-se-max-value")){const r=parseFloat(i.placeholder,10),o=parseFloat(s.placeholder,10),n=parseFloat(t.getAttribute("data-se-min-value"),10),a=parseFloat(e.getAttribute("data-se-max-value"),10);r===n&&o===a||(i.value=parseInt(n),s.value=parseInt(a),this.filtersForm.dispatchEvent(new Event("input",{bubbles:!0})))}}onSubmitHandler(t){t.preventDefault();const e=new FormData(this.filtersForm),i=new URLSearchParams(e),s=[];let r="";this.isSearchPage&&(this.searchForm=this.container.querySelector("[data-search-form]"),this.currentType=this.container.getAttribute("data-current-type"));const o=this.filtersForm.querySelector("[data-se-min-value]"),n=this.filtersForm.querySelector("[data-se-max-value]"),a=this.filtersForm.querySelector("[data-field-price-min]"),l=this.filtersForm.querySelector("[data-field-price-max]");if(o&&n&&a&&l&&o.hasAttribute("data-se-min")&&n.hasAttribute("data-se-max")){const t=parseFloat(o.getAttribute("data-se-min"),10),e=parseFloat(n.getAttribute("data-se-max"),10),r=a.value?parseFloat(a.value,10):t,c=l.value?parseFloat(l.value,10):e;r<=t&&c>=e&&(s.push("filter.v.price.gte"),s.push("filter.v.price.lte"),i.delete("filter.v.price.gte"),i.delete("filter.v.price.lte"))}if(r=i.toString(),this.isSearchPage){r=function(t,e,i=[],s=!1){const r=new FormData(t),o=new URLSearchParams(r);if(!e)return o.toString();const n=new FormData(e),a=new URLSearchParams(n),l=[];for(const t of r.entries())""===t[1]&&l.push(t[0]);for(const t of n.entries())""===t[1]&&l.push(t[0]);for(let t=0;t<l.length;t++){const e=l[t];o.has(e)&&o.delete(e),a.has(e)&&a.delete(e)}for(const t of o.keys())a.has(t)&&a.delete(t);if(i.length>0)for(let t=0;t<i.length;t++){const e=i[t];o.has(e)&&o.delete(e),a.has(e)&&a.delete(e)}return s&&(a.has("type")&&a.delete("type"),o.set("type",s)),`${o.toString()}&${a.toString()}`}(this.searchForm,this.filtersForm,s);let t="";"all"===this.currentType&&(t="&type=product"),r.indexOf("&type=product")>-1&&(t=""),r+=t}this.renderSection(r,t)}onHistoryChange(t){if(!this.filters)return;let e=t.state?.searchParams||"";if(this.isSearchPage){t.state||(e=window.location.search);if(!(e.indexOf("type=product")>-1))return}this.renderSection(e,null,!1)}renderSection(t,e,i=!0){this.startLoading();const s=`${window.location.pathname}?section_id=${this.sectionId}&${t}`,r=t=>t.url===s;this.filterData.some(r)?this.renderSectionFromCache(r,e):this.renderSectionFromFetch(s,e),i&&this.updateURLHash(t)}renderSectionFromFetch(t){fetch(t).then((t=>t.text())).then((e=>{const i=e;this.filterData=[...this.filterData,{html:i,url:t}],this.inputSort=this.container.querySelectorAll("[data-input-sort]"),this.renderFilters(i),this.bindFilterButtonsEvents(),this.hideFiltersOnMobile(),this.renderProductGrid(i),this.updateProductsCount(i),this.finishLoading(),this.mobileFiltersScrollLock()}))}renderSectionFromCache(t,e){const i=this.filterData.find(t).html;this.renderFilters(i,e),this.hideFiltersOnMobile(),this.renderProductGrid(i),this.updateProductsCount(i),this.finishLoading(),this.mobileFiltersScrollLock()}renderProductGrid(t){const e=(new DOMParser).parseFromString(t,"text/html").querySelector("[data-collection-
1products]");e&&(this.productGrid.innerHTML=e.innerHTML,this.reInitAjaxinate(e),this.initProductGridEvents(),this.filterShowMore())}reInitAjaxinate(t){t.matches("ajaxinate-items")&&"function"==typeof this.ajaxinateItems?.reinit&&this.ajaxinateItems.reinit()}initProductGridEvents(){this.handleVisibleTooltips(),setTimeout((()=>{this.finishLoading()}),450)}updateProductsCount(t){const e=(new DOMParser).parseFromString(t,"text/html").querySelector("[data-products-count]");e&&(this.productsCount.innerHTML=e.innerHTML)}renderFilters(t){const e=(new DOMParser).parseFromString(t,"text/html").querySelector("[data-collection-filters]");e&&(this.filters.innerHTML=e.innerHTML,this.filtersForm=document.querySelector("[data-collection-filters-form]"),this.bindFilterButtonsEvents(),this.bindToggleButtonsEvents())}updateURLHash(t){history.pushState({searchParams:t},"",`${window.location.pathname}${t&&"?".concat(t)}`)}bindFilterButtonsEvents(){this.inputSort.length>0&&this.inputSort.forEach((t=>{t.addEventListener("change",this.updateCollectionFormSortEvent)})),this.filtersForm&&(this.filtersForm.addEventListener("input",this.debouncedSubmitEvent.bind(this)),this.filtersForm.addEventListener("theme:filter:range-update",this.updateRangeEvent)),this.collectionSortOptions&&this.collectionSortOptions.addEventListener("keyup",this.onTabHandlerEvent),"tag"!=this.filterMode&&"group"!=this.filterMode&&this.enableFilters&&this.container.querySelectorAll("[data-filter-reset-button]").forEach((t=>{t.addEventListener("click",this.onFilterResetClick,{once:!0})}))}onFilterResetClick(t){t.preventDefault(),this.renderSection(new URL(t.currentTarget.href).searchParams.toString())}bindToggleButtonsEvents(){this.container.querySelectorAll("[data-toggle-filters]").forEach((t=>{t.addEventListener("click",this.onFilterToggleClick)})),this.container.querySelectorAll("[data-close-filters]").forEach((t=>{t.addEventListener("click",this.hideFiltersDrawer)})),this.container.querySelectorAll("[data-open-filters]").forEach((t=>{t.addEventListener("click",this.showFiltersDrawer)})),this.container.querySelector("[data-collection-wrapper]")?.addEventListener("keyup",this.onKeyUpHandler)}onTabHandler(t){if(t.code===theme.keyboardKeys.SPACE||t.code===theme.keyboardKeys.ENTER||t.code===theme.keyboardKeys.NUMPADENTER){const e=t.target.previousElementSibling.value;this.filtersForm.querySelectorAll("[data-input-sort]").forEach((t=>{t.checked&&(t.checked=!1),t.value===e&&(t.checked=!0)})),this.filtersForm.dispatchEvent(new Event("input",{bubbles:!0})),t.target.dispatchEvent(new Event("click",{bubbles:!0}))}}onKeyUpHandler(t){t.code===theme.keyboardKeys.ESCAPE&&this.hideFiltersDrawer()}onFilterToggleClick(t){t.preventDefault(),window.theme.setVars();this.filters.classList.contains("collection__filters--visible")?this.hideFiltersDrawer():this.showFiltersDrawer()}sortDropdownToggle(){this.collectionSortOptions&&this.collectionSortOptions.classList.toggle("collection__sort__option-wrapper--visible")}bodyClick(t){if(!this.collectionSortOptions)return;const e=this.sortToggle.contains(t.target);this.collectionSortOptions.classList.contains("collection__sort__option-wrapper--visible")&&!e&&this.sortDropdownToggle()}updateCollectionFormSort(t){const e=t.target,i=e.value,s=e.closest("[data-collection-sort-options]");this.container.querySelectorAll("[data-input-sort]").forEach((t=>{t.value===i&&(t.checked=!0)})),null!==s&&this.filtersForm.dispatchEvent(new Event("input",{bubbles:!0}))}showFiltersDrawer(){this.a11y.state.trigger=document.querySelector("[data-toggle-filters]"),this.a11y.trapFocus({container:this.filters}),this.mobileFiltersScrollLock()}mobileFiltersScrollLock(){if(window.innerWidth<theme.sizes.small){const t=document.querySelector("[data-collection-filters-list]");this.filters.classList.contains("collection__filters--visible")||this.filters.classList.add("collection__filters--visible"),document.dispatchEvent(new CustomEvent("theme:scroll:lock",{bubbles:!0,detail:t}))}}hideFiltersOnMobile(){const t=this.container.querySelectorAll("[data-collapsible-trigger]:not([data-show-more-trigger])");window.innerWidth<theme.sizes.small&&requestAnimationFrame((()=>{t.forEach((t=>{const e="true"===t.getAttribute("data-filter-active");t.classList.contains("is-expanded")&&!e&&t.dispatchEvent(new Event("click"))}))}))}
1showFiltersOnDesktop(){const t=this.container.querySelectorAll("[data-collapsible-trigger]:not([data-show-more-trigger])"),e=this.container.getAttribute("data-filters-default-state"),i="first-open"===e,s="open"===e,r="closed"===e,o=this.enableSorting?1:0;t.forEach(((t,e)=>{const n=t.classList.contains("is-expanded"),a="true"===t.getAttribute("data-filter-active"),l=a&&!n&&s;a&&!l||(r&&n||i&&(!n&&e===o)||i&&(n&&e!==o)||s&&!n||l)&&t.dispatchEvent(new Event("click"))}))}hideFiltersDrawer(){let t=this.filters.classList.contains("collection__filters--visible"),e=this.container.classList.contains("is-loading");t&&(this.filters.classList.remove("collection__filters--visible"),this.a11y.removeTrapFocus()),e||document.dispatchEvent(new CustomEvent("theme:scroll:unlock",{bubbles:!0,detail:300}))}filtersResizeEvents(){window.innerWidth>=theme.sizes.small?(this.showFiltersOnDesktop(),this.hideFiltersDrawer()):this.hideFiltersOnMobile()}filterShowMore(){this.showMore=this.container.querySelectorAll("[data-show-more]"),0!==this.showMore.length&&this.showMore.forEach((t=>{const e=t.querySelector("[data-collapsible-trigger]"),i=t.querySelector("[data-show-more-actions]");if(!i)return;const s=i.querySelector("[data-show-more-trigger]"),r=i.querySelector("[data-show-more-container]"),o=r.querySelectorAll(window.theme.focusable);"true"===r.getAttribute("aria-expanded")||o.forEach((t=>{t.setAttribute("tabindex","-1")})),s.addEventListener("keyup",(t=>{t.code!==theme.keyboardKeys.SPACE&&t.code!==theme.keyboardKeys.ENTER&&t.code!==theme.keyboardKeys.NUMPADENTER||this.updateShowMoreFocusableElements(t,o)})),s.addEventListener("click",(t=>{this.updateShowMoreFocusableElements(t,o)})),e.addEventListener("keyup",(t=>{t.code!==theme.keyboardKeys.SPACE&&t.code!==theme.keyboardKeys.ENTER&&t.code!==theme.keyboardKeys.NUMPADENTER||this.updateCollapsedContainerFocusableElements(e,s,o)})),e.addEventListener("click",(()=>{this.updateCollapsedContainerFocusableElements(e,s,o)}))}))}updateCollapsedContainerFocusableElements(t,e,i){requestAnimationFrame((()=>{const s="true"===t.getAttribute("aria-expanded"),r="true"===e.getAttribute("aria-expanded");i.forEach((t=>{!s&&r&&t.setAttribute("tabindex","-1"),s&&r&&t.removeAttribute("tabindex")}))}))}updateShowMoreFocusableElements(t,e){requestAnimationFrame((()=>{requestAnimationFrame((()=>{const i="true"===t.target.getAttribute("aria-expanded");e.forEach(((t,e)=>{if(i)return t.removeAttribute("tabindex"),void(0===e&&t.focus());t.setAttribute("tabindex","-1")}))}))}))}initTagFilters(){"tag"!=this.filterMode&&"group"!=this.filterMode||!this.enableFilters||(this.tags=this.container.dataset.tags.split("+").filter((t=>t)),this.bindFilterTagButtonsEvents(),this.bindSortChangeEvent())}renderTagFiltersProducts(t){this.startLoading(),fetch(t).then((t=>t.text())).then((e=>{const i=e,s=(new DOMParser).parseFromString(i,"text/html"),r=s.querySelector("[data-collection-products]"),o=r.innerHTML,n=s.querySelector("[data-collection-filters]").innerHTML;this.productGrid.innerHTML=o,this.filters.innerHTML=n,this.inputSort=this.container.querySelectorAll("[data-input-sort]"),this.filtersForm=document.querySelector("[data-collection-filters-form]"),this.filterData=[...this.filterData,{html:i,url:t}],this.alreadyClicked=!1,this.bindFilterTagButtonsEvents(),this.bindFilterButtonsEvents(),this.bindSortChangeEvent(),this.bindToggleButtonsEvents(),this.reInitAjaxinate(r),this.initProductGridEvents(),this.updateProductsCount(i),this.mobileFiltersScrollLock(),this.hideFiltersOnMobile(),this.filterShowMore(),history.replaceState&&window.history.pushState({path:t},"",t)})).catch((t=>{this.finishLoading(),console.log(`Error: ${t}`)}))}bindFilterTagButtonsEvents(){this.container.querySelectorAll("[data-collection-filter-tag-button]").forEach((t=>{t.addEventListener("click",this.onFilterTagButtonClick.bind(this))})),this.container.querySelectorAll("[data-filter-tag-reset-button]").forEach((t=>{t.addEventListener("click",this.onFilterTagClearClick)})),this.container.querySelectorAll("[data-filter-reset-button]").forEach((t=>{t.addEventListener("click",this.onFilterTagResetClick)}))}bindSortChangeEvent(){this.container.querySelectorAll("[data-input-sort]").forEach((t=>{t.addEventListener("input",this.debouncedSortEvent.bind(this))}))}onFilterTagButtonClick(t){if(t.preventDefault(),this.alreadyClicked)return;this.alreadyClicked=!0;const e=t.currentTarget,i=e.dataset.tag;if(e.parentNode.classList.contains("is-active")){let t=this.tags.indexOf(i);e.parentNode.classList.remove("is-active"),t>-1&&this.tags.splice(t,1)}else e.parentNode.classList.add("is-active"),this.tags.push(i);let s=this.collectionHandle+"/"+this.tags.join("+")+"?sort_by="+this.getSortValue();this.container.querySelector("[data-collection-filter]").classList.remove("is-expanded"),this.container.querySelector("[data-collection-filter]").setAttribute("aria-expanded",!1),this.container.setAttribute("data-tags","["+this.tags+"]"),this.renderTagFiltersProducts(s)}onFilterTagClearClick(t){if(t.preventDefault(),this.alreadyClicked)return;this.alreadyClicked=!0;const e=t.currentTarget.dataset.tag,i=this.tags.indexOf(e);i>-1&&this.tags.splice(i,1);const s=this.collectionHandle+"/"+this.tags.join("+")+"?sort_by="+this.getSortValue();this.container.setAttribute("data-tags","["+this.tags+"]"),this.renderTagFiltersProducts(s)}onSortChange(){let t=this.collectionHandle+"/"+this.tags.join("+")+"?sort_by="+this.getSortValue();this.renderTagFiltersProducts(t)}getSortValue(){let t="";return this.inputSort.forEach((e=>{e.checked&&(t=e.value)})),t}onFilterTagResetClick(t){if(t?.preventDefault(),this.alreadyClicked)return;this.alreadyClicked=!0,this.container.querySelectorAll("[data-collection-filter-tag]").forEach((t=>{t.classList.remove("is-active")})),this.container.querySelectorAll("[data-collection-filter]").forEach((t=>{t.classList.remove("is-expanded"),t.setAttribute("aria-expanded",!1)})),this.tags=[],this.container.setAttribute("data-tags","");let e=this.collectionHandle+"/?sort_by="+this.getSortValue();this.renderTagFiltersProducts(e)}getProductsOffsetTop(){return this.productGrid.getBoundingClientRect().top-document.body.getBoundingClientRect().top-this.filtersStickyBar.offsetHeight}getStickyBarOffsetTop(){return this.filtersStickyBar.getBoundingClientRect().top-document.body.getBoundingClientRect().top}
1startLoading(){this.container.classList.add("is-loading"),window.innerWidth>=theme.sizes.small&&document.dispatchEvent(new CustomEvent("theme:scroll:lock",{bubbles:!0}));let t=this.getProductsOffsetTop();window.scrollTo({top:t,left:0,behavior:"smooth"})}finishLoading(){const t=document.querySelectorAll('[data-section-type="popups"] .popup--visible'),e=t.length>0;if(this.container.classList.remove("is-loading"),e){let e=0;[...t].forEach((t=>{t.hasAttribute("data-prevent-scroll-lock")&&(e+=1)})),e===t.length&&document.dispatchEvent(new CustomEvent("theme:scroll:unlock",{bubbles:!0,detail:300}))}else window.innerWidth>=theme.sizes.small&&document.dispatchEvent(new CustomEvent("theme:scroll:unlock",{bubbles:!0,detail:300}))}disconnectedCallback(){this.filters&&document.removeEventListener("theme:resize:width",this.resizeEvent),window.removeEventListener("popstate",this.onHistoryChangeBound),document.removeEventListener("click",this.bodyClickEvent),this.groupTagFilters.length>0&&this.onFilterTagResetClick(),this.finishLoading()}})}();

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.