From bdc723d1977b6e4bbc56d9e3509b4316d0b01c5b Mon Sep 17 00:00:00 2001 From: CN-JS-HuiBai Date: Sat, 11 Apr 2026 00:24:35 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=85=B3=E9=94=AE=E5=87=BD?= =?UTF-8?q?=E6=95=B0=E7=BC=BA=E5=A4=B1=E5=AF=BC=E8=87=B4=E7=9A=84=E6=95=85?= =?UTF-8?q?=E9=9A=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/js/app.js | 15 +++++++++++++++ 1 file changed, 15 insertions(+) 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';