diff --git a/public/js/app.js b/public/js/app.js index dded584..e84ae29 100644 --- a/public/js/app.js +++ b/public/js/app.js @@ -183,6 +183,8 @@ // ---- Initialize ---- function init() { + try { + console.log('[Init] Start...'); // Resource Gauges Time updateGaugesTime(); setInterval(updateGaugesTime, 1000); @@ -637,6 +639,11 @@ initWebSocket(); backgroundIntervals.push(setInterval(fetchNetworkHistory, NETWORK_HISTORY_INTERVAL)); backgroundIntervals.push(setInterval(fetchLatency, REFRESH_INTERVAL)); + console.log('[Init] Success'); + } catch (err) { + console.error('[Init Failure]', err); + if (window.onerror) window.onerror('Initialization failed: ' + err.message, '', 0, 0, err); + } } // ---- Real-time WebSocket ---- @@ -687,6 +694,14 @@ }; } + function formatClock() { + const now = new Date(); + const h = String(now.getHours()).padStart(2, '0'); + const m = String(now.getMinutes()).padStart(2, '0'); + const s = String(now.getSeconds()).padStart(2, '0'); + return h + ':' + m + ':' + s; + } + // ---- Theme Switching ---- function toggleTheme() { const theme = dom.themeToggle.checked ? 'light' : 'dark';