PageSourceSearch

https://www.lewismuseum.org/wp-content/themes/thelewish-theme/assets/js/main.js?ver=1776459992

js lewismuseum.org collected 2026-10-02 03:41:45 UTC 3,925 bytes, 133 lines download raw bytes

1// window.addEventListener("scroll", function () {
2//   const header = document.getElementById("mainHeader");
3//   if (window.scrollY > window.innerHeight * 0.5) {
4//     header.classList.add("visible");
5//   } else {
6//     header.classList.remove("visible");
7//   }
8// });
9
10function openMenu() {
11  document.getElementById("slideMenu").classList.add("open");
12  document.getElementById("menuOverlay").classList.add("visible");
13  document.body.style.overflow = "hidden";
14}
15
16function closeMenu() {
17  document.getElementById("slideMenu").classList.remove("open");
18  document.getElementById("menuOverlay").classList.remove("visible");
19  document.body.style.overflow = "";
20}
21
22function toggleSubMenu(element) {
23  const subMenu = element.nextElementSibling;
24  const icon = element.querySelector(".expand-icon");
25  const allSubMenus = document.querySelectorAll(".sub-menu");
26  const allIcons = document.querySelectorAll(".expand-icon");
27
28  // Close all other submenus
29  allSubMenus.forEach((menu) => {
30    if (menu !== subMenu) {
31      menu.classList.remove("expanded");
32    }
33  });
34
35  // Reset all other icons
36  allIcons.forEach((i) => {
37    if (i !== icon) {
38      i.classList.remove("rotated");
39    }
40  });
41
42  // Toggle clicked submenu and icon
43  subMenu.classList.toggle("expanded");
44  icon.classList.toggle("rotated");
45
46}
47function handleMenuClick(e, el) {
48  const clickedIcon = e.target.closest(".expand-icon");
49
50  // If + icon clicked → toggle submenu
51  if (clickedIcon) {
52    e.preventDefault();
53    e.stopPropagation();
54    toggleSubMenu(el);
55  }
56  // Else → normal link navigation (do nothing)
57}
58
59
60// ------------------------------ Exhibitions Page ---------------------------------------
61
62// Exhibition Filtering
63function filterExhibitions(category) {
64  const cards = document.querySelectorAll(".exhibition-card");
65  const tabs = document.querySelectorAll(".filter-tab");
66  const emptyState = document.getElementById("emptyState");
67  let visibleCount = 0;
68
69  // Update active tab
70  tabs.forEach((tab) => {
71    if (tab.dataset.filter === category) {
72      tab.classList.add("active");
73    } else {
74      tab.classList.remove("active");
75    }
76  });
77
78  // Filter cards
79  cards.forEach((card) => {
80    if (category === "all" || card.dataset.category === category) {
81      card.classList.add("visible");
82      visibleCount++;
83    } else {
84      card.classList.remove("visible");
85    }
86  });
87
88  // Show/hide empty state
89  if (visibleCount === 0) {
90    emptyState.classList.add("visible");
91  } else {
92    emptyState.classList.remove("visible");
93  }
94
95  // Update URL hash without scrolling
96  if (category !== "all") {
97    history.pushState(null, null, "#" + category);
98  } else {
99    history.pushState(null, null, window.location.pathname);
100  }
101}
102
103// Check URL hash on page load and apply filter
104window.addEventListener("DOMContentLoaded", function () {
105  const hash = window.location.hash.substring(1); // Remove the #
106  const validFilters = ["current", "upcoming", "permanent", "past", "online", "community-murals-current", "community-murals-past"];
107
108  if (hash && validFilters.includes(hash)) {
109    filterExhibitions(hash);
110  }
111});
112
113// Handle browser back/forward buttons
114window.addEventListener("popstate", function () {
115  const hash = window.location.hash.substring(1);
116  const validFilters = ["current", "upcoming", "permanent", "past", "online", "community-murals-current", "community-murals-past"];
117
118  if (hash && validFilters.includes(hash)) {
119    filterExhibitions(hash);
120  } else {
121    filterExhibitions("all");
122  }
123});
124
125// ---------------------------------------------------- Programs & Events Page ------------------------------
126// Filter functionality
127const filterButtons = document.querySelectorAll(".filter-tab");
128filterButtons.forEach((button) => {
129  button.addEventListener("click", function () {
130    filterButtons.forEach((btn) => btn.classList.remove("active"));
131    this.classList.add("active");
132  });
133});

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.