PageSourceSearch

https://saturday-october-seven.com/js/app.js?v2

js saturday-october-seven.com collected 2026-10-02 10:24:40 UTC 5,981 bytes, 216 lines download raw bytes

1// Get the content div and navigation links
2const contentP = document.getElementById("site-wrapper");
3const navLinks = document.querySelectorAll("nav a");
4
5let scopePage = undefined;
6let scopeTab = undefined;
7
8async function routing() {
9  const [hash, currentPage, currentTab, currentItem] =
10    window.location.hash.split("/");
11
12  const newHash = "#";
13  const newPage = currentPage || "";
14  const newTab = currentTab || "";
15  const newItem = currentItem || "";
16
17  if (scopePage === newPage) {
18    return;
19  }
20  scopePage = newPage;
21
22  // Define the mapping of routes to HTML files
23  const routeMapping = {
24    "": "home.html?v=2",
25    civilsettlements: "civilsettlements.html",
26    millitarybase: "millitarybase.html",
27    musicfestival: "musicfestival.html",
28  };
29
30  const pagePath = routeMapping[newPage];
31  if (!pagePath) {
32    contentP.innerHTML = "Page not found";
33  }
34
35  // Fetch and load the content of the HTML page
36  const htmlContent = await utils.fetchHtml(pagePath);
37  contentP.innerHTML = htmlContent;
38  scrollTop();
39
40  // Run custom JavaScript code for the Home page
41  if (newPage === "civilsettlements") {
42    await loadCivilMedia();
43    scrollTop();
44    share();
45    updateNumofVictims();
46    tabContainer(newTab);
47  }
48  if (newPage === "musicfestival") {
49    loadFestivalMedia();
50    scrollTop();
51    share();
52    updateNumofVictims();
53    tabContainer(newTab);
54  }
55  if (newPage === "millitarybase") {
56    loadMilitaryMedia();
57    scrollTop();
58    share();
59    updateNumofVictims();
60    tabContainer(newTab);
61  }
62  // console.log("end");
63
64  // Update the active link
65  navLinks.forEach((link) => {
66    link.classList.remove("active");
67    const [hash, currentPage, currentTab, currentItem] = link
68      .getAttribute("href")
69      .split("/");
70    if (currentPage === newPage) {
71      link.classList.add("active");
72    }
73  });
74}
75
76// function updateHash(page, tab, item) {
77//     // console.log("updateHash");
78
79//     const [currentHash, currentPage, currentTab, currentItem] = window.location.hash.split('/');
80
81//     const newHash = '#';
82//     const newPage = page || currentPage || '';
83//     const newTab = tab || currentTab || '';
84//     const newItem = item || currentItem || '';
85
86//     const updatedHash = [newHash, newPage, newTab, newItem].filter(Boolean).join('/');
87
88//     if (!updatedHash) return;
89
90//     // console.log(`Updated Hash: #${updatedHash}`);
91//     window.location.hash = `${updatedHash}`;
92// }
93
94function tabContainer(currentTab) {
95  var tabsContainerInput = document
96    .getElementById("tabs-container")
97    .getElementsByTagName("input");
98
99  // console.log('update tabContainer');
100  for (let i = 0; i < tabsContainerInput.length; i++) {
101    tabsContainerInput[i].addEventListener("click", (e) => {
102      const tabMD = e.target.getAttribute("data-tab");
103      if (scopeTab != tabMD) {
104        scopeTab = tabMD;
105        utils.updateHashLocaltion(null, tabMD, "");
106        // console.log(tabMD);
107      }
108    });
109    if (currentTab) {
110      if (tabsContainerInput[i].getAttribute("data-tab") === currentTab) {
111        tabsContainerInput[i].checked = true;
112      } else {
113        tabsContainerInput[i].checked = false;
114      }
115    }
116  }
117
118  // utils.updateHash(null, null, null);
119}
120
121// Function to handle routing
122// async function handleRouting() {
123//     const hash = window.location.hash;
124
125//     // Define the mapping of routes to HTML files
126//     const routeMapping = {
127//         "#/": "home.html",
128//         "#/civilsettlements": "civilsettlements.html",
129//         "#/millitarybase": "millitarybase.html",
130//         "#/musicfestival": "musicfestival.html",
131//     };
132
133//     // Initialize pagePath as null (or another initial value)
134//     let pagePath = null;
135
136//     // Check if the hash is a valid route
137//     if (routeMapping.hasOwnProperty(hash)) {
138//         pagePath = routeMapping[hash];
139//     }
140
141//     if (pagePath) {
142
143//         // Fetch and load the content of the HTML page
144//         const htmlContent = await utils.fetchHtml(pagePath);
145//         contentP.innerHTML = htmlContent;
146//         scrollTop();
147
148//         // Run custom JavaScript code for the Home page
149//         if (hash === "#/civilsettlements") {
150//             await loadCivilMedia();
151//             scrollTop();
152//             share();
153//             updateNumofVictims();
154//         }
155//         if (hash === "#/musicfestival") {
156//             loadFestivalMedia();
157//             scrollTop();
158//             share();
159//             updateNumofVictims();
160//         }
161//         if (hash === "#/millitarybase") {
162//             loadMilitaryMedia();
163//             scrollTop();
164//             share();
165//             updateNumofVictims();
166//         }
167//         console.log("end");
168
169//     } else {
170//         contentP.innerHTML = "Page not found";
171//     }
172
173//     // Update the active link
174//     navLinks.forEach((link) => {
175//         link.classList.remove("active");
176//         if (link.getAttribute("href") === hash) {
177//             link.classList.add("active");
178//         }
179//     });
180// }
181
182// Initialize the app by handling the initial route
183// handleRouting();
184routing();
185// Add a route change event listener
186// window.addEventListener("hashchange", handleRouting);
187window.addEventListener("hashchange", routing);
188
189const navCheckbox = document.getElementById("navCheckbox");
190
191function closeNav() {
192  navCheckbox.checked = false;
193}
194
195function scrollTop() {
196  window.scrollTo(0, 0);
197  var div = document.getElementById("mobile-nav");
198  div.scrollTop = 0;
199}
200
201function openAlertModal() {
202  //   console.log("openMap");
203  var alertmodal = document.getElementById("alertModal");
204
205  var content = document.getElementById("site-wrapper");
206  alertmodal.style.display = "block";
207}
208
209function closeAlertModal() {
210  //   console.log("close modal");
211  var alertmodal = document.getElementById("alertModal");
212
213  var content = document.getElementById("site-wrapper");
214  alertmodal.style.display = "none";
215  document.cookie = "alertModal=disable";
216}

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.