PageSourceSearch

https://www.plazahotel.ie/wp-content/themes/allora-cms/assets/js/b…/dist/voyager_tab-wrapper.js?ver=1789484639

js plazahotel.ie collected 2026-09-26 08:13:58 UTC 9,211 bytes, 1 lines download raw bytes

1(()=>{class TabManager{constructor(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"Tab";let s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"wp-block-voyager-tab-wrapper__tab-block";this.wrapper=t;this.sections=this.findSections();this.defaultTabText=e;this.sectionClass=s;this.wrapperIndex=[...document.querySelectorAll(".wp-block-voyager-tab-wrapper")].indexOf(t)+1;this.init()}findSections(){const t=[];const e=this.wrapper.querySelectorAll("section, .wp-block-voyager-block-wrapper");e.forEach(e=>{if(e.classList.contains("wp-block-voyager-block-wrapper"))e.querySelectorAll("section").forEach(t=>{t.removeAttribute("id")});if("SECTION"===e.tagName||e.classList.contains("wp-block-voyager-block-wrapper"))t.push(e)});return t.filter(Boolean)}init(){if(0===this.sections.length){console.warn("No sections found.");return}this.sections.forEach((t,e)=>{});this.createTabList();this.createAccordionHeaders();this.hideAllSectionsExceptFirst();this.addTabClickHandlers();this.addAccordionClickHandlers();this.activateTab(0);this.handleResize();window.addEventListener("resize",this.handleResize.bind(this))}createTabList(){this.tabList=document.createElement("ul");this.tabList.className="wp-block-voyager-tab-wrapper__tab-list";this.tabList.setAttribute("role","tablist");const t=this.wrapper.querySelector("h1, h2, h3");const e=t?t.textContent.trim()+" tabs":"Page section tabs";this.tabList.setAttribute("aria-label",e);const s=this.wrapper.id||`tab-wrapper-${Math.random().toString(36).substr(2,9)}`;let i=0;let a=0;this.sections.forEach(t=>{const e=t.classList.contains("wp-block-voyager-tab-wrapper__tab-list-item");const a=t.classList.contains("wp-block-voyager-block-wrapper");const r=e||(a?0===t.querySelectorAll("section").length:true);if(r){let a;if(e)a=t.textContent||`${this.defaultTabText} ${i+1}`;else a=this.getTabName(t)||`${this.defaultTabText} ${i+1}`;const r=`tab-${s}-${i}`;const o=`panel-${s}-${i}`;const n=document.createElement("li");n.textContent=a;n.dataset.index=i;n.className="wp-block-voyager-tab-wrapper__tab-list-item";n.setAttribute("role","tab");n.setAttribute("aria-controls",o);n.id=r;n.setAttribute("aria-selected",0===i?"true":"false");n.setAttribute("tabindex",0===i?"0":"-1");n.setAttribute("aria-label",`Tab ${i+1}: ${a}`);this.tabList.appendChild(n);i++}});this.sections.forEach(t=>{const e=t.classList.contains("wp-block-voyager-tab-wrapper__tab-list-item");const i=t.classList.contains("wp-block-voyager-block-wrapper");if(!e){t.classList.add(this.sectionClass);if(i){t.querySelectorAll("section").forEach(t=>{t.removeAttribute("id");t.removeAttribute("aria-labelledby");t.removeAttribute("aria-label");t.removeAttribute("role");t.removeAttribute("hidden")});const e=`tab-${s}-${a}`;const i=`panel-${s}-${a}`;const r=this.getTabName(t)||`${this.defaultTabText} ${a+1}`;t.setAttribute("role","tabpanel");t.id=i;t.setAttribute("aria-label",`${r} panel ${this.wrapperIndex}`);t.setAttribute("tabindex","0");if(0!==a)t.setAttribute("hidden","");a++}else if(!t.closest(".wp-block-voyager-block-wrapper")){const e=`tab-${s}-${a}`;const i=`panel-${s}-${a}`;const r=this.getTabName(t)||`${this.defaultTabText} ${a+1}`;t.setAttribute("role","tabpanel");t.id=i;t.setAttribute("aria-label",`${r} panel ${this.wrapperIndex}`);t.setAttribute("tabindex","0");if(0!==a)t.setAttribute("hidden","");a++}}});const r=document.createElement("div");r.className="voyager-container voyager-container__tab-container";r.appendChild(this.tabList);this.wrapper.insertBefore(r,this.wrapper.firstChild)}createAccordionHeaders(){this.sections.forEach((t,e)=>{const s=t.querySelector(".wp-block-voyager-tab-wrapper__accordion-header");if(s)return;let i=this.getTabName(t);if(!i)i=`${this.defaultTabText} ${e+1}`;const a=document.createElement("div");a.textContent=i;a.className="wp-block-voyager-tab-wrapper__accordion-header voyager-icon-chevron-pointing-down";a.dataset.index=e;a.setAttribute("role","button");a.setAttribute("aria-expanded","false");a.setAttribute("aria-controls",t.id);t.insertBefore(a,t.firstChild)})}getTabName(t){const e=t.querySelector(".voyager-intro-text__heading");if(e){const t=e.textContent.trim();if(t)return t}const s=["voyager-banner","voyager-booking-hub","voyager-forms-panel","voyager-instagram-feed","voyager-stories","voyager-text-content"];const i=s.some(e=>t.classList.contains(e));if(i){const e=t.querySelector("h1, h2, h3, .font-size--h1, .font-size--h2");if(e){const t=e.textContent.trim();if(t)return t}}return null}hideAllSectionsExceptFirst(){this.sections.forEach((t,e)=>{if(0!==e)t.style.display="none";else t.style.display="block"})}addTabClickHandlers(){this.tabList.addEventListener("click",t=>{if("LI"===t.target.tagName){const e=t.target.dataset.index;this.activateTab(e)}});this.tabList.addEventListener("keydown",t=>{const e=t.target;if("LI"===e.tagName&&"tab"===e.getAttribute("role")){let s;switch(t.key){case"ArrowRight":case"ArrowDown":s=(parseInt(e.dataset.index)+1)%this.sections.length;break;case"ArrowLeft":case"ArrowUp":s=(parseInt(e.dataset.index)-1+this.sections.length)%this.sections.length;break;case"Home":s=0;break;case"End":s=this.sections.length-1;break;default:return}this.activateTab(s);this.tabList.children[s].focus()}})}
1addAccordionClickHandlers(){this.wrapper.addEventListener("click",t=>{if(t.target.classList.contains("wp-block-voyager-tab-wrapper__accordion-header")){const e=t.target.dataset.index;this.toggleAccordion(e)}})}toggleAccordion(t){const e=this.sections[t];const s=e.classList.contains("js-accordion-active");this.sections.forEach(t=>{t.classList.remove("js-accordion-active");t.querySelector(".wp-block-voyager-tab-wrapper__accordion-header").setAttribute("aria-expanded","false")});if(!s){e.classList.add("js-accordion-active");e.querySelector(".wp-block-voyager-tab-wrapper__accordion-header").setAttribute("aria-expanded","true");this.scrollToAccordionSection(e)}this.refreshNestedSliders()}refreshNestedSliders(){requestAnimationFrame(()=>{this.wrapper.querySelectorAll(".splide.is-initialized").forEach(t=>{var e;null===(e=t.splideInstance)||void 0===e||e.refresh()})})}scrollToAccordionSection(t){const e=window.getComputedStyle(this.tabList);const s="none"===e.display;if(!s)return;const i=this.getHeaderOffset();const a=t.querySelector(".wp-block-voyager-tab-wrapper__accordion-header");if(!a)return;const r=a.getBoundingClientRect();const o=r.top+window.pageYOffset;const n=o-i;window.scrollTo({top:n,behavior:"smooth"})}getHeaderOffset(){const t=[".site-header",".main-header",".header",".navigation",".nav-header",".wp-block-navigation",".fixed-header"];for(const e of t){const t=document.querySelector(e);if(t){const e=window.getComputedStyle(t);const s=e.position;if("fixed"===s||"sticky"===s)return t.offsetHeight+20}}return 80+20}activateTab(t){const e=parseInt(t);this.tabList.querySelectorAll("li").forEach((t,s)=>{const i=s===e;t.classList.toggle("js-active-tab",i);t.setAttribute("aria-selected",i.toString());t.setAttribute("tabindex",i?"0":"-1");if(i)t.setAttribute("aria-live","polite");else t.removeAttribute("aria-live")});let s=0;this.sections.forEach((t,i)=>{const a=t.classList.contains("wp-block-voyager-tab-wrapper__tab-list-item");const r=t.classList.contains("wp-block-voyager-block-wrapper");const o=t.classList.contains("wp-block-voyager-tab-wrapper__tab-block");if(!a){const i=r||!t.closest(".wp-block-voyager-block-wrapper")||o;if(i){const i=s===e;t.setAttribute("aria-hidden",(!i).toString());t.setAttribute("tabindex",i?"0":"-1");const a=window.getComputedStyle(this.tabList);const o="none"!==a.display;if(o)if(i){t.style.display="block";t.removeAttribute("hidden")}else{t.style.display="none";t.setAttribute("hidden","")}else{t.style.display="block";t.classList.toggle("js-accordion-active",i);t.removeAttribute("hidden")}if(r)t.querySelectorAll("section").forEach(t=>{if(t.classList.contains("voyager-text-content"))t.style.display="none"});s++}}});this.refreshNestedSliders()}handleResize(){if(window.innerWidth<=992){this.tabList.style.display="none";let t=0;this.sections.forEach((e,s)=>{if(e.classList.contains("js-accordion-active"))t=s});this.sections.forEach((t,e)=>{const s=t.querySelector(".wp-block-voyager-tab-wrapper__accordion-header");if(!s)this.createAccordionHeaders();t.classList.remove("js-accordion-active");t.style.display="block";t.removeAttribute("hidden")});if(this.sections.length>0){this.sections[t].classList.add("js-accordion-active");const e=this.sections[t].querySelector(".wp-block-voyager-tab-wrapper__accordion-header");if(e)e.setAttribute("aria-expanded","true");this.sections.forEach((e,s)=>{if(s!==t){const t=e.querySelector(".wp-block-voyager-tab-wrapper__accordion-header");if(t)t.setAttribute("aria-expanded","false")}})}}else{this.tabList.style.display="flex";this.sections.forEach((t,e)=>{const s=t.querySelector(".wp-block-voyager-tab-wrapper__accordion-header");if(s)s.remove();t.style.display=0===e?"block":"none";t.toggleAttribute("hidden",0!==e);t.classList.remove("js-accordion-active")});this.activateTab(0)}}}document.addEventListener("DOMContentLoaded",function(){setTimeout(()=>{const t=document.querySelectorAll(".wp-block-voyager-tab-wrapper");t.forEach(t=>{new TabManager(t)})},200)})})();

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.