Files
vps_monitoring/server/static/js/theme.js
Андрей Бобырев 4846742c60 feat: add light/dark theme, RU/EN i18n, instructions page, green/red monitoring
- Light and dark theme toggle with localStorage persistence
- Russian and English language support (full i18n)
- Instructions & cheat sheet modal with install/SSH/API/commands
- Green pulsing dot for online, red for offline servers
- Color-coded metrics: green (ok), yellow (warn >70%), red (crit >90%)
- Top bar on server cards: green=online, red=offline

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-05-20 05:55:16 +03:00

17 lines
545 B
JavaScript

let currentTheme = localStorage.getItem('vps_theme') || 'dark';
function applyTheme(theme) {
currentTheme = theme;
localStorage.setItem('vps_theme', theme);
document.documentElement.setAttribute('data-theme', theme);
const btn = document.getElementById('themeToggleBtn');
if (btn) btn.textContent = theme === 'dark' ? '☀️' : '🌙';
}
function toggleTheme() {
applyTheme(currentTheme === 'dark' ? 'light' : 'dark');
}
// Apply on load
document.addEventListener('DOMContentLoaded', () => applyTheme(currentTheme));