Update index.html
Browse files- index.html +18 -5
index.html
CHANGED
|
@@ -402,11 +402,24 @@ lumin("query", "username", "logic", true)
|
|
| 402 |
});
|
| 403 |
|
| 404 |
async function fetchStats() {
|
| 405 |
-
|
| 406 |
-
|
| 407 |
-
|
| 408 |
-
|
| 409 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 410 |
fetchStats();
|
| 411 |
|
| 412 |
function copyToClipboard(button) {
|
|
|
|
| 402 |
});
|
| 403 |
|
| 404 |
async function fetchStats() {
|
| 405 |
+
// Restore dark mode preference from local storage
|
| 406 |
+
const isDarkMode = localStorage.getItem('darkMode') === 'true';
|
| 407 |
+
document.body.classList.toggle('dark-mode', isDarkMode);
|
| 408 |
+
themeSwitch.checked = isDarkMode;
|
| 409 |
+
|
| 410 |
+
const response = await fetch('/api/stats');
|
| 411 |
+
const data = await response.json();
|
| 412 |
+
document.getElementById('rps').textContent = data.rps;
|
| 413 |
+
document.getElementById('total-requests').textContent = data.totalRequests;
|
| 414 |
+
}
|
| 415 |
+
|
| 416 |
+
// Update dark mode preference when theme switch is toggled
|
| 417 |
+
themeSwitch.addEventListener('change', () => {
|
| 418 |
+
const isDarkMode = themeSwitch.checked;
|
| 419 |
+
document.body.classList.toggle('dark-mode', isDarkMode);
|
| 420 |
+
localStorage.setItem('darkMode', isDarkMode);
|
| 421 |
+
});
|
| 422 |
+
|
| 423 |
fetchStats();
|
| 424 |
|
| 425 |
function copyToClipboard(button) {
|