Files
system-control/firmware/storage/www/js/app.js
Peter Siegmund 52f6c2acab
Some checks failed
ESP-IDF Build / build (esp32c6, release-v5.4) (push) Successful in 3m57s
ESP-IDF Build / build (esp32c6, release-v5.5) (push) Successful in 3m48s
ESP-IDF Build / build (esp32s3, release-v5.4) (push) Failing after 3m18s
ESP-IDF Build / build (esp32s3, release-v5.5) (push) Failing after 3m14s
vibe coded website (plus captive portal)
needs missing ESP32 implementation

Signed-off-by: Peter Siegmund <developer@mars3142.org>
2026-01-01 16:39:27 +01:00

61 lines
1.4 KiB
JavaScript

// Global variables
let schemaData = [];
let currentEditRow = null;
let lightOn = false;
let currentMode = 'simulation';
let ws = null;
let wsReconnectTimer = null;
let pairedDevices = [];
let scenes = [];
let currentEditScene = null;
let selectedSceneIcon = '🌅';
// Event listeners
document.addEventListener('keydown', (e) => {
if (e.key === 'Escape') {
closeColorModal();
closeSceneModal();
}
});
document.getElementById('color-modal').addEventListener('click', (e) => {
if (e.target.classList.contains('modal-overlay')) {
closeColorModal();
}
});
document.getElementById('scene-modal').addEventListener('click', (e) => {
if (e.target.classList.contains('modal-overlay')) {
closeSceneModal();
}
});
// Prevent zoom on double-tap for iOS
let lastTouchEnd = 0;
document.addEventListener('touchend', (e) => {
const now = Date.now();
if (now - lastTouchEnd <= 300) {
e.preventDefault();
}
lastTouchEnd = now;
}, false);
// Initialization
document.addEventListener('DOMContentLoaded', () => {
initI18n();
initTheme();
initWebSocket();
updateConnectionStatus();
loadScenes();
loadPairedDevices();
// WiFi status polling (less frequent)
setInterval(updateConnectionStatus, 30000);
});
// Close WebSocket on page unload
window.addEventListener('beforeunload', () => {
if (ws) {
ws.close();
}
});