Merge pull request #145 from mitchross/main

All review issues addressed. Merging with fixup commit for XSS escaping, import cleanup, VDL2 click behavior, frequency defaults, and misc fixes.
This commit is contained in:
Smittix
2026-03-01 20:42:50 +00:00
committed by GitHub
14 changed files with 1592 additions and 86 deletions
+30 -3
View File
@@ -9,6 +9,7 @@ const WeatherSat = (function() {
let isRunning = false;
let eventSource = null;
let images = [];
let allPasses = [];
let passes = [];
let selectedPassIndex = -1;
let currentSatellite = null;
@@ -130,6 +131,8 @@ const WeatherSat = (function() {
if (!locationListenersAttached) {
if (latInput) latInput.addEventListener('change', saveLocationFromInputs);
if (lonInput) lonInput.addEventListener('change', saveLocationFromInputs);
const satSelect = document.getElementById('weatherSatSelect');
if (satSelect) satSelect.addEventListener('change', applyPassFilter);
locationListenersAttached = true;
}
}
@@ -584,6 +587,7 @@ const WeatherSat = (function() {
}
if (!storedLat || !storedLon) {
allPasses = [];
passes = [];
selectedPassIndex = -1;
renderPasses([]);
@@ -599,8 +603,7 @@ const WeatherSat = (function() {
const data = await response.json();
if (data.status === 'ok') {
passes = data.passes || [];
// Apply satellite filter and render
allPasses = data.passes || [];
applyPassFilter();
}
} catch (err) {
@@ -608,6 +611,29 @@ const WeatherSat = (function() {
}
}
/**
* Filter displayed passes by the currently selected satellite dropdown value.
* Updates the module-level `passes` from `allPasses` so selectPass/countdown work.
*/
function applyPassFilter() {
const satSelect = document.getElementById('weatherSatSelect');
const selected = satSelect?.value;
passes = selected
? allPasses.filter(p => p.satellite === selected)
: allPasses.slice();
selectedPassIndex = -1;
renderPasses(passes);
renderTimeline(passes);
updateCountdownFromPasses();
if (passes.length > 0) {
selectPass(0);
} else {
updateGroundTrack(null);
drawPolarPlot(null);
}
}
/**
* Select a pass to display in polar plot and map
*/
@@ -712,6 +738,7 @@ const WeatherSat = (function() {
* Draw polar plot for a pass trajectory
*/
function drawPolarPlot(pass) {
if (!pass) return;
const canvas = document.getElementById('wxsatPolarCanvas');
if (!canvas) return;
@@ -771,7 +798,7 @@ const WeatherSat = (function() {
ctx.stroke();
// Trajectory
const trajectory = pass.trajectory;
const trajectory = pass?.trajectory;
if (!trajectory || trajectory.length === 0) return;
const color = pass.mode === 'LRPT' ? '#00ff88' : '#00d4ff';