PageSourceSearch

https://www.enchantingtravels.com/wp-content/themes/enchanting/dis…/tabs-navigation/index.js?ver=2026.09.28.01

js enchantingtravels.com collected 2026-10-02 05:53:59 UTC 3,543 bytes, 1 lines download raw bytes

1(()=>{"use strict";const{zustand:t,et:e}=window,{getState:i,setState:s}=t.stores.global,{getState:a}=t.stores.etWishlistData,n=(t,e=300)=>{let i;return(...s)=>{clearTimeout(i),i=setTimeout(()=>{t.apply(void 0,s)},e)}};class r{constructor(t,e,i=0,s="body"){this.observer=null;const a=document.querySelector(s);this.sections=a.querySelectorAll(t),this.tabs=a.querySelectorAll(e),this.offset=i,this.initializeObserver()}initializeObserver(){const t=this.offset>0?`-${this.offset}px 0px -${this.offset}px 0px`:"0px";this.observer=new IntersectionObserver(t=>this.handleIntersection(t),{root:null,rootMargin:t,threshold:0}),this.sections.forEach(t=>{var e;null===(e=this.observer)||void 0===e||e.observe(t)})}handleIntersection(t){t.forEach(t=>{const e=t.target.id;t.isIntersecting&&this.updateTabsAria(e)})}updateTabsAria(t){this.tabs.forEach(e=>{e.hash===`#${t}`?e.setAttribute("aria-current","location"):e.hasAttribute("aria-current")&&e.removeAttribute("aria-current")})}}const{customElements:o,HTMLElement:l}=window;o.define("et-tabs-navigation",class extends l{constructor(){super(),this.tabTargets=[],this.activeTargetElement=null,this.targetToTabsMapping={},this.tabLinks=this.querySelectorAll(".tabs-navigation__link-text"),this.tabs=this.querySelectorAll(".tabs-navigation__link"),this.tabsHeader=this.querySelector(".tabs-navigation__header"),this.activeTabLink=this.querySelector(".tabs-navigation__link--active"),this.initializeScrollLeftOnMobile(),this.initializeScrollObserver(),this.initializeScrollingTabsA11y()}initializeScrollingTabsA11y(){Array.from(this.tabLinks).some(t=>{var e;return null===(e=t.getAttribute("href"))||void 0===e?void 0:e.startsWith("#")})&&new r("section[id], div[id], article[id]",".tabs-navigation__link-text",10,"main")}initializeScrollObserver(){var t;const e=[],i={};null===(t=this.tabs)||void 0===t||t.forEach((t,s)=>{const a=this.tabLinks[s],n=a.getAttribute("href");if(a.addEventListener("focus",()=>{window.scrollTo(window.scrollX,window.scrollY)}),null==n?void 0:n.startsWith("#")){const s=document.getElementById(n.slice(1));s&&(this.targetToTabsMapping[s.id]=t,e.push(s.offsetTop),i[s.offsetTop]=s)}}),e.sort((t,e)=>t-e),e.reverse(),e.forEach(t=>{this.tabTargets.push(i[t])}),window.addEventListener("scroll",n(this.observeSectionIntersections.bind(this),10))}reInitializeTabTargets(){this.tabTargets=[],this.initializeScrollObserver()}observeSectionIntersections(){const t=window.scrollY+parseInt(window.getComputedStyle(document.getElementsByTagName("body")[0]).getPropertyValue("scroll-padding-top")||"0")+100;this.tabTargets.some(e=>{var i,s;if(e.offsetTop<=t){const t=this.activeTabLink;t&&t.classList.remove("tabs-navigation__link--active"),this.activeTargetElement=e,this.activeTabLink=this.targetToTabsMapping[(null===(i=this.activeTargetElement)||void 0===i?void 0:i.id)||""];const a=this.targetToTabsMapping[(null===(s=this.activeTargetElement)||void 0===s?void 0:s.id)||""];return a&&a.classList.add("tabs-navigation__link--active"),n(this.initializeScrollLeftOnMobile.bind(this),1e3)(),!0}return!1})}initializeScrollLeftOnMobile(){var t,e;if(768<=window.innerWidth||!this.activeTabLink)return null;const i=this.activeTabLink.getBoundingClientRect().width,s=this.activeTabLink.getBoundingClientRect().x;let a=0;this.tabsHeader&&(a=this.tabsHeader.scrollLeft),s+i+60>window.innerWidth&&(null===(t=this.tabsHeader)||void 0===t||t.scrollTo({top:0,left:a+s-60,behavior:"smooth"})),0>s-60&&(null===(e=this.tabsHeader)||void 0===e||e.scrollTo({top:0,left:a-i-60,behavior:"smooth"}))}})})();

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.