PageSourceSearch

https://clash-meta.github.io/assets/website/js/frontend/clash_meta/theme-change.js

js clash-meta.github.io collected 2026-10-03 08:48:14 UTC 692 bytes, 22 lines download raw bytes

1const toggleSwitch = document.querySelector('.theme-switch input[type="checkbox"]');
2const currentTheme = localStorage.getItem('theme');
3
4if (currentTheme) {
5    document.documentElement.setAttribute('data-theme', currentTheme);
6  
7    if (currentTheme === 'dark') {
8        toggleSwitch.checked = true;
9    }
10}
11
12function switchTheme(e) {
13    if (e.target.checked) {
14        document.documentElement.setAttribute('data-theme', 'dark');
15        localStorage.setItem('theme', 'dark');
16    }
17    else {        document.documentElement.setAttribute('data-theme', 'light');
18          localStorage.setItem('theme', 'light');
19    }    
20}
21
22toggleSwitch.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.