PageSourceSearch

https://peteryuen.netlify.app/js/main.js

js peteryuen.netlify.app collected 2026-10-03 11:15:54 UTC 1,648 bytes, 67 lines download raw bytes

1// Set darkmode
2function isDark() {
3	return document.body.classList.contains("dark");
4}
5
6document.getElementById("mode").addEventListener("click", () => {
7	document.body.classList.toggle("dark");
8
9	localStorage.setItem("theme", isDark() ? "dark" : "light");
10
11	// Update graph colors if exists
12	if (graph) {
13		graph.setOptions({
14			nodes: {
15				color: isDark() ? "#8c8e91" : "#dee2e6",
16				font: {
17					color: isDark() ? "#c9cdd1" : "#616469",
18					strokeColor: isDark() ? "#c9cdd1" : "#616469",
19				},
20			},
21		});
22	}
23});
24
25// Collapsible sidebar code (it's ugly but I don't care)
26var sections = $(".collapsible-section");
27if (!sidebar_collapsed) {
28	sections.addClass("open");
29}
30
31// Add click listener to all collapsible sections
32for (let i = 0; i < sections.length; i++) {
33	// Initial setup
34	let wrapper = $(sections[i].nextElementSibling);
35	let wrapper_children = wrapper.find("> ul");
36
37	if (wrapper_children.length > 0) {
38		let page_list = $(wrapper_children[0]);
39		if (sidebar_collapsed) {
40			wrapper.height(0);
41		} else {
42			wrapper.addClass("open");
43			wrapper.height(page_list.outerHeight(true));
44		}
45	}
46
47	// Click listener
48	sections[i].addEventListener("click", function () {
49		// Toggle class
50		this.classList.toggle("open");
51
52		// Change wrapper height and class
53		let wrapper = $(sections[i].nextElementSibling);
54		let wrapper_children = wrapper.find("> ul");
55
56		if (wrapper_children.length > 0) {
57			let page_list = $(wrapper_children[0]);
58			if (wrapper.hasClass("open")) {
59				wrapper.removeClass("open");
60				wrapper.height(0);
61			} else {
62				wrapper.addClass("open");
63				wrapper.height(page_list.outerHeight(true));
64			}
65		}
66	});
67}

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.