mirror of
https://github.com/smittix/intercept.git
synced 2026-06-08 06:01:56 -07:00
fix: replace remaining hardcoded cyan in map utilities and mode JS files
- map-utils.js: range rings and reticle crosshair SVG use --accent-cyan - drone.js: trail polyline color reads --accent-cyan for non-threat contacts - weather-satellite.js: NOAA APT pass track reads --accent-cyan - space-weather.js: solar wind chart border/bg/axis ticks read --accent-cyan Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -231,7 +231,7 @@ const MapUtils = {
|
||||
const meters = dist * metersPerUnit;
|
||||
L.circle(center, {
|
||||
radius: meters,
|
||||
color: '#4aa3ff',
|
||||
color: getComputedStyle(document.documentElement).getPropertyValue('--accent-cyan').trim() || '#4aa3ff',
|
||||
fillColor: 'transparent',
|
||||
fillOpacity: 0,
|
||||
weight: 1,
|
||||
@@ -265,11 +265,11 @@ const MapUtils = {
|
||||
const icon = L.divIcon({
|
||||
className: 'map-reticle',
|
||||
html: `<svg width="28" height="28" viewBox="0 0 28 28" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<circle cx="14" cy="14" r="4" stroke="#4aa3ff" stroke-width="1.5"/>
|
||||
<line x1="14" y1="2" x2="14" y2="9" stroke="#4aa3ff" stroke-width="1.5"/>
|
||||
<line x1="14" y1="19" x2="14" y2="26" stroke="#4aa3ff" stroke-width="1.5"/>
|
||||
<line x1="2" y1="14" x2="9" y2="14" stroke="#4aa3ff" stroke-width="1.5"/>
|
||||
<line x1="19" y1="14" x2="26" y2="14" stroke="#4aa3ff" stroke-width="1.5"/>
|
||||
<circle cx="14" cy="14" r="4" style="stroke:var(--accent-cyan)" stroke-width="1.5"/>
|
||||
<line x1="14" y1="2" x2="14" y2="9" style="stroke:var(--accent-cyan)" stroke-width="1.5"/>
|
||||
<line x1="14" y1="19" x2="14" y2="26" style="stroke:var(--accent-cyan)" stroke-width="1.5"/>
|
||||
<line x1="2" y1="14" x2="9" y2="14" style="stroke:var(--accent-cyan)" stroke-width="1.5"/>
|
||||
<line x1="19" y1="14" x2="26" y2="14" style="stroke:var(--accent-cyan)" stroke-width="1.5"/>
|
||||
</svg>`,
|
||||
iconSize: [28, 28],
|
||||
iconAnchor: [14, 14],
|
||||
|
||||
@@ -137,7 +137,7 @@ var DroneMode = (function () {
|
||||
_trails[contact.id].setLatLngs(trailPoints);
|
||||
} else if (trailPoints.length > 1) {
|
||||
_trails[contact.id] = L.polyline(trailPoints, {
|
||||
color: contact.risk_level === 'high' ? '#ff4444' : '#00ccff',
|
||||
color: contact.risk_level === 'high' ? '#ff4444' : (getComputedStyle(document.documentElement).getPropertyValue('--accent-cyan').trim() || '#00ccff'),
|
||||
weight: 1.5,
|
||||
opacity: 0.6,
|
||||
}).addTo(_map);
|
||||
|
||||
@@ -16,13 +16,13 @@ const SpaceWeather = (function () {
|
||||
let _xrayChart = null;
|
||||
|
||||
// Current image selections
|
||||
let _solarImageKey = 'sdo_193';
|
||||
let _drapFreq = 'drap_global';
|
||||
const SOLAR_IMAGE_FALLBACKS = {
|
||||
sdo_193: 'https://sdo.gsfc.nasa.gov/assets/img/latest/latest_512_0193.jpg',
|
||||
sdo_304: 'https://sdo.gsfc.nasa.gov/assets/img/latest/latest_512_0304.jpg',
|
||||
sdo_magnetogram: 'https://sdo.gsfc.nasa.gov/assets/img/latest/latest_512_HMIBC.jpg',
|
||||
};
|
||||
let _solarImageKey = 'sdo_193';
|
||||
let _drapFreq = 'drap_global';
|
||||
const SOLAR_IMAGE_FALLBACKS = {
|
||||
sdo_193: 'https://sdo.gsfc.nasa.gov/assets/img/latest/latest_512_0193.jpg',
|
||||
sdo_304: 'https://sdo.gsfc.nasa.gov/assets/img/latest/latest_512_0304.jpg',
|
||||
sdo_magnetogram: 'https://sdo.gsfc.nasa.gov/assets/img/latest/latest_512_HMIBC.jpg',
|
||||
};
|
||||
|
||||
/** Stable cache-bust key that rotates every 5 minutes (matches backend max-age). */
|
||||
function _cacheBust() {
|
||||
@@ -53,35 +53,35 @@ const SpaceWeather = (function () {
|
||||
_fetchData();
|
||||
}
|
||||
|
||||
function selectSolarImage(key) {
|
||||
_solarImageKey = key;
|
||||
_updateSolarImageTabs();
|
||||
const frame = document.getElementById('swSolarImageFrame');
|
||||
if (frame) {
|
||||
frame.innerHTML = '<div class="sw-loading">Loading</div>';
|
||||
_loadImageWithFallback(
|
||||
frame,
|
||||
['/space-weather/image/' + key + '?' + _cacheBust(), _directImageUrlForKey(key)],
|
||||
key,
|
||||
'<div class="sw-empty">NASA SDO image is temporarily unavailable</div>'
|
||||
);
|
||||
}
|
||||
}
|
||||
function selectSolarImage(key) {
|
||||
_solarImageKey = key;
|
||||
_updateSolarImageTabs();
|
||||
const frame = document.getElementById('swSolarImageFrame');
|
||||
if (frame) {
|
||||
frame.innerHTML = '<div class="sw-loading">Loading</div>';
|
||||
_loadImageWithFallback(
|
||||
frame,
|
||||
['/space-weather/image/' + key + '?' + _cacheBust(), _directImageUrlForKey(key)],
|
||||
key,
|
||||
'<div class="sw-empty">NASA SDO image is temporarily unavailable</div>'
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
function selectDrapFreq(key) {
|
||||
_drapFreq = key;
|
||||
_updateDrapTabs();
|
||||
const frame = document.getElementById('swDrapImageFrame');
|
||||
if (frame) {
|
||||
frame.innerHTML = '<div class="sw-loading">Loading</div>';
|
||||
_loadImageWithFallback(
|
||||
frame,
|
||||
['/space-weather/image/' + key + '?' + _cacheBust()],
|
||||
key,
|
||||
'<div class="sw-empty">Failed to load image</div>'
|
||||
);
|
||||
}
|
||||
}
|
||||
function selectDrapFreq(key) {
|
||||
_drapFreq = key;
|
||||
_updateDrapTabs();
|
||||
const frame = document.getElementById('swDrapImageFrame');
|
||||
if (frame) {
|
||||
frame.innerHTML = '<div class="sw-loading">Loading</div>';
|
||||
_loadImageWithFallback(
|
||||
frame,
|
||||
['/space-weather/image/' + key + '?' + _cacheBust()],
|
||||
key,
|
||||
'<div class="sw-empty">Failed to load image</div>'
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
function toggleAutoRefresh() {
|
||||
const cb = document.getElementById('swAutoRefresh');
|
||||
@@ -101,41 +101,41 @@ const SpaceWeather = (function () {
|
||||
}
|
||||
}
|
||||
|
||||
function _stopAutoRefresh() {
|
||||
if (_pollTimer) { clearInterval(_pollTimer); _pollTimer = null; }
|
||||
}
|
||||
|
||||
function _directImageUrlForKey(key) {
|
||||
const base = SOLAR_IMAGE_FALLBACKS[key];
|
||||
if (!base) return null;
|
||||
return base + '?' + _cacheBust();
|
||||
}
|
||||
|
||||
function _loadImageWithFallback(frame, urls, alt, failureHtml) {
|
||||
const candidates = (urls || []).filter(Boolean);
|
||||
if (!frame || candidates.length === 0) {
|
||||
if (frame) frame.innerHTML = failureHtml;
|
||||
return;
|
||||
}
|
||||
|
||||
let index = 0;
|
||||
const img = new Image();
|
||||
img.alt = alt;
|
||||
img.referrerPolicy = 'no-referrer';
|
||||
img.onload = function () {
|
||||
frame.innerHTML = '';
|
||||
frame.appendChild(img);
|
||||
};
|
||||
img.onerror = function () {
|
||||
index += 1;
|
||||
if (index < candidates.length) {
|
||||
img.src = candidates[index];
|
||||
return;
|
||||
}
|
||||
frame.innerHTML = failureHtml;
|
||||
};
|
||||
img.src = candidates[index];
|
||||
}
|
||||
function _stopAutoRefresh() {
|
||||
if (_pollTimer) { clearInterval(_pollTimer); _pollTimer = null; }
|
||||
}
|
||||
|
||||
function _directImageUrlForKey(key) {
|
||||
const base = SOLAR_IMAGE_FALLBACKS[key];
|
||||
if (!base) return null;
|
||||
return base + '?' + _cacheBust();
|
||||
}
|
||||
|
||||
function _loadImageWithFallback(frame, urls, alt, failureHtml) {
|
||||
const candidates = (urls || []).filter(Boolean);
|
||||
if (!frame || candidates.length === 0) {
|
||||
if (frame) frame.innerHTML = failureHtml;
|
||||
return;
|
||||
}
|
||||
|
||||
let index = 0;
|
||||
const img = new Image();
|
||||
img.alt = alt;
|
||||
img.referrerPolicy = 'no-referrer';
|
||||
img.onload = function () {
|
||||
frame.innerHTML = '';
|
||||
frame.appendChild(img);
|
||||
};
|
||||
img.onerror = function () {
|
||||
index += 1;
|
||||
if (index < candidates.length) {
|
||||
img.src = candidates[index];
|
||||
return;
|
||||
}
|
||||
frame.innerHTML = failureHtml;
|
||||
};
|
||||
img.src = candidates[index];
|
||||
}
|
||||
|
||||
function _fetchData() {
|
||||
fetch('/space-weather/data')
|
||||
@@ -387,6 +387,7 @@ const SpaceWeather = (function () {
|
||||
}
|
||||
|
||||
if (_windChart) { _windChart.destroy(); _windChart = null; }
|
||||
const _accentCyan = getComputedStyle(document.documentElement).getPropertyValue('--accent-cyan').trim() || '#00ccff';
|
||||
_windChart = new Chart(canvas, {
|
||||
type: 'line',
|
||||
data: {
|
||||
@@ -395,8 +396,8 @@ const SpaceWeather = (function () {
|
||||
{
|
||||
label: 'Speed (km/s)',
|
||||
data: speedData,
|
||||
borderColor: '#00ccff',
|
||||
backgroundColor: '#00ccff22',
|
||||
borderColor: _accentCyan,
|
||||
backgroundColor: _accentCyan + '22',
|
||||
borderWidth: 1.5,
|
||||
pointRadius: 0,
|
||||
fill: true,
|
||||
@@ -423,7 +424,7 @@ const SpaceWeather = (function () {
|
||||
},
|
||||
scales: {
|
||||
x: { display: true, ticks: { color: '#555', font: { size: 9 }, maxTicksLimit: 8 }, grid: { color: '#ffffff08' } },
|
||||
y: { display: true, position: 'left', ticks: { color: '#00ccff', font: { size: 9 } }, grid: { color: '#ffffff08' }, title: { display: false } },
|
||||
y: { display: true, position: 'left', ticks: { color: _accentCyan, font: { size: 9 } }, grid: { color: '#ffffff08' }, title: { display: false } },
|
||||
y1: { display: true, position: 'right', ticks: { color: '#ff8800', font: { size: 9 } }, grid: { drawOnChartArea: false } }
|
||||
},
|
||||
interaction: { mode: 'index', intersect: false }
|
||||
|
||||
@@ -982,7 +982,7 @@ const WeatherSat = (function() {
|
||||
const trajectory = pass?.trajectory;
|
||||
if (!trajectory || trajectory.length === 0) return;
|
||||
|
||||
const color = pass.mode === 'LRPT' ? '#00ff88' : '#00d4ff';
|
||||
const color = pass.mode === 'LRPT' ? '#00ff88' : (getComputedStyle(document.documentElement).getPropertyValue('--accent-cyan').trim() || '#00d4ff');
|
||||
|
||||
ctx.beginPath();
|
||||
ctx.strokeStyle = color;
|
||||
|
||||
Reference in New Issue
Block a user