PageSourceSearch

https://teedoc.github.io/static/js/theme_default/pre_main.js

js teedoc.github.io collected 2026-10-03 10:03:56 UTC 1,903 bytes, 54 lines download raw bytes

1(function(){
2    var theme = getTheme();
3    setTheme(theme);
4}());
5
6function addCss(filename) {
7    var head = document.getElementsByTagName('head')[0];
8    var link = document.createElement('link');
9    link.rel = 'stylesheet';
10    link.type = 'text/css';
11    link.href = filename;
12    head.appendChild(link);
13}
14function removejscssfile(filename, filetype) {
15    var targetelement = (filetype == "js") ? "script" : (filetype == "css") ? "link" : "none"
16    var targetattr = (filetype == "js") ? "src" : (filetype == "css") ? "href" : "none"
17    var allsuspects = document.getElementsByTagName(targetelement)
18    for (var i = allsuspects.length; i >= 0; i--) {
19        if (allsuspects[i] && allsuspects[i].getAttribute(targetattr) != null && allsuspects[i].getAttribute(targetattr).indexOf(filename) != -1)
20            allsuspects[i].parentNode.removeChild(allsuspects[i])
21    }
22}
23
24
25function getTheme(){
26    var t = localStorage.getItem("theme");
27    if(!t){
28        t = "light";
29        setTheme(t);
30    }
31    return t;
32}
33function setTheme(theme){
34    var obj = document.getElementById("themes");
35    if(theme=="dark"){
36        if(obj){
37            obj.classList.remove("light");
38            obj.classList.add("dark");
39        }
40        document.getElementsByTagName("html")[0].classList.add("dark");
41        // load dark and light togher, distingush by .dark class instead use single css file
42        // removejscssfile("/static/css/theme_default/light.css", "css");
43        // addCss("/static/css/theme_default/dark.css");
44    }else{
45        if(obj){
46            obj.classList.remove("dark");
47            obj.classList.add("light");
48        }
49        document.getElementsByTagName("html")[0].classList.remove("dark");
50        // removejscssfile("/static/css/theme_default/dark.css", "css");
51        // addCss("/static/css/theme_default/light.css");
52    }
53    localStorage.setItem("theme", theme);
54}

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.