PageSourceSearch

https://junchengyang.com/script/main.js

js junchengyang.com collected 2026-09-25 19:00:19 UTC 1,283 bytes, 45 lines download raw bytes

1
2function includeHTML(file, elementId) {
3  fetch(file)
4    .then(response => {
5      if (!response.ok) {
6        throw new Error(`HTTP error! status: ${response.status}`);
7      }
8      return response.text();
9    })
10    .then(data => {
11      const element = document.getElementById(elementId);
12      if (element) {
13        element.innerHTML = data;
14        if (elementId === "header") {
15          setActiveNavigation();
16        }
17      } else {
18        console.error(`Element with ID '${elementId}' not found`);
19      }
20    })
21    .catch(error => {
22      console.error('Error loading HTML:', error);
23    });
24}
25
26function setActiveNavigation() {
27  const currentPage = window.location.pathname.split("/").pop() || "index.html";
28
29  document.querySelectorAll("#header .nav-link").forEach(link => {
30    const href = link.getAttribute("href");
31    if (!href || href.startsWith("http") || href.endsWith(".pdf")) return;
32
33    const linkPage = href.split("#")[0] || "index.html";
34    if (linkPage === currentPage) {
35      link.classList.add("active");
36      link.setAttribute("aria-current", "page");
37    }
38  });
39}
40
41// Load footer when DOM is ready
42document.addEventListener("DOMContentLoaded", function() {
43  includeHTML("footer.html", "footer");
44  includeHTML("header.html", "header");
45});

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.