diff --git a/static/js/BitcoinProgressBar.js b/static/js/BitcoinProgressBar.js index ec28714..6d2e43e 100644 --- a/static/js/BitcoinProgressBar.js +++ b/static/js/BitcoinProgressBar.js @@ -45,7 +45,7 @@ const BitcoinMinuteRefresh = (function () { 00:00:00 - +
UPTIME
@@ -549,56 +549,17 @@ const BitcoinMinuteRefresh = (function () { */ function updateMinuteProgress() { try { - // Get current server time + // Get current server time - keep this for other functions that might use it const now = new Date(Date.now() + (serverTimeOffset || 0)); - const seconds = now.getSeconds(); - const milliseconds = now.getMilliseconds(); - // Calculate precise progress within the minute (0-1) - const progress = (seconds + (milliseconds / 1000)) / 60; - - // Update the progress bar - const progressBar = document.getElementById('minute-progress-inner'); - if (progressBar) { - // Set the width based on the current progress through the minute - progressBar.style.width = (progress * 100) + "%"; - - // Add effects when close to the end of the minute - if (seconds >= 50) { - progressBar.classList.add('near-refresh'); - document.getElementById('refresh-status').textContent = `Refresh in ${60 - seconds} seconds...`; - } else { - progressBar.classList.remove('near-refresh'); - document.getElementById('refresh-status').textContent = 'Next refresh at the top of the minute'; - } - - // Flash when reaching 00 seconds (new minute) - if (seconds === 0 && milliseconds < 500) { - progressBar.classList.add('refresh-now'); - document.getElementById('refresh-status').textContent = 'Refreshing data...'; - - // Remove the class after animation completes - setTimeout(() => { - progressBar.classList.remove('refresh-now'); - }, 1000); - } else { - progressBar.classList.remove('refresh-now'); - } - } - - // Check if we've crossed into a new minute + // We need to keep track of minutes for other functionality const currentMinute = now.getMinutes(); - if (lastMinuteValue !== -1 && currentMinute !== lastMinuteValue && seconds === 0) { - // Trigger refresh on minute change (only when seconds are 0) - if (typeof refreshCallback === 'function') { - console.log('New minute started - triggering refresh...'); - refreshCallback(); - } - } - // Update last minute value + // Update last minute value (keeping this for any other code that might rely on it) lastMinuteValue = currentMinute; + // No progress bar updates or effects + } catch (e) { console.error("BitcoinMinuteRefresh: Error updating progress bar:", e); } @@ -654,6 +615,12 @@ const BitcoinMinuteRefresh = (function () { if (minimizedUptimeElement) { minimizedUptimeElement.textContent = `${String(hours).padStart(2, '0')}:${String(minutes).padStart(2, '0')}:${String(seconds).padStart(2, '0')}`; } + + // NEW CODE: Update the dashboard's uptime display if it exists + const dashboardUptimeElement = document.getElementById('uptimeTimer'); + if (dashboardUptimeElement) { + dashboardUptimeElement.innerHTML = `Uptime: ${String(hours).padStart(2, '0')}h ${String(minutes).padStart(2, '0')}m ${String(seconds).padStart(2, '0')}s`; + } } catch (e) { console.error("BitcoinMinuteRefresh: Error updating uptime:", e); } @@ -686,6 +653,12 @@ const BitcoinMinuteRefresh = (function () { uptimeElement = document.getElementById('uptime-timer'); } + // NEW CODE: Check if dashboard uptime element exists + const dashboardUptimeElement = document.getElementById('uptimeTimer'); + if (dashboardUptimeElement) { + console.log("BitcoinMinuteRefresh: Found dashboard uptime element, will sync with it"); + } + // Try to get stored server time information try { serverTimeOffset = parseFloat(localStorage.getItem('serverTimeOffset') || '0'); @@ -849,4 +822,4 @@ document.addEventListener('DOMContentLoaded', function () { } else { console.log("BitcoinMinuteRefresh: No refresh function found, will need to be initialized manually"); } -}); \ No newline at end of file +});