优化渲染逻辑

This commit is contained in:
CN-JS-HuiBai
2026-04-04 19:22:48 +08:00
parent f73f9fa0c4
commit 824ead4bee
2 changed files with 14 additions and 0 deletions

View File

@@ -9,6 +9,15 @@
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800;900&family=JetBrains+Mono:wght@400;500;600&display=swap" rel="stylesheet">
<link rel="stylesheet" href="/css/style.css">
<script>
// Prevent theme flicker
(function() {
const savedTheme = localStorage.getItem('theme');
if (savedTheme === 'light') {
document.documentElement.classList.add('light-theme');
}
})();
</script>
</head>
<body>
<!-- Animated Background -->

View File

@@ -129,6 +129,11 @@
fetchMetrics();
fetchNetworkHistory();
loadSiteSettings();
// Initial icon check based on early head script
const currentTheme = document.documentElement.classList.contains('light-theme') ? 'light' : 'dark';
updateThemeIcons(currentTheme);
setInterval(fetchMetrics, REFRESH_INTERVAL);
setInterval(fetchNetworkHistory, NETWORK_HISTORY_INTERVAL);
}