diff --git a/templates/index.html b/templates/index.html index c29bdb3..9d5cbf8 100644 --- a/templates/index.html +++ b/templates/index.html @@ -4364,6 +4364,10 @@ if (wifiLayoutContainer) wifiLayoutContainer.style.display = mode === 'wifi' ? 'flex' : 'none'; if (btLayoutContainer) btLayoutContainer.style.display = mode === 'bluetooth' ? 'flex' : 'none'; if (satelliteVisuals) satelliteVisuals.style.display = mode === 'satellite' ? 'block' : 'none'; + const satFrame = document.getElementById('satelliteDashboardFrame'); + if (satFrame && satFrame.contentWindow) { + satFrame.contentWindow.postMessage({type: 'satellite-visibility', visible: mode === 'satellite'}, '*'); + } if (aprsVisuals) aprsVisuals.style.display = mode === 'aprs' ? 'flex' : 'none'; if (tscmVisuals) tscmVisuals.style.display = mode === 'tscm' ? 'flex' : 'none'; if (spyStationsVisuals) spyStationsVisuals.style.display = mode === 'spystations' ? 'flex' : 'none'; diff --git a/templates/satellite_dashboard.html b/templates/satellite_dashboard.html index 0772cec..8b1f236 100644 --- a/templates/satellite_dashboard.html +++ b/templates/satellite_dashboard.html @@ -362,6 +362,33 @@ return false; } + let positionPollingInterval = null; + + function startPositionPolling() { + if (!positionPollingInterval) { + updateRealTimePositions(); + positionPollingInterval = setInterval(updateRealTimePositions, 5000); + } + } + + function stopPositionPolling() { + if (positionPollingInterval) { + clearInterval(positionPollingInterval); + positionPollingInterval = null; + } + } + + // Listen for visibility messages from parent page (embedded mode) + window.addEventListener('message', (event) => { + if (event.data && event.data.type === 'satellite-visibility') { + if (event.data.visible) { + startPositionPolling(); + } else { + stopPositionPolling(); + } + } + }); + document.addEventListener('DOMContentLoaded', () => { loadDashboardSatellites(); setupEmbeddedMode(); @@ -370,7 +397,11 @@ updateClock(); setInterval(updateClock, 1000); setInterval(updateCountdown, 1000); - setInterval(updateRealTimePositions, 5000); + // In standalone mode, start polling immediately. + // In embedded mode, wait for parent to signal visibility. + if (!isEmbedded) { + startPositionPolling(); + } loadAgents(); if (!usedShared) { getLocation();