PageSourceSearch

https://viatravelers.com/wp-content/themes/viatravelers-theme/assets/js/navigation.js?ver=2.3.17

js viatravelers.com collected 2026-09-24 23:03:33 UTC 2,169 bytes, 78 lines download raw bytes

1/** Native disclosures keep every navigation link available without JavaScript. */
2(function () {
3  'use strict';
4  const menu = document.querySelector('.vt-site-menu');
5  if (!menu) {
6    return;
7  }
8  const desktop = window.matchMedia('(min-width: 1280px)');
9  const groups = Array.from(menu.querySelectorAll('.vt-menu-section'));
10  const savedDialog = document.querySelector('.vt-atlas-dialog');
11  function collapseGroups() {
12    groups.forEach((group) => {
13      group.open = false;
14    });
15  }
16  function closeMenu() {
17    collapseGroups();
18    if (!desktop.matches) {
19      menu.open = false;
20    }
21  }
22  function resize() {
23    menu.open = desktop.matches;
24    collapseGroups();
25  }
26  menu.classList.add('vt-menu-ready');
27  resize();
28  desktop.addEventListener('change', resize);
29  groups.forEach((group) => {
30    group.addEventListener('toggle', () => {
31      if (group.open) {
32        groups.forEach((other) => {
33          if (other !== group) {
34            other.open = false;
35          }
36        });
37      }
38    });
39  });
40  document.addEventListener('click', (event) => {
41    if (savedDialog && savedDialog.contains(event.target)) {
42      return;
43    }
44    if (!menu.contains(event.target)) {
45      closeMenu();
46    }
47  });
48  menu.addEventListener('keydown', (event) => {
49    if (event.key !== 'Escape') {
50      return;
51    }
52    event.preventDefault();
53    const openGroup = groups.find((group) => group.open);
54    if (openGroup) {
55      openGroup.open = false;
56      openGroup.querySelector('summary').focus();
57    } else if (!desktop.matches) {
58      menu.open = false;
59      menu.querySelector('summary').focus();
60    }
61  });
62  menu.addEventListener('focusout', (event) => {
63    if (
64      event.relatedTarget &&
65      !menu.contains(event.relatedTarget) &&
66      !(savedDialog && savedDialog.contains(event.relatedTarget))
67    ) {
68      closeMenu();
69    }
70  });
71  // Saved ideas is a native dialog. Collapse the menu after opening it so its
72  // opener returns to a quiet header when the dialog is dismissed.
73  menu.addEventListener('click', (event) => {
74    if (event.target.closest('[data-vt-open-saved]')) {
75      collapseGroups();
76    }
77  });
78})();

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.