1 /* ----------------------------------- 2 dark-mode 3 ----------------------------------- */ 4 const toggleSwitch = document.querySelector('.theme-switch input[type="checkbox"]'); 5 const logoDark = document.querySelector('.logo-dark'); 6 const logoWhite = document.querySelector('.logo-white'); 7 const currentTheme = localStorage.getItem('theme'); 8 9 if (currentTheme) { 10 document.documentElement.setAttribute('data-theme', currentTheme); 11 12 if (currentTheme === 'dark') { 13 toggleSwitch.checked = true; 14 document.body.classList.toggle("dark"); 15 } 16 } 17 18 function switchTheme(e) { 19 if (e.target.checked) { 20 document.documentElement.setAttribute('data-theme', 'dark'); 21 localStorage.setItem('theme', 'dark'); 22 document.body.classList.add('dark'); 23 } 24 else { 25 document.documentElement.setAttribute('data-theme', 'light'); 26 localStorage.setItem('theme', 'light'); 27 document.body.classList.remove('dark'); 28 } 29 } 30 31 toggleSwitch.addEventListener('change', switchTheme, false);
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.