PageSourceSearch

https://lionsystems.com.au/site/DefaultSite/skins/lion-systems/js/vendors/color-modes.js?v=20250307-1

js lionsystems.com.au collected 2026-10-06 13:14:18 UTC 2,080 bytes, 65 lines download raw bytes

1// Lightmode
2
3(() => {
4   "use strict";
5
6   const getStoredTheme = () => localStorage.getItem("theme");
7   const setStoredTheme = (theme) => localStorage.setItem("theme", theme);
8
9   const getPreferredTheme = () => {
10      const storedTheme = getStoredTheme();
11      if (storedTheme) {
12         return storedTheme;
13      }
14
15      return "light";
16   };
17
18   const setTheme = (theme) => {
19      document.documentElement.setAttribute("data-bs-theme", theme === "auto" ? "light" : theme);
20   };
21
22   const updateDropdownIcon = (theme) => {
23      const themeIconActive = document.querySelector(".theme-icon-active");
24      const iconElement = document.querySelector(`[data-bs-theme-value="${theme}"] .theme-icon`);
25
26      if (themeIconActive && iconElement) {
27         themeIconActive.innerHTML = iconElement.outerHTML;
28      }
29   };
30
31   setTheme(getPreferredTheme());
32
33   const showActiveTheme = (theme, focus = false) => {
34      const themeSwitcherText = document.querySelector(".bs-theme-text");
35      const btnToActive = document.querySelector(`[data-bs-theme-value="${theme}"]`);
36
37      document.querySelectorAll("[data-bs-theme-value]").forEach((element) => {
38         element.classList.remove("active");
39         element.setAttribute("aria-pressed", "false");
40      });
41
42      btnToActive.classList.add("active");
43      btnToActive.setAttribute("aria-pressed", "true");
44      const themeSwitcherLabel = `${themeSwitcherText.textContent} (${btnToActive.dataset.bsThemeValue})`;
45
46      updateDropdownIcon(theme);
47
48      if (focus) {
49         btnToActive.focus();
50      }
51   };
52
53   window.addEventListener("DOMContentLoaded", () => {
54      showActiveTheme(getPreferredTheme());
55
56      document.querySelectorAll("[data-bs-theme-value]").forEach((toggle) => {
57         toggle.addEventListener("click", () => {
58            const theme = toggle.getAttribute("data-bs-theme-value");
59            setStoredTheme(theme);
60            setTheme(theme);
61            showActiveTheme(theme, true);
62         });
63      });
64   });
65})();

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.