From 594636b5cc8c85cd60566b878f1ad6b43aa3f86e Mon Sep 17 00:00:00 2001 From: Juanjo Gutierrez Date: Wed, 4 Feb 2026 14:47:22 +0100 Subject: [PATCH] Cleanup --- static/script.js | 49 +----------------------------------------------- 1 file changed, 1 insertion(+), 48 deletions(-) diff --git a/static/script.js b/static/script.js index f2b6a1b..fb4a610 100644 --- a/static/script.js +++ b/static/script.js @@ -16,13 +16,8 @@ document.addEventListener('DOMContentLoaded', function() { // Load initial data refreshStations(); - startAutoRefresh(); -}); - -// Start auto-refresh interval -function startAutoRefresh() { setInterval(refreshStations, REFRESH_INTERVAL); -} +}); // Refresh station data async function refreshStations() { @@ -176,38 +171,6 @@ function formatBytes(bytes) { return parseFloat((bytes / Math.pow(k, i)).toFixed(2)) + ' ' + sizes[i]; } -// Format duration from seconds to human readable format -function formatDuration(secondsStr) { - if (!secondsStr) return 'N/A'; - - const seconds = parseInt(secondsStr); - if (isNaN(seconds) || seconds <= 0) return 'Just now'; - - const hours = Math.floor(seconds / 3600); - const minutes = Math.floor((seconds % 3600) / 60); - const secs = seconds % 60; - - if (hours > 0) { - return `${hours}h ${minutes}m`; - } else if (minutes > 0) { - return `${minutes}m ${secs}s`; - } else { - return `${secs}s`; - } -} - -// Get connection status based on connection time -function getConnectionStatus(connectedTimeStr) { - if (!connectedTimeStr) return 'Unknown'; - - const seconds = parseInt(connectedTimeStr); - if (isNaN(seconds)) return 'Connected'; - - if (seconds < 60) return 'New'; - else if (seconds < 300) return 'Medium'; - else return 'Established'; -} - // Get CSS class for connection status function getConnectionStatusClass(connectedTimeStr) { if (!connectedTimeStr) return 'status-established'; @@ -219,13 +182,3 @@ function getConnectionStatusClass(connectedTimeStr) { else if (seconds < 300) return 'status-medium'; else return 'status-established'; } - -// Add CSS classes for status indicators (in case they're not in the CSS) -const style = document.createElement('style'); -style.textContent = ` - .status-connected { color: #27ae60; font-weight: bold; } - .status-connecting { color: #f39c12; font-weight: bold; } - .status-disconnected { color: #7f8c8d; font-weight: bold; } - .status-error { color: #e74c3c; font-weight: bold; } -`; -document.head.appendChild(style);