Update web/index.html
Browse files- web/index.html +22 -6
web/index.html
CHANGED
|
@@ -2078,15 +2078,31 @@
|
|
| 2078 |
if (e.key === 'theme') applyTheme(e.newValue);
|
| 2079 |
});
|
| 2080 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2081 |
function switchTheme() {
|
| 2082 |
var darkTheme = document.getElementById('darkTheme');
|
| 2083 |
if (!darkTheme) return;
|
| 2084 |
-
var
|
| 2085 |
-
|
| 2086 |
-
|
| 2087 |
-
|
| 2088 |
-
|
| 2089 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2090 |
}
|
| 2091 |
|
| 2092 |
document.addEventListener('DOMContentLoaded', function () {
|
|
|
|
| 2078 |
if (e.key === 'theme') applyTheme(e.newValue);
|
| 2079 |
});
|
| 2080 |
|
| 2081 |
+
var overlay = document.getElementById('theme-overlay');
|
| 2082 |
+
if (!overlay) {
|
| 2083 |
+
overlay = document.createElement('div');
|
| 2084 |
+
overlay.id = 'theme-overlay';
|
| 2085 |
+
overlay.style.cssText = [
|
| 2086 |
+
'position:fixed','inset:0','z-index:99999',
|
| 2087 |
+
'pointer-events:none','opacity:0',
|
| 2088 |
+
'transition:opacity 0.18s ease','background:#fff'
|
| 2089 |
+
].join(';');
|
| 2090 |
+
document.body.appendChild(overlay);
|
| 2091 |
+
}
|
| 2092 |
+
|
| 2093 |
function switchTheme() {
|
| 2094 |
var darkTheme = document.getElementById('darkTheme');
|
| 2095 |
if (!darkTheme) return;
|
| 2096 |
+
var goingDark = darkTheme.disabled;
|
| 2097 |
+
overlay.style.background = goingDark ? '#fff' : '#1a1a2e';
|
| 2098 |
+
overlay.style.opacity = '1';
|
| 2099 |
+
setTimeout(function () {
|
| 2100 |
+
var newTheme = goingDark ? 'dark' : 'light';
|
| 2101 |
+
applyTheme(newTheme);
|
| 2102 |
+
localStorage.setItem('theme', newTheme);
|
| 2103 |
+
if (typeof updateChartData === 'function') updateChartData(7);
|
| 2104 |
+
setTimeout(function () { overlay.style.opacity = '0'; }, 50);
|
| 2105 |
+
}, 180);
|
| 2106 |
}
|
| 2107 |
|
| 2108 |
document.addEventListener('DOMContentLoaded', function () {
|