PageSourceSearch

https://www.plazahotel.ie/wp-content/themes/allora-cms/assets/js/c…/dist/voyager_select-menu.js?ver=1789484639

js plazahotel.ie collected 2026-09-26 08:14:19 UTC 13,335 bytes, 1 lines download raw bytes

1(()=>{function ownKeys(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,i)}return r}function _objectSpread(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?ownKeys(Object(r),!0).forEach(function(t){_defineProperty(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):ownKeys(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}function _defineProperty(e,t,r){return(t=_toPropertyKey(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function _toPropertyKey(e){var t=_toPrimitive(e,"string");return"symbol"==typeof t?t:t+""}function _toPrimitive(e,t){if("object"!=typeof e||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var i=r.call(e,t||"default");if("object"!=typeof i)return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}class VoyagerSelectMenu{constructor(){this.config={debug:this.getConfigValue("bookingPanelDebug","debug",false)};this.state={selects:new Map,originalData:new Map,hasInitialSelection:false};this.log("VoyagerSelectMenu initialized",{voyagerSelectOptionOne:window.voyagerSelectOptionOne,voyagerSelectOptionTwo:window.voyagerSelectOptionTwo,hasFilterData:!!(window.voyagerSelectFilterTaxonomy||window.voyagerSelectFilterAncestor),debug:this.config.debug});this.init()}getConfigValue(e,t,r){try{var i;return(null===(i=window[e])||void 0===i?void 0:i[t])??r}catch{return r}}init(){try{this.gatherSelectElements();this.storeOriginalData();this.setupSelects();this.setupLocationFiltering();this.handleInitialSelection();this.setupFormSubmissionHandler()}catch(e){this.error("Initialization failed:",e)}}gatherSelectElements(){const e=document.querySelectorAll(".js-choices");e.forEach(e=>{const t=this.getSelectType(e);if(t){this.state.selects.set(t,e);this.log(`Found ${t} select:`,e)}})}getSelectType(e){if(e.classList.contains("js-location-dropdown"))return"location";if(e.classList.contains("js-propery-dropdown"))return"property";const t=e.name||e.id||Math.random().toString(36).substring(2,11);return`other-${t}`}getExternalUrl(e){if(e.startsWith("[new_tab]"))return e.replace("[new_tab]","");if(e.startsWith("[external]"))return e.replace("[external]","");return null}getExternalTarget(e){if(e.startsWith("[new_tab]"))return"_blank";if(e.startsWith("[external]"))return"_self";return null}storeOriginalData(){this.state.selects.forEach((e,t)=>{const r=Array.from(e.querySelectorAll("option")).map((e,t)=>({index:t,value:e.value,originalValue:e.value,label:e.textContent.trim(),dataId:e.getAttribute("data-id"),dataParentId:e.getAttribute("data-parent-id"),dataOptionName:e.getAttribute("data-option-name"),dataOriginalValue:e.getAttribute("data-value"),className:e.className,selected:e.selected,isExternal:e.value.startsWith("[external]")||e.value.startsWith("[new_tab]"),externalUrl:this.getExternalUrl(e.value),externalTarget:this.getExternalTarget(e.value),outerHTML:e.outerHTML}));this.state.originalData.set(t,r);this.log(`Stored original data for ${t}:`,r)})}setupSelects(){this.state.selects.forEach((e,t)=>{this.prepareSelectOptions(e);this.initializeChoices(e,t);this.setupSelectEvents(e,t)})}prepareSelectOptions(e){Array.from(e.options).forEach((e,t)=>{const r=e.value;e.value=t.toString();e.setAttribute("data-value",r);if(r.startsWith("[new_tab]")){const t=this.getExternalUrl(r);e.setAttribute("data-external-url",t);e.setAttribute("data-external-target","_blank");e.setAttribute("data-clean-value",t)}else if(r.startsWith("[external]")){const t=this.getExternalUrl(r);e.setAttribute("data-external-url",t);e.setAttribute("data-external-target","_self");e.setAttribute("data-clean-value",t)}})}initializeChoices(e,t){const r=this.getChoicesConfig(e);if(e.choices){const t=[];document.querySelectorAll('select[data-choice="active"]').forEach(e=>{t.push(e)});e.choices.destroy();t.forEach(t=>{if(t!==e)t.setAttribute("data-choice","active")})}const i=new Choices(e,r);e.choices=i;e.setAttribute("data-choice","active");this.setupAccessibility(e);this.handlePreselection(e,t,i);this.log(`Choices.js initialized for ${t}:`,i)}getChoicesConfig(e){const t={duplicateItemsAllowed:true,renderChoiceLimit:-1,shouldSort:false,itemSelectText:"",searchEnabled:true};const r=this.parseDataChoices(e);return _objectSpread(_objectSpread({},t),r)}parseDataChoices(e){const t=e.getAttribute("data-choices");try{return t?JSON.parse(t):{}}catch(e){this.error("Invalid JSON in data-choices:",e);return{}}}setupAccessibility(e){const t=e.closest(".choices");if(!t)return;const r=e.getAttribute("data-wrapper-id")||e.id;if(r)t.setAttribute("aria-labelledby",r);else if(e.hasAttribute("aria-label")&&!t.hasAttribute("aria-label")){const r=e.getAttribute("aria-label").replace(/\s+select menu$/i,"");t.setAttribute("aria-label",r)}if("listbox"===t.getAttribute("role"))t.setAttribute("role","combobox");const i=t.querySelector(".choices__list--dropdown");
1if(i){i.removeAttribute("aria-expanded");const e=new MutationObserver(()=>{if(i.hasAttribute("aria-expanded"))i.removeAttribute("aria-expanded")});e.observe(i,{attributes:true,attributeFilter:["aria-expanded"]})}const applyListboxLabel=e=>{if(!e)return;if(t.hasAttribute("aria-label"))e.setAttribute("aria-label",t.getAttribute("aria-label"));else if(t.hasAttribute("aria-labelledby"))e.setAttribute("aria-labelledby",t.getAttribute("aria-labelledby"))};applyListboxLabel(t.querySelector('.choices__list--dropdown .choices__list[role="listbox"]'));const a=t.querySelector(".choices__list--single");if(a&&"listbox"===a.getAttribute("role"))applyListboxLabel(a);if(a){const stripOptionRole=()=>{if("listbox"===a.getAttribute("role"))return;a.querySelectorAll('[role="option"]').forEach(e=>{e.removeAttribute("role");e.removeAttribute("aria-selected")})};stripOptionRole();const e=new MutationObserver(stripOptionRole);e.observe(a,{childList:true,subtree:true,attributes:true,attributeFilter:["role"]})}const o=t.querySelector('input[type="search"]');if(!o)return;let n=t.querySelector(".choices-search-label");if(!n){n=document.createElement("label");n.className="choices-search-label";n.id=`${e.id||"choices"}-search-label`;n.textContent="Search options";n.style.cssText="position:absolute;clip:rect(1px,1px,1px,1px);height:1px;width:1px;overflow:hidden;";t.appendChild(n)}o.setAttribute("aria-labelledby",n.id)}handlePreselection(e,t,r){let i=null;if("location"===t&&window.voyagerSelectOptionTwo)i=window.voyagerSelectOptionTwo;else if("property"===t&&window.voyagerSelectOptionOne)i=window.voyagerSelectOptionOne;if(i)setTimeout(()=>this.selectOptionByText(e,i,r),100)}selectOptionByText(e,t,r){if(!e||!t||!r){this.log("selectOptionByText: Missing required parameters");return false}try{const i=t.toLowerCase().trim();const a=Array.from(e.options).find(e=>e.textContent.toLowerCase().trim()===i);if(a){a.selected=true;r.setChoiceByValue(a.value);this.log(`Preselected option: ${t}`);return true}this.log(`Could not find option to preselect: ${t}`);return false}catch(e){this.error("Error in selectOptionByText:",e);return false}}setupSelectEvents(e,t){e.addEventListener("change",e=>{this.handleSelectChange(e,t)});e.addEventListener("change",e=>{this.handleExternalLink(e)})}handleSelectChange(e,t){const r=e.target.options[e.target.selectedIndex];this.log(`${t} changed:`,{value:r.value,text:r.textContent,dataId:r.getAttribute("data-id")});this.restoreOriginalValues(e.target)}handleExternalLink(e){const t=e.target.options[e.target.selectedIndex];const r=t.getAttribute("data-external-url");const i=t.getAttribute("data-external-target");if(r){if("_blank"===i){this.log("Opening external link in new tab:",r);window.open(r,"_blank")}else{this.log("Opening external link in same window:",r);window.location.href=r}return true}return false}handleNewTabExternalLinks(){this.state.selects.forEach(e=>{const t=e.options[e.selectedIndex];if(t){const e=t.getAttribute("data-external-url");const r=t.getAttribute("data-external-target");if(e&&"_blank"===r){const t=this.buildCompleteBookingUrl(e);this.log("Opening new tab external link with parameters:",t);window.open(t,"_blank");return true}}});return false}buildCompleteBookingUrl(e){if(window.voyagerBookingPanel&&"function"===typeof window.voyagerBookingPanel.collectURLParameters){const t=window.voyagerBookingPanel.collectURLParameters();const r=t.filter(Boolean).join("&");if(r){const t=e.includes("?")?"&":"?";return`${e}${t}${r}`}}return e}restoreOriginalValues(e){if(this.state.hasInitialSelection)return;Array.from(e.options).forEach(e=>{const t=e.getAttribute("data-clean-value");const r=e.getAttribute("data-value");if(t)e.value=t;else if(r)e.value=r;e.removeAttribute("data-value");e.removeAttribute("data-clean-value")});this.state.hasInitialSelection=true}setupLocationFiltering(){const e=this.state.selects.get("location");const t=this.state.selects.get("property");if(!e||!t){this.log("Location filtering not setup - missing required selects");return}e.addEventListener("change",e=>{const r=e.target.options[e.target.selectedIndex];const i=r.getAttribute("data-id");setTimeout(()=>{this.filterPropertiesByLocation(i,t)},100)});this.log("Location filtering setup complete")}filterPropertiesByLocation(e,t){this.log("Filtering properties for location:",e);if(!t||!t.choices){this.error("Property select or choices instance not available");return}const r=this.getFilterData();if(!r){this.log("No filter data available");return}const i=this.getAllowedPropertyIds(e,r);setTimeout(()=>{this.updatePropertyChoices(t,i)},50)}getFilterData(){if(window.voyagerSelectFilterTaxonomy)return{type:"taxonomy",data:window.voyagerSelectFilterTaxonomy};if(window.voyagerSelectFilterAncestor)return{type:"ancestor",data:window.voyagerSelectFilterAncestor};return null}getAllowedPropertyIds(e,t){if("all"===e||!e)return"all";const r=t.data[e];if(!r){this.log("No data found for location:",e);return[]}if("taxonomy"===t.type&&r.rooms)return r.rooms.map(e=>e.post_id.toString());if("taxonomy"===t.type&&"object"===typeof r){const t=Object.keys(r).filter(e=>"taxonomy_title"!==e);this.log("Using simplified taxonomy data structure for location",e,":",t);return t}if("ancestor"===t.type&&r.children)return Object.keys(r.children);return[]}updatePropertyChoices(e,t){const r=e.choices;if(!r){this.error("No choices instance found for property select");return}const i=this.state.originalData.get("property");if(!i){this.error("No original data found for property select");return}try{const a=[];document.querySelectorAll('select[data-choice="active"]').forEach(e
1=>{a.push(e)});r.destroy();a.forEach(t=>{if(t!==e)t.setAttribute("data-choice","active")});e.innerHTML="";const o=i.find(e=>"all"===e.dataId);if(o){const t=this.createOptionElement(o,true);e.appendChild(t)}if("all"===t)i.filter(e=>"all"!==e.dataId&&e.dataId).forEach(t=>{const r=this.createOptionElement(t,false);e.appendChild(r)});else if(t.length>0)i.filter(e=>t.includes(e.dataId)).forEach(t=>{const r=this.createOptionElement(t,false);e.appendChild(r)});this.log("Property options rebuilt, count:",e.options.length);this.prepareSelectOptions(e);this.initializeChoices(e,"property");setTimeout(()=>{if(window.voyagerSelectOptionOne)this.selectOptionByText(e,window.voyagerSelectOptionOne,e.choices)},50)}catch(e){this.error("Error updating property choices:",e)}}createOptionElement(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:false;const r=document.createElement("option");r.value=e.originalValue;r.textContent=e.label;r.selected=t;if(e.dataId)r.setAttribute("data-id",e.dataId);if(e.dataParentId)r.setAttribute("data-parent-id",e.dataParentId);if(e.dataOptionName)r.setAttribute("data-option-name",e.dataOptionName);if(e.dataOriginalValue)r.setAttribute("data-value",e.dataOriginalValue);if(e.className)r.className=e.className;return r}handleInitialSelection(){setTimeout(()=>{const e=this.state.selects.get("location");const t=this.state.selects.get("property");if(window.voyagerSelectOptionTwo&&e){const r=Array.from(e.options).find(e=>e.textContent.toLowerCase().trim()===window.voyagerSelectOptionTwo.toLowerCase());if(r&&t){const e=r.getAttribute("data-id");this.filterPropertiesByLocation(e,t)}}},300)}destroy(){this.state.selects.forEach(e=>{if(e.choices)e.choices.destroy()});this.state.selects.clear();this.state.originalData.clear();this.log("VoyagerSelectMenu destroyed")}setupFormSubmissionHandler(){const e=new Set;this.state.selects.forEach(t=>{const r=t.closest("form");if(r)e.add(r)});e.forEach(e=>{e.addEventListener("submit",t=>{const r=this.handleNewTabExternalLinks();if(r){t.preventDefault();setTimeout(()=>{e.removeEventListener("submit",arguments.callee);e.submit()},100)}})});this.log("Form submission handlers attached to",e.size,"forms")}log(){if(this.config.debug){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];console.log("[VoyagerSelectMenu]",...t)}}error(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];console.error("[VoyagerSelectMenu]",...t)}}document.addEventListener("DOMContentLoaded",()=>{window.voyagerSelectMenu=new VoyagerSelectMenu})})();

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.