PageSourceSearch

https://yc6.cool/js/theme-setting.js

js yc6.cool collected 2026-10-10 02:42:36 UTC 1,948 bytes, 69 lines download raw bytes

1// author by removef
2// https://removeif.github.io/
3
4function isNightFun() {
5    var isNightTemp = localStorage.getExpire('night');
6
7    // 第一次进来判断是白天还是晚上
8    if (isNightTemp == null || isNightTemp == undefined) {
9        if (isNightRange("19:00", "23:59") || isNightRange("00:00", "07:00")) {
10            isNightTemp = 'true';
11        } else {
12            isNightTemp = 'false';
13        }
14        localStorage.setExpire("night", isNightTemp, expireTime1H);
15    }
16    return isNightTemp;
17}
18
19var isNight=isNightFun();
20// 参考自 https://www.imaegoo.com/
21var nightNav;
22var nightIcon;
23
24function applyNight(value) {
25    if (value == 'true') {
26        document.body.className += ' night'
27        if (nightIcon) {
28            nightIcon.className = nightIcon.className.replace(/ fa-moon/g, '') + ' fa-lightbulb'
29        }
30    } else {
31        document.body.className = document.body.className.replace(/ night/g, '')
32        if (nightIcon) {
33            nightIcon.className = nightIcon.className.replace(/ fa-lightbulb/g, '') + ' fa-moon'
34        }
35    }
36}
37
38function findNightIcon() {
39    nightNav = document.getElementById('night-nav');
40    nightIcon = document.getElementById('night-icon');
41    if (!nightNav || !nightIcon) {
42        setTimeout(findNightIcon, 100);
43    } else {
44        nightNav.addEventListener('click', switchNight);
45        if (isNight) {
46            nightIcon.className = nightIcon.className.replace(/ fa-moon/g, '') + ' fa-lightbulb'
47        } else {
48            nightIcon.className = nightIcon.className.replace(/ fa-lightbulb/g, '') + ' fa-moon'
49        }
50    }
51}
52
53function switchNight() {
54
55    if (isNight == 'false') {
56        isNight = 'true';
57    } else {
58        isNight = 'false';
59    }
60    
61    applyNight(isNight);
62    localStorage.setExpire('night', isNight, expireTime1H);
63    if(typeof loadUtterances == 'function'){
64        loadUtterances();
65    }
66}
67
68findNightIcon();
69applyNight(isNight);

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.