PageSourceSearch

https://www.palaceonwheelsindia.org/assets/js/main.js?v=1790322376

js palaceonwheelsindia.org collected 2026-09-25 07:46:29 UTC 10,341 bytes, 371 lines download raw bytes

1document.addEventListener("DOMContentLoaded", function () {
2
3
4
5
6
7// footer toggle code 
8  const footerMenus = document.querySelectorAll(".footer-menu-toggle-wrapper");
9
10footerMenus.forEach(menu => {
11
12  menu.addEventListener("click", function () {
13
14    if (window.innerWidth <= 768) {
15
16      const parent = this.closest(".footer-menu-widget");
17
18      document.querySelectorAll(".footer-menu-widget").forEach(item => {
19        if (item !== parent) {
20          item.classList.remove("active");
21        }
22      });
23
24      parent.classList.toggle("active");
25
26    }
27
28  });
29
30});
31// footer toggle code end
32
33
34
35
36
37
38
39  /* ===============================
40     MENU JS
41  =============================== */
42 
43 
44     
45        const dropdownLinks = document.querySelectorAll(
46          ".wheel-dropdown > a, .wheel-dropdown-sub > a",
47        );
48        const mobileBreakpoint = 1200;
49
50        const menuToggle = document.getElementById("menu-toggle");
51        const overlay = document.querySelector(".wheel-overlay");
52        const closeBtn = document.querySelector(".wheel-close-btn");
53
54        // DROPDOWN
55        function toggleDropdown(event) {
56          if (window.innerWidth <= mobileBreakpoint) {
57            event.preventDefault();
58
59            const parentLi = event.currentTarget.parentElement;
60            const isActive = parentLi.classList.contains("active");
61            const parentUl = parentLi.parentElement;
62
63            parentUl
64              .querySelectorAll(".wheel-dropdown, .wheel-dropdown-sub")
65              .forEach((el) => {
66                el.classList.remove("active");
67              });
68
69            if (!isActive) {
70              parentLi.classList.add("active");
71            }
72          }
73        }
74
75        dropdownLinks.forEach((link) => {
76          link.addEventListener("click", toggleDropdown);
77        });
78
79        // ✅ OUTSIDE CLICK CLOSE
80        if (overlay) {
81          overlay.addEventListener("click", () => {
82            menuToggle.checked = false;
83          });
84        }
85
86        // ✅ CROSS BUTTON CLOSE
87        if (closeBtn) {
88          closeBtn.addEventListener("click", () => {
89            menuToggle.checked = false;
90          });
91        }
92
93        // ✅ CLOSE ONLY NORMAL LINKS
94        document.querySelectorAll(".wheel-nav-menu a").forEach((link) => {
95          link.addEventListener("click", function () {
96            const parent = this.parentElement;
97
98            const isDropdownParent =
99              parent.classList.contains("wheel-dropdown") ||
100              parent.classList.contains("wheel-dropdown-sub");
101
102            if (isDropdownParent) return;
103
104            if (window.innerWidth <= mobileBreakpoint) {
105              menuToggle.checked = false;
106            }
107          });
108        });
109
110        // RESET
111        window.addEventListener("resize", function () {
112          if (window.innerWidth > mobileBreakpoint) {
113            menuToggle.checked = false;
114
115            document
116              .querySelectorAll(".wheel-dropdown, .wheel-dropdown-sub")
117              .forEach((li) => {
118                li.classList.remove("active");
119              });
120          }
121        });
122      
123    
124
125
126
127
128  /* ===============================
129     MENU JS END
130  =============================== */
131
132
133
134
135
136
137
138
139
140  /* ===============================
141     LIGHTBOX GALLERY
142  =============================== */
143  const powLightbox = document.getElementById("powLightbox");
144  const powSlider  = document.getElementById("powSlider");
145  const powThumbs  = document.getElementById("powThumbs");
146  const powCounter = document.getElementById("powCounter");
147
148  if (powLightbox && powSlider && powThumbs && powCounter) {
149
150    let powActiveImages = [];
151    let powIndex = 0;
152
153    document.querySelectorAll(".pow-gallery-wrap").forEach(wrap => {
154      const imgs = wrap.querySelectorAll(".pow-gallery img");
155      imgs.forEach((img, i) => {
156        img.addEventListener("click", () => powOpenLightbox(imgs, i));
157      });
158    });
159
160    function powOpenLightbox(images, start) {
161      powActiveImages = images;
162      powIndex = start;
163
164      powSlider.innerHTML = "";
165      powThumbs.innerHTML = "";
166
167      images.forEach((img, i) => {
168        const s = document.createElement("img");
169        s.src = img.dataset.large;
170        powSlider.appendChild(s);
171
172        const t = document.createElement("img");
173        t.src = img.dataset.large;
174        t.onclick = () => powGoTo(i);
175        powThumbs.appendChild(t);
176      });
177
178      powLightbox.classList.add("pow-show");
179      powGoTo(powIndex);
180    }
181
182    function powGoTo(i) {
183      powIndex = i;
184      powSlider.style.transform = `translateX(-${i * 100}%)`;
185      powCounter.textContent = `${i + 1} / ${powActiveImages.length}`;
186
187      powThumbs.querySelectorAll("img").forEach((el, x) => {
188        el.classList.toggle("pow-active", x === i);
189      });
190    }
191
192    document.querySelector(".pow-next")?.addEventListener("click", () =>
193      powGoTo((powIndex + 1) % powActiveImages.length)
194    );
195
196    document.querySelector(".pow-prev")?.addEventListener("click", () =>
197      powGoTo((powIndex - 1 + powActiveImages.length) % powActiveImages.length)
198    );
199
200    document.getElementById("powClose")?.addEventListener("click", () =>
201      powLightbox.classList.remove("pow-show")
202    );
203
204    document.querySelectorAll(".pow-gallery-wrap").forEach(wrap => {
205    const imgs = wrap.querySelectorAll(".pow-gallery img");
206    
207    // SET IMAGE COUNT
208    const countEl = wrap.querySelector(".number-of-img");
209    if(countEl){
210       countEl.innerHTML = `<i class="bi bi-images"></i> ${imgs.length}`;
211    }
212
213    imgs.forEach((img, i) => {
214        img.addEventListener("click", () => powOpenLightbox(imgs, i));
215    });
216
217
218
219
220
221
222
223
224
225
226
227});
228  }/* MOBILE GALLERY SLIDER (MULTIPLE SUPPORT) */
229
230      document
231        .querySelectorAll(".pow-gallery.mobile-slider")
232        .forEach((gallery) => {
233          const wrap = gallery.closest(".pow-gallery-wrap");
234          const nextBtn = wrap.querySelector(".mobile-next");
235          const prevBtn = wrap.querySelector(".mobile-prev");
236
237          nextBtn?.addEventListener("click", () => {
238            gallery.scrollBy({
239              left: gallery.clientWidth,
240              behavior: "smooth",
241            });
242          });
243
244          prevBtn?.addEventListener("click", () => {
245            gallery.scrollBy({
246              left: -gallery.clientWidth,
247              behavior: "smooth",
248            });
249          });
250        });
251
252  /* ===============================
253     GALLERY CHILD TABS
254  =============================== */
255
256  // PHOTO
257  const photoTabs = document.querySelectorAll(".child-tab-of-image-tab li");
258  const photoContents = document.querySelectorAll(".photo-child-tabs-content");
259
260  if (photoTabs.length && photoContents.length) {
261    photoTabs[0].classList.add("active");
262    photoContents[0].classList.add("active");
263
264    photoTabs.forEach((tab, i) => {
265      tab.addEventListener("click", function (e) {
266        e.preventDefault();
267        e.stopPropagation(); // 🔥 IMPORTANT
268
269        photoTabs.forEach(t => t.classList.remove("active"));
270        photoContents.forEach(c => c.classList.remove("active"));
271
272        tab.classList.add("active");
273        photoContents[i].classList.add("active");
274      });
275    });
276  }
277
278  // VIDEO
279  const videoTabs = document.querySelectorAll(".child-tab-of-video-tab li");
280  const videoContents = document.querySelectorAll(".video-child-tabs-content");
281
282  if (videoTabs.length && videoContents.length) {
283    videoTabs[0].classList.add("active");
284    videoContents[0].classList.add("active");
285
286    videoTabs.forEach((tab, i) => {
287      tab.addEventListener("click", function (e) {
288        e.preventDefault();
289        e.stopPropagation(); // 🔥 IMPORTANT
290
291        videoTabs.forEach(t => t.classList.remove("active"));
292        videoContents.forEach(c => c.classList.remove("active"));
293
294        tab.classList.add("active");
295        videoContents[i].classList.add("active");
296      });
297    });
298  }
299
300});
301
302
303
304(function() {
305    const container = document.getElementById('itinerary-main-container');
306    const items = container.querySelectorAll('.itinerary-acc-item');
307    const fillBar = document.getElementById('itinerary-fill-bar');
308
309    function updateItineraryProgress() {
310        let highestIdx = 0;
311        items.forEach((item, idx) => {
312            if (item.classList.contains('itinerary-active')) {
313                highestIdx = idx;
314            }
315        });
316
317        items.forEach((item, idx) => {
318            if (idx <= highestIdx) {
319                item.classList.add('itinerary-completed');
320            } else {
321                item.classList.remove('itinerary-completed');
322            }
323        });
324
325        const percent = (highestIdx / (items.length - 1)) * 100;
326        fillBar.style.height = highestIdx >= 0 ? percent + '%' : '0%';
327    }
328
329    items.forEach((item) => {
330        const header = item.querySelector('.itinerary-acc-header');
331        const icon = header.querySelector('.icon');
332        header.addEventListener('click', () => {
333            const content = item.querySelector('.itinerary-acc-content');
334            const isOpen = item.classList.contains('itinerary-active');
335
336            // Close all others
337            items.forEach(i => {
338                i.classList.remove('itinerary-active');
339                i.querySelector('.itinerary-acc-content').style.maxHeight = null;
340                i.querySelector('.icon').classList.remove('bi-dash');
341                i.querySelector('.icon').classList.add('bi-plus');
342            });
343
344            // Toggle current
345            if (!isOpen) {
346                item.classList.add('itinerary-active');
347                content.style.maxHeight = content.scrollHeight + "px";
348                icon.classList.remove('bi-plus');
349                icon.classList.add('bi-dash');
350            }
351
352            updateItineraryProgress();
353        });
354    });
355
356    // Auto-open Day 1 on load
357    const firstItem = items[0];
358    if(firstItem) {
359        firstItem.classList.add('itinerary-active');
360        const firstContent = firstItem.querySelector('.itinerary-acc-content');
361        firstContent.style.maxHeight = firstContent.scrollHeight + "px";
362        const firstIcon = firstItem.querySelector('.icon');
363        firstIcon.classList.remove('bi-plus');
364        firstIcon.classList.add('bi-dash');
365        updateItineraryProgress();
366    }
367})();
368
369
370
371

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.