1(() => { 2 const match = document.cookie.match(/(?:^|; )theme=([^;]+)/); 3 const setTheme = (theme) => { 4 document.documentElement.classList.add(`${theme}-mode`); 5 }; 6 7 const setSystemTheme = () => { 8 if (window.matchMedia("(prefers-color-scheme: dark)").matches) { 9 setTheme("dark"); 10 } else { 11 setTheme("light"); 12 } 13 const mediaQueryList = window.matchMedia("(prefers-color-scheme: dark)"); 14 mediaQueryList.addEventListener("change", (event) => { 15 document.documentElement.classList.replace( 16 event.matches ? "light-mode" : "dark-mode", 17 event.matches ? "dark-mode" : "light-mode" 18 ); 19 }); 20 }; 21 22 if (match) { 23 const theme = match[1]; 24 if (theme === "system") { 25 setSystemTheme(); 26 return; 27 } 28 setTheme(theme); 29 return; 30 } 31 setTheme("light"); 32})();
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.