Shortcuts
@@ -1521,7 +1497,6 @@ const COUNT_HUD = {
'lp-cams-count': 'hud-cams-n',
'lp-blips-count': 'hud-blips-n',
'lp-news-count': 'hud-news-n',
- 'lp-articles-count': 'hud-articles-n',
};
function setLayerCount(id, value) {
const el = document.getElementById(id);
@@ -1781,7 +1756,6 @@ function showView(name) {
if (camsOn) loadCams();
if (blipsOn) loadBlips();
if (newsOn) loadNewsPins();
- if (articlesOn) loadArticleBlips();
}
}
if (name === 'news') loadNews(false);
@@ -2350,7 +2324,6 @@ let map = null, mapLayer = null, mapInitStarted = false;
let firesHeat = null, camsGroup = null, firesOn = false, camsOn = false;
let blipsGroup = null, blipsOn = false, blipsSince = '24h';
let newsGroup = null, newsOn = false, newsReq = 0;
-let articlesGroup = null, articlesOn = false, articlesReq = 0, articlesTimer = null, articlesRenderer = null;
let firesOpacity = 0.65, firesColor = 'brightness', firesSince = '24h';
let camsOpacity = 1.0, baseOpacity = 1.0;
let camReq = 0, fireReq = 0, blipReq = 0; // stale-response guards (rapid zoom races)
@@ -2638,7 +2611,6 @@ async function initMap() {
if (camsOn) loadCams();
if (blipsOn) loadBlips();
if (newsOn) loadNewsPins();
- if (articlesOn) loadArticleBlips();
refreshLiveOverlays();
sendLiveViewport();
}, 500);
@@ -2651,7 +2623,6 @@ async function initMap() {
camsOn = document.getElementById('lp-cams-on').checked;
blipsOn = document.getElementById('lp-blips-on').checked;
newsOn = document.getElementById('lp-news-on').checked;
- articlesOn = document.getElementById('lp-articles-on').checked;
firesSince = document.getElementById('lp-fires-since').value;
blipsSince = document.getElementById('lp-blips-since').value;
radarOn = document.getElementById('lp-radar-on').checked;
@@ -2674,7 +2645,6 @@ async function initMap() {
if (camsOn) loadCams();
if (blipsOn) loadBlips();
if (newsOn) loadNewsPins();
- if (articlesOn) loadArticleBlips();
refreshLiveOverlays();
}, 250);
});
@@ -2697,9 +2667,8 @@ function syncHud() {
set('cams', camsOn);
set('blips', blipsOn);
set('news', newsOn);
- set('articles', articlesOn);
}
-let hudFiresCount = null, hudCamsCount = null, hudBlipsCount = null, hudNewsCount = null, hudArticlesCount = null;
+let hudFiresCount = null, hudCamsCount = null, hudBlipsCount = null, hudNewsCount = null;
function setMapAttribution(text) {
if (!map) return;
@@ -3320,106 +3289,6 @@ async function loadNewsPins() {
}
}
-/* ── ARTICLE BLIPS (per-article proximate geo, all severities) ──
- GET /api/news/blips — dense field of small clustered circleMarkers.
- Separate from the critical-pin layer above; default OFF. Until the
- backend endpoint lands, a 404 idles the layer at 0 without breaking
- the map or the critical pins. */
-const ARTICLE_BLIP_COL = '#a06cd5'; // quiet violet — critical pins are cyan
-function articleBlipPopup(b) {
- const loc = esc(b.location_name || 'no location label') +
- (b.location_confidence ? ' (' + esc(b.location_confidence) + ')' : '');
- const meta = [newsTimeAgo(b.created_at), loc];
- if (b.score != null) meta.push('score ' + esc(b.score));
- return `
` +
- `
◈ ${esc(b.domain || 'article')}${b.category ? ' · ' + esc(b.category) : ''}
` +
- `
${esc(b.headline || 'Untitled article')}` +
- `
${meta.join(' · ')}
` +
- (b.url ? `
source ↗` : '') +
- `
`;
-}
-async function toggleArticleBlips() {
- articlesOn = document.getElementById('lp-articles-on').checked;
- if (articlesOn) {
- await loadArticleBlips();
- // Same cadence as the news poll; own timer so the layer refreshes
- // even when the News view (which starts newsInterval) was never opened.
- if (!articlesTimer) articlesTimer = setInterval(() => { if (articlesOn) loadArticleBlips(); }, NEWS_REFRESH_MS);
- return;
- }
- articlesReq++;
- if (articlesTimer) { clearInterval(articlesTimer); articlesTimer = null; }
- articlesGroup = dropLayer(articlesGroup);
- if (articlesRenderer && map) { map.removeLayer(articlesRenderer); articlesRenderer = null; }
- hudArticlesCount = null;
- setLayerCount('lp-articles-count', '0');
- syncHud();
-}
-async function loadArticleBlips() {
- if (!map) return;
- const req = ++articlesReq;
- const zero = () => {
- articlesGroup = dropLayer(articlesGroup);
- hudArticlesCount = 0;
- setLayerCount('lp-articles-count', '0');
- syncHud();
- };
- try {
- const r = await overlayFetch(`${API}/api/news/blips?bbox=${currentBBox()}&limit=1000`);
- if (req !== articlesReq) return; // superseded by a newer pan/zoom
- if (!r.ok) {
- console.warn(`Article blips: /api/news/blips ${r.status} — layer idle`);
- zero();
- return;
- }
- const data = await r.json();
- if (req !== articlesReq) return;
- const seen = new Set();
- const rows = (Array.isArray(data) ? data : []).filter(b => {
- if (!Number.isFinite(Number(b.lat)) || !Number.isFinite(Number(b.lon))) return false;
- if (b.id != null) { if (seen.has(b.id)) return false; seen.add(b.id); }
- return true;
- });
- articlesGroup = dropLayer(articlesGroup);
- // One persistent SVG renderer: paths are individually clickable and
- // the pe:none root lets clicks fall through to the canvas pins below
- // (Leaflet stacks svg z200 over canvas z100). A fresh renderer per
- // refresh would leak a full-viewport container on every pan/zoom.
- const renderer = articlesRenderer || (articlesRenderer = L.svg({ padding: 0.5 }));
- const markers = rows.map(b => L.circleMarker([Number(b.lat), Number(b.lon)], {
- radius: 3, weight: 1, color: ARTICLE_BLIP_COL, fillColor: ARTICLE_BLIP_COL,
- fillOpacity: 0.5, opacity: 0.75, renderer,
- }).bindPopup(articleBlipPopup(b)));
- articlesGroup = L.markerClusterGroup({
- maxClusterRadius: 40,
- showCoverageOnHover: false,
- spiderfyOnMaxZoom: true,
- chunkedLoading: true,
- chunkInterval: 100,
- chunkDelay: 10,
- iconCreateFunction: (cluster) => {
- const n = cluster.getChildCount();
- const size = n < 10 ? 'sm' : n < 100 ? 'md' : 'lg';
- return L.divIcon({
- html: '
' + n + '
',
- className: 'marker-cluster marker-cluster-articles articles-' + size,
- iconSize: L.point(40, 40),
- });
- },
- });
- articlesGroup.addLayers(markers);
- articlesGroup.addTo(map);
- setLayerCount('lp-articles-count', rows.length.toLocaleString());
- hudArticlesCount = rows.length;
- syncHud();
- } catch (e) {
- if (isAbort(e)) return;
- if (req !== articlesReq) return;
- console.warn('Article blips load failed', e);
- zero();
- }
-}
-
/* ── Live overlays (radar / alerts / WFIGS / aircraft / trains / AIS / NHC) ── */
function refreshLiveOverlays() {
if (!map) return;