vibe coded website (plus captive portal)
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
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
needs missing ESP32 implementation Signed-off-by: Peter Siegmund <developer@mars3142.org>
This commit is contained in:
60
firmware/storage/www/js/app.js
Normal file
60
firmware/storage/www/js/app.js
Normal file
@@ -0,0 +1,60 @@
|
||||
// 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();
|
||||
}
|
||||
});
|
||||
Reference in New Issue
Block a user