PageSourceSearch

https://urbanista.com/cdn/shop/t/15/assets/region-selector.js?v=165827447645294317611789133236

js urbanista.com collected 2026-09-24 10:47:16 UTC 4,407 bytes, 2 lines download raw bytes

1(function(){"use strict";var selectors={scope:"[data-region-selector]",toggle:"[data-region-toggle]",panel:"[data-region-panel]",searchWrap:"[data-region-search-wrap]",search:"[data-region-search]",list:"[data-region-list]",option:"[data-region-option]",empty:"[data-region-empty]",returnTo:"[data-region-return-to]",menuToggle:"#menu-toggle"},classes={expanded:"is-expanded",enhanced:"is-enhanced"};function prefersReducedMotion(){return!!(window.matchMedia&&window.matchMedia("(prefers-reduced-motion: reduce)").matches)}function normalize(value){var text=(value==null?"":String(value)).toLowerCase().trim();return typeof text.normalize=="function"&&(text=text.normalize("NFD").replace(/[\u0300-\u036f]/g,"")),text}function RegionSelector(scope){this.scope=scope,this.toggle=scope.querySelector(selectors.toggle),this.panel=scope.querySelector(selectors.panel),this.search=scope.querySelector(selectors.search),this.searchWrap=scope.querySelector(selectors.searchWrap),this.empty=scope.querySelector(selectors.empty),this.index=Array.prototype.map.call(scope.querySelectorAll(selectors.option),function(element){return{element:element,text:normalize(element.getAttribute("data-region-haystack"))}}),this.init()}RegionSelector.prototype.init=function(){this.bindReturnTo(),this.search&&(this.bindSearch(),this.searchWrap&&(this.searchWrap.hidden=!1)),this.toggle&&this.panel&&(this.scope.classList.add(classes.enhanced),this.bindAccordion())},RegionSelector.prototype.bindReturnTo=function(){var forms=this.scope.querySelectorAll("form");this.syncReturnTo(),Array.prototype.forEach.call(forms,function(form){form.addEventListener("submit",this.syncReturnTo.bind(this))}.bind(this))},RegionSelector.prototype.syncReturnTo=function(){var value=window.location.pathname+window.location.search;Array.prototype.forEach.call(this.scope.querySelectorAll(selectors.returnTo),function(input){input.value=value})},RegionSelector.prototype.bindSearch=function(){this.search.addEventListener("input",function(event){this.filter(event.target.value)}.bind(this)),this.search.addEventListener("keydown",function(event){(event.key==="Enter"||event.keyCode===13)&&event.preventDefault()})},RegionSelector.prototype.filter=function(term){var query=normalize(term),visible=0;this.index.forEach(function(entry){var matches=!query||entry.text.indexOf(query)!==-1;entry.element.hidden=!matches,matches&&(visible+=1)}),this.empty&&(this.empty.hidden=visible!==0)},RegionSelector.prototype.resetFilter=function(){this.search&&(this.search.value="",this.filter(""))},RegionSelector.prototype.bindAccordion=function(){this.toggle.addEventListener("click",function(){this.setExpanded(this.toggle.getAttribute("aria-expanded")!=="true")}.bind(this)),this.scope.addEventListener("keydown",function(event){(event.key==="Escape"||event.keyCode===27)&&this.isExpanded()&&(this.setExpanded(!1),this.toggle.focus())}.bind(this));var menuToggle=document.querySelector(selectors.menuToggle);menuToggle&&menuToggle.addEventListener("change",function(){menuToggle.checked||this.setExpanded(!1)}.bind(this))},RegionSelector.prototype.isExpanded=function(){return this.toggle.getAttribute("aria-expanded")==="true"},RegionSelector.prototype.setExpanded=function(expanded){this.toggle.setAttribute("aria-expanded",expanded?"true":"false"),expanded?this.scope.classList.add(classes.expanded):(this.scope.classList.remove(classes.expanded),this.revealToggle({onlyIfAbove:!0}),this.resetFilter())},RegionSelector.prototype.revealToggle=function(options){var scroller=this.scope.closest?this.scope.closest(".menu"):null;if(scroller){var anchor=this.scope.closest("li")||this.scope,offset=anchor.getBoundingClientRect().top-scroller.getBoundingClientRect().top;if(!(options&&options.onlyIfAbove&&offset>=0)){var target=scroller.scrollTop+offset;scroller.scrollTo?scroller.scrollTo({top:target,behavior:prefersReducedMotion()?"auto":"smooth"}):scroller.scrollTop=target}}};function initAll(){Array.prototype.forEach.call(document.querySelectorAll(selectors.scope),function(scope){scope.dataset.regionSelectorReady!=="true"&&(scope.dataset.regionSelectorReady="true",new RegionSelector(scope))})}document.readyState==="loading"?document.addEventListener("DOMContentLoaded",initAll):initAll(),document.addEventListener("shopify:section:load",initAll)})();
2//# sourceMappingURL=/cdn/shop/t/15/assets/region-selector.js.map?v=165827447645294317611789133236

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.