document.addEventListener("alpine:init",()=>{Alpine.data("progressBar",()=>({scrollProgress(){document.addEventListener("scroll",()=>{var t=(document.body.scrollTop||document.documentElement.scrollTop)/(document.documentElement.scrollHeight-document.documentElement.clientHeight)*100;this.$el.style.width=t+"%";let e=document.getElementById("jump-to-top");e&&(t<70?(e.classList.contains("opacity-100")&&e.classList.remove("opacity-100"),e.classList.add("opacity-0")):(e.classList.contains("opacity-0")&&e.classList.remove("opacity-0"),e.classList.add("opacity-100")))})}}))});; document.addEventListener("alpine:init",()=>{Alpine.data("announcementBar",()=>console.log("announcement bar test"))});; document.addEventListener('DOMContentLoaded', function() { //Case 1: Evergreen toggle is disabled: Just return, no need to rearrage the slider const swiperWrapper = document.querySelector('.swiper-wrapper'); const isEverGeenEnabled = swiperWrapper?.dataset.evergreen; if("true" != isEverGeenEnabled ) { return; } //Case 2: Evergreen toggle is enabled, check for the local storage to check if the user is new or recurrent. // if the user is new user,just return bcz for new user no need to re arrage the slider. const isRecurrentUser = localStorage.getItem('recurrentUser') || false; if(!isRecurrentUser){ localStorage.setItem('recurrentUser', true); return; } //case 3: Evergreen toggle is enabled and user is recurrent user,So move the evergreen slider(1st slider to last) if (swiperWrapper) { // Get all child elements and convert to an array const allSlidesArray = Array.from(swiperWrapper.children); if (allSlidesArray.length > 1) { // Remove the first element from the array and store it const firstSlide = allSlidesArray.shift(); // Push the first element to the end of the array allSlidesArray.push(firstSlide); // Clear the original DOM content swiperWrapper.innerHTML = ''; // Loop through the new array and append the elements to the DOM allSlidesArray.forEach((slide, index) => { // Update the data-tab attribute slide.setAttribute('data-tab', `slide-${index + 1}`); // Append the element to the DOM swiperWrapper.appendChild(slide); }); } } } ) ;