Upload deploy/globe/app.js with huggingface_hub
Browse files66 unmodified lines67686970717273124 unmodified lines198199200201202203204205206207208209210211212213214141 unmodified lines35635735835936036136236336436536636736836923 unmodified lines3933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274 unmodified lines43243343443543643743843944044144244344416 unmodified lines46146246346446546610 unmodified lines47747847948048148239 unmodified lines52252352452552652752824 unmodified lines553554555556557558559560561562563564565566567568569570571572573574575576577293 unmodified lines8718728738748758769 unmodified lines886887888889890891892193 unmodified lines10861087108810891090109110923 unmodified lines10961097109810991100110166 unmodified lines'horizon-fog-blend': 0.14,'fog-color': '#06111c','fog-ground-blend': 0.42,'atmosphere-blend': 0.3,});} catch (e) { console.warn('globe 不可用', e); }}124 unmodified linesfunction addBaseRaster() {// 真实地表:NASA GIBS 静态影像,本地 nginx 已做 30 天缓存map.addSource('base-night', {type: 'raster', tileSize: 256, maxzoom: 8, attribution: 'NASA GIBS / VIIRS',tiles: [TILES + 'VIIRS_CityLights_2012/default/2012-01-01/GoogleMapsCompatible_Level8/{z}/{y}/{x}.jpg'],});map.addLayer({ id: 'base-night', type: 'raster', source: 'base-night',paint: { 'raster-opacity': 0.9, 'raster-brightness-max': 0.95, 'raster-contrast': 0.1, 'raster-fade-duration': 260 } });map.addSource('base-relief', {type: 'raster', tileSize: 256, maxzoom: 8, attribution: 'NASA GIBS / Blue Marble',tiles: [TILES + 'BlueMarble_ShadedRelief_Bathymetry/default/500m/GoogleMapsCompatible_Level8/{z}/{y}/{x}.jpeg'],});map.addLayer({ id: 'base-relief', type: 'raster', source: 'base-relief',paint: { 'raster-opacity': 0.94, 'raster-saturation': -0.12, 'raster-brightness-max': 0.72, 'raster-fade-duration': 260 } });map.setLayoutProperty('base-relief', 'visibility', 'none');}141 unmodified lines} });}const FL = { rows: [], mil: [], t0: 0, timer: null };function initFlights(data) {FL.rows = data.flights || [];FL.mil = data.mil || [];FL.t0 = data.generated || Date.now() / 1000;}function milFC() {const now = Date.now() / 1000;const dt = Math.min(Math.max(now - FL.t0, 0), 1800);23 unmodified linesif (lon > 180) lon -= 360;if (lon < -180) lon += 360;feats[i] = { type: 'Feature', geometry: { type: 'Point', coordinates: [lon, lat] },properties: { c: r[5], o: r[6], a: r[2], v: r[3], q: r[7], t: r[4], s: i % 3 === 0 ? 1 : 0, i } };}return { type: 'FeatureCollection', features: feats };}function planeIcon() {const size = 28;const cv = document.createElement('canvas');cv.width = cv.height = size;const g = cv.getContext('2d');g.translate(size / 2, size / 2);g.fillStyle = '#dceeff';const half = () => {g.beginPath();g.moveTo(0, -12);g.lineTo(2.2, -3.5);g.lineTo(11, 3);g.lineTo(11, 5.4);g.lineTo(2.2, 2.4);g.lineTo(2, 8.4);g.lineTo(5.2, 10.6);g.lineTo(5.2, 12);g.lineTo(0, 10.8);g.closePath();g.fill();};half();g.scale(-1, 1);half();return g.getImageData(0, 0, size, size);}4 unmodified linesfilter: ['!', ['in', ['get', 'q'], ['literal', ['7700', '7600', '7500']]]],layout: {'icon-image': 'plane-icon','icon-size': ['interpolate', ['linear'], ['zoom'], 1, 0.34, 3, 0.56, 5, 0.82, 7, 1.0],'icon-rotate': ['get', 't'],'icon-rotation-alignment': 'map','icon-allow-overlap': true,'icon-ignore-placement': true,},paint: { 'icon-opacity': ['interpolate', ['linear'], ['zoom'], 1, 0.38, 3, 0.5, 5, 0.62, 7, 0.72] } });map.addSource('mil', { type: 'geojson', data: milFC() });map.addLayer({ id: 'mil-pt', type: 'circle', source: 'mil',paint: {16 unmodified linesif (!map.getLayer('fl-air')) return;const base = ['!', ['in', ['get', 'q'], ['literal', ['7700', '7600', '7500']]]];const z = map.getZoom();// 分级采样:全球看分布,区域看密度,近景看全部if (z < 2.8) map.setFilter('fl-air', ['all', base, ['==', ['get', 's'], 1]]);else if (z < 4.6) map.setFilter('fl-air', ['all', base, ['<', ['%', ['get', 'i'], 2], 1]]);10 unmodified linessrc.setData(fc);const msrc = map.getSource('mil');if (msrc) msrc.setData(milFC());window.__flt = { n: (window.__flt ? window.__flt.n : 0) + 1,p: fc.features.length ? fc.features[0].geometry.coordinates : null };};39 unmodified linesreturn ['in', ['get', 'g'], ['literal', on]];}const ISSK = ['case', ['==', ['get', 'n'], 'ISS (ZARYA)'], 1.9, 1];function addSats() {map.addSource('sats', { type: 'geojson', data: { type: 'FeatureCollection', features: [] } });24 unmodified lines} });}let ISS_MK = null;function startSats() {const tick = () => {const on = document.getElementById('l-sat').checked;if (ISS_MK) ISS_MK.getElement().style.display = on ? '' : 'none';const src = map.getSource('sats');if (!src || !on) return;const fc = satFC();src.setData(fc);const iss = fc.features.find((f) => f.properties.g === 'stations' && /ISS/.test(f.properties.n));if (!ISS_MK) {const el = document.createElement('div');el.className = 'satiss';el.textContent = 'ISS';ISS_MK = new maplibregl.Marker({ element: el, anchor: 'left', offset: [7, 0] }).setLngLat(iss ? iss.geometry.coordinates : [0, 0]).addTo(map);}if (iss) ISS_MK.setLngLat(iss.geometry.coordinates);else ISS_MK.getElement().style.display = 'none';};tick();if (SAT.timer) clearInterval(SAT.timer);293 unmodified lines<span class="v">${((r.n / sum) * 100).toFixed(0)}%</span></div>`).join('');}function renderRank() {const key = state.rank || 'epi';const list = (state.summary.all_countries || [])9 unmodified lines<div class="rk" data-f="${c.f}" title="飞到 ${c.cc}"><span class="i">${String(i + 1).padStart(2, '0')}</span><span class="nm">${c.cc}</span><span class="tr"><span class="fl" style="width:${((c[key] || 0) / max) * 100}%"></span></span><span class="v">${Math.round(c[key] || 0).toLocaleString()}</span></div>`).join('');document.querySelectorAll('.rk').forEach((el) => {193 unmodified lines}/* ---------------- 交互 ---------------- */function bindMap() {['ev-conflict', 'ev-mil', 'ev-social', 'ev-diplo', 'ev-coop', 'ev-quake', 'ev-nature'].forEach((id) => {map.on('click', id, (e) => {3 unmodified linesmap.on('mouseenter', id, () => { map.getCanvas().style.cursor = 'pointer'; });map.on('mouseleave', id, () => { map.getCanvas().style.cursor = ''; });});map.on('click', 'cdhe-pts', (e) => {const f = e.features[0];const s = f.properties.s;66 unmodified lines67686970717273124 unmodified lines198199200201202203204205206207208209210211212213214215216141 unmodified lines35835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645723 unmodified lines4814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235244 unmodified lines52953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157216 unmodified lines58959059159259359459559659759859960010 unmodified lines61161261361461561661761861962039 unmodified lines66066166266366466566624 unmodified lines691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720293 unmodified lines10141015101610171018101910201021102210231024102510261027102810299 unmodified lines10391040104110421043104410451046193 unmodified lines1240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313143 unmodified lines131813191320132113221323132413251326132713281329133066 unmodified lines'horizon-fog-blend': 0.14,'fog-color': '#06111c','fog-ground-blend': 0.42,'atmosphere-blend': 0.45,});} catch (e) { console.warn('globe 不可用', e); }}124 unmodified linesfunction addBaseRaster() {// 真实地表:NASA GIBS 静态影像,本地 nginx 已做 30 天缓存map.addSource('base-night', {type: 'raster', tileSize: 256, maxzoom: 6, attribution: 'NASA GIBS / VIIRS',tiles: [TILES + 'VIIRS_CityLights_2012/default/2012-01-01/GoogleMapsCompatible_Level8/{z}/{y}/{x}.jpg'],});map.addLayer({ id: 'base-night', type: 'raster', source: 'base-night',paint: { 'raster-opacity': 0.9, 'raster-brightness-max': 0.95, 'raster-contrast': 0.1, 'raster-fade-duration': 260 } });map.addSource('base-relief', {type: 'raster', tileSize: 256, maxzoom: 6, attribution: 'NASA GIBS / Blue Marble',tiles: [TILES + 'BlueMarble_ShadedRelief_Bathymetry/default/500m/GoogleMapsCompatible_Level8/{z}/{y}/{x}.jpeg'],});map.addLayer({ id: 'base-relief', type: 'raster', source: 'base-relief',paint: { 'raster-opacity': 0.96, 'raster-saturation': 0.05,'raster-brightness-min': 0.04, 'raster-brightness-max': 0.95,'raster-contrast': -0.12, 'raster-fade-duration': 180 } });map.setLayoutProperty('base-relief', 'visibility', 'none');}141 unmodified lines} });}const AIRLINE = {CCA: '中国国航', CES: '东方航空', CSN: '南方航空', CHH: '海南航空', CXA: '厦门航空',CSC: '四川航空', CSZ: '深圳航空', CQH: '春秋航空', CUA: '中国联航', CYZ: '顺丰航空',CAL: '中华航空', EVA: '长荣航空', CPA: '国泰航空', HKE: '香港快运', CRK: '香港航空',JAL: '日本航空', ANA: '全日空', APJ: '乐桃航空', KAL: '大韩航空', AAR: '韩亚航空',SIA: '新加坡航空', SLK: '酷航', MAS: '马来西亚航空', AXM: '亚洲航空', GIA: '印尼鹰航',LNI: '狮航', CEB: '宿务太平洋', PAL: '菲律宾航空', THA: '泰国国际', AIQ: '泰亚航',VNL: '越捷', HVN: '越南航空', AIC: '印度航空', IGO: '靛蓝航空', VTI: '印度快运',UAE: '阿联酋航空', ETD: '阿提哈德', QTR: '卡塔尔航空', SVA: '沙特航空', KAC: '科威特航空',THY: '土耳其航空', MSR: '埃及航空', ETH: '埃塞俄比亚航空', KQA: '肯尼亚航空',SAA: '南非航空', RAM: '摩洛哥皇家', RWD: '卢旺达航空',BAW: '英国航空', EZY: '易捷航空', VIR: '维珍航空', AFR: '法国航空', TVF: '泛航法国',DLH: '汉莎航空', EWG: '欧洲之翼', SWR: '瑞士航空', AUA: '奥地利航空', KLM: '荷兰皇家',TRA: '泛航荷兰', IBE: '西班牙航空', VLG: '伏林航空', AEA: '欧罗巴航空', TAP: '葡萄牙航空',ITY: 'ITA 航空', SAS: '北欧航空', NAX: '挪威航空', RYR: '瑞安航空', EIN: '爱尔兰航空',WZZ: '维兹航空', LOT: '波兰航空', CSA: '捷克航空', AEE: '爱琴海航空', ELL: '波罗的海航空',QFA: '澳洲航空', JST: '捷星航空', ANZ: '新西兰航空', VOZ: '维珍澳洲',ACA: '加拿大航空', WJA: '西捷航空', UAL: '美联航', DAL: '达美航空', AAL: '美国航空',SWA: '西南航空', JBU: '捷蓝航空', ASA: '阿拉斯加航空', FFT: '边疆航空', NKS: '精神航空',HAL: '夏威夷航空', AMX: '墨西哥航空', AVA: '哥伦比亚航空', LAN: '智利航空',GLO: '戈尔航空', AZU: '蓝色巴西', TAM: '巴西天马', ARG: '阿根廷航空',};function airlineOf(cs) {return AIRLINE[(cs || '').slice(0, 3)] || '';}const FL = { rows: [], mil: [], trails: {}, t0: 0, timer: null, sel: null };function initFlights(data) {FL.rows = data.flights || [];FL.mil = data.mil || [];FL.trails = data.trails || {};FL.t0 = data.generated || Date.now() / 1000;}/* 球面正算:从 (lat,lon) 沿方位角 brg 前进 dist 米 */function dest(lat, lon, brg, dist) {const R = 6371000, d = dist / R, b = (brg * Math.PI) / 180;const p1 = (lat * Math.PI) / 180, l1 = (lon * Math.PI) / 180;const p2 = Math.asin(Math.sin(p1) * Math.cos(d) + Math.cos(p1) * Math.sin(d) * Math.cos(b));const l2 = l1 + Math.atan2(Math.sin(b) * Math.sin(d) * Math.cos(p1),Math.cos(d) - Math.sin(p1) * Math.sin(p2));let lo = (l2 * 180) / Math.PI;if (lo > 180) lo -= 360;if (lo < -180) lo += 360;return [lo, (p2 * 180) / Math.PI];}/* 已飞航迹:用后端的真实历史点 */function trailFC() {const now = Date.now() / 1000;const dt = Math.min(Math.max(now - FL.t0, 0), 1800);const feats = [];Object.entries(FL.trails).forEach(([hexid, pts]) => {if (!pts || !pts.length) return;const r = FL.rows.find((x) => x[7] === hexid);if (!r) return;const pos = flightPos(r);if (pts.length >= 2) {feats.push({ type: 'Feature', geometry: { type: 'LineString', coordinates: pts.map((p) => [p[0], p[1]]) },properties: { h: hexid } });} else if (r[3] > 30) {// 历史还没攒够 2 点:按航向反推 20 分钟,先给出航迹尾const back = dest(pos[1], pos[0], (r[4] + 180) % 360, r[3] * 20 * 60);feats.push({ type: 'Feature', geometry: { type: 'LineString', coordinates: [back, pos] },properties: { h: hexid } });}});return { type: 'FeatureCollection', features: feats };}/* 预测线:从当前位置沿航向按速度外推 45 分钟 */function forecastFC() {const now = Date.now() / 1000;const dt = Math.min(Math.max(now - FL.t0, 0), 1800);const feats = [];if (!FL.sel) return { type: 'FeatureCollection', features: feats };// 只给选中的飞机画前向外推线,否则满屏虚线for (let i = 0; i < FL.rows.length; i += 1) {const r = FL.rows[i];if (r[7] !== FL.sel || !r[3]) continue;const rad = (r[4] * Math.PI) / 180;const lat = r[1] + (r[3] * Math.cos(rad) * dt) / 111320;const cosLat = Math.cos((lat * Math.PI) / 180) || 0.01;let lon = r[0] + (r[3] * Math.sin(rad) * dt) / (111320 * cosLat);if (lon > 180) lon -= 360;if (lon < -180) lon += 360;const ahead = dest(lat, lon, r[4], r[3] * 60 * 18);feats.push({ type: 'Feature', geometry: { type: 'LineString', coordinates: [[lon, lat], ahead] },properties: { h: r[7] } });}return { type: 'FeatureCollection', features: feats };}function milFC() {const now = Date.now() / 1000;const dt = Math.min(Math.max(now - FL.t0, 0), 1800);23 unmodified linesif (lon > 180) lon -= 360;if (lon < -180) lon += 360;feats[i] = { type: 'Feature', geometry: { type: 'Point', coordinates: [lon, lat] },properties: { c: r[5], o: r[6], a: r[2], v: r[3], q: r[7], t: r[4], s: i % 3 === 0 ? 1 : 0, i, h: r[7] } };}return { type: 'FeatureCollection', features: feats };}function planeIcon() {const size = 40;const cv = document.createElement('canvas');cv.width = cv.height = size;const g = cv.getContext('2d');g.translate(size / 2, size / 2);// 机身 + 后掠翼 + 平尾,机头朝上(-y)g.beginPath();g.moveTo(0, -16);g.quadraticCurveTo(1.9, -13.5, 2.1, -6);g.lineTo(2.1, -2.6);g.lineTo(15, 3.4);g.lineTo(15, 5.4);g.lineTo(2.1, 1.6);g.lineTo(1.9, 6.8);g.lineTo(6.2, 10.2);g.lineTo(6.2, 11.6);g.lineTo(0, 10.2);g.lineTo(-6.2, 11.6);g.lineTo(-6.2, 10.2);g.lineTo(-1.9, 6.8);g.lineTo(-2.1, 1.6);g.lineTo(-15, 5.4);g.lineTo(-15, 3.4);g.lineTo(-2.1, -2.6);g.lineTo(-2.1, -6);g.quadraticCurveTo(-1.9, -13.5, 0, -16);g.closePath();g.fillStyle = '#e8f6ff';g.fill();g.lineWidth = 1.6;g.strokeStyle = 'rgba(6,16,26,.85)';g.stroke();return g.getImageData(0, 0, size, size);}4 unmodified linesfilter: ['!', ['in', ['get', 'q'], ['literal', ['7700', '7600', '7500']]]],layout: {'icon-image': 'plane-icon','icon-size': ['interpolate', ['linear'], ['zoom'], 1, 0.26, 3, 0.4, 5, 0.58, 7, 0.72],'icon-rotate': ['get', 't'],'icon-rotation-alignment': 'map','icon-allow-overlap': true,'icon-ignore-placement': true,},paint: { 'icon-opacity': ['interpolate', ['linear'], ['zoom'], 1, 0.38, 3, 0.5, 5, 0.62, 7, 0.72] } });map.addSource('trails', { type: 'geojson', data: trailFC() });map.addLayer({ id: 'tr-line', type: 'line', source: 'trails',paint: {'line-color': '#7fd0f5', 'line-width': 0.65, 'line-opacity': 0.26,'line-blur': 0.2,} });map.addSource('forecast', { type: 'geojson', data: forecastFC() });map.addLayer({ id: 'fc-line', type: 'line', source: 'forecast',paint: {'line-color': '#7fd0f5', 'line-width': 0.65, 'line-opacity': 0.15,'line-dasharray': [1.6, 2.2],} });map.addSource('sel', { type: 'geojson', data: { type: 'FeatureCollection', features: [] } });map.addLayer({ id: 'sel-ring', type: 'circle', source: 'sel',paint: {'circle-radius': ['interpolate', ['linear'], ['zoom'], 1, 13, 5, 22, 8, 30],'circle-color': 'rgba(0,0,0,0)','circle-stroke-width': 1.2,'circle-stroke-color': 'rgba(90,210,255,.85)','circle-stroke-opacity': 0.9,} });map.addLayer({ id: 'sel-ring2', type: 'circle', source: 'sel',paint: {'circle-radius': ['interpolate', ['linear'], ['zoom'], 1, 7, 5, 12, 8, 16],'circle-color': 'rgba(0,0,0,0)','circle-stroke-width': 0.7,'circle-stroke-color': 'rgba(90,210,255,.45)','circle-stroke-opacity': 0.8,} });map.addSource('mil', { type: 'geojson', data: milFC() });map.addLayer({ id: 'mil-pt', type: 'circle', source: 'mil',paint: {16 unmodified linesif (!map.getLayer('fl-air')) return;const base = ['!', ['in', ['get', 'q'], ['literal', ['7700', '7600', '7500']]]];const z = map.getZoom();['tr-line', 'fc-line'].forEach((id) => {if (map.getLayer(id)) {map.setLayoutProperty(id, 'visibility',(z > 2.6 && document.getElementById('l-flights').checked) ? 'visible' : 'none');}});// 分级采样:全球看分布,区域看密度,近景看全部if (z < 2.8) map.setFilter('fl-air', ['all', base, ['==', ['get', 's'], 1]]);else if (z < 4.6) map.setFilter('fl-air', ['all', base, ['<', ['%', ['get', 'i'], 2], 1]]);10 unmodified linessrc.setData(fc);const msrc = map.getSource('mil');if (msrc) msrc.setData(milFC());const tsrc = map.getSource('trails');if (tsrc) tsrc.setData(trailFC());const fsrc = map.getSource('forecast');if (fsrc) fsrc.setData(forecastFC());window.__flt = { n: (window.__flt ? window.__flt.n : 0) + 1,p: fc.features.length ? fc.features[0].geometry.coordinates : null };};39 unmodified linesreturn ['in', ['get', 'g'], ['literal', on]];}const ISSK = ['case', ['==', ['get', 'n'], 'ISS (ZARYA)'], 1.9, ['==', ['get', 'n'], 'CSS (TIANHE)'], 1.9, 1];function addSats() {map.addSource('sats', { type: 'geojson', data: { type: 'FeatureCollection', features: [] } });24 unmodified lines} });}const SAT_TAGS = [['ISS (ZARYA)', 'ISS'], ['CSS (TIANHE)', '天宫']];const TAG_MK = {};function startSats() {const tick = () => {const on = document.getElementById('l-sat').checked;Object.values(TAG_MK).forEach((m) => { m.getElement().style.display = on ? '' : 'none'; });const src = map.getSource('sats');if (!src || !on) return;const fc = satFC();src.setData(fc);SAT_TAGS.forEach(([id, tag]) => {const f = fc.features.find((x) => x.properties.n === id);if (!TAG_MK[id]) {if (!f) return;const el = document.createElement('div');el.className = 'satiss';el.textContent = tag;TAG_MK[id] = new maplibregl.Marker({ element: el, anchor: 'left', offset: [7, 0] }).setLngLat(f.geometry.coordinates).addTo(map);}if (f) { TAG_MK[id].setLngLat(f.geometry.coordinates); TAG_MK[id].getElement().style.display = ''; }else TAG_MK[id].getElement().style.display = 'none';});};tick();if (SAT.timer) clearInterval(SAT.timer);293 unmodified lines<span class="v">${((r.n / sum) * 100).toFixed(0)}%</span></div>`).join('');}/* 压力色阶:低=蓝 中=黄 高=红,和地图的 choropleth 同一套语义 */function rampColor(t) {const stops = [[63, 169, 255], [255, 209, 102], [255, 90, 74]];const x = Math.max(0, Math.min(0.999, t));const i = x < 0.5 ? 0 : 1;const f = (x - i * 0.5) / 0.5;const c = stops[i].map((v, k) => Math.round(v + (stops[i + 1][k] - v) * f));return `rgb(${c[0]},${c[1]},${c[2]})`;}function renderRank() {const key = state.rank || 'epi';const list = (state.summary.all_countries || [])9 unmodified lines<div class="rk" data-f="${c.f}" title="飞到 ${c.cc}"><span class="i">${String(i + 1).padStart(2, '0')}</span><span class="nm">${c.cc}</span><span class="tr"><span class="fl" style="width:${((c[key] || 0) / max) * 100}%;background:${rampColor((c[key] || 0) / max)}"></span></span><span class="v">${Math.round(c[key] || 0).toLocaleString()}</span></div>`).join('');document.querySelectorAll('.rk').forEach((el) => {193 unmodified lines}/* ---------------- 交互 ---------------- */function flightPos(r) {const now = Date.now() / 1000;const dt = Math.min(Math.max(now - FL.t0, 0), 1800);const rad = (r[4] * Math.PI) / 180;const lat = r[1] + (r[3] * Math.cos(rad) * dt) / 111320;const cosLat = Math.cos((lat * Math.PI) / 180) || 0.01;let lon = r[0] + (r[3] * Math.sin(rad) * dt) / (111320 * cosLat);if (lon > 180) lon -= 360;if (lon < -180) lon += 360;return [lon, lat];}/* 选中一架飞机:卡片 + 跟随 */let FOLLOW = null;function selectFlight(hexid) {const r = FL.rows.find((x) => x[7] === hexid);if (!r) return;FL.sel = hexid;const card = document.getElementById('flcard');card.classList.add('on');document.getElementById('fc-cs').textContent = r[5] || hexid.toUpperCase();document.getElementById('fc-ty').textContent = airlineOf(r[5]) || r[6] || '';document.getElementById('fc-alt').textContent = Math.round(r[2]) + ' m';document.getElementById('fc-spd').textContent = Math.round(r[3] * 3.6) + ' km/h';document.getElementById('fc-hdg').textContent = Math.round(r[4]) + '°';document.getElementById('fc-hex').textContent = hexid.toUpperCase();const p = flightPos(r);if (map.getSource('sel')) {map.getSource('sel').setData({ type: 'FeatureCollection', features: [{ type: 'Feature', geometry: { type: 'Point', coordinates: p }, properties: {} }] });}map.easeTo({ center: p, zoom: Math.max(map.getZoom(), 4.2), duration: 900 });FOLLOW = hexid;const fsrc = map.getSource('forecast');if (fsrc) fsrc.setData(forecastFC());spinning = false;}function clearFlight() {FL.sel = null; FOLLOW = null;document.getElementById('flcard').classList.remove('on');if (map.getSource('sel')) {map.getSource('sel').setData({ type: 'FeatureCollection', features: [] });}const fsrc = map.getSource('forecast');if (fsrc) fsrc.setData({ type: 'FeatureCollection', features: [] });}function bindMap() {map.on('click', 'fl-air', (e) => {const f = e.features && e.features[0];if (f) selectFlight(f.properties.h || f.properties.c);});document.getElementById('fc-x').addEventListener('click', clearFlight);setInterval(() => {if (!FOLLOW) return;const r = FL.rows.find((x) => x[7] === FOLLOW);if (!r) { clearFlight(); return; }const p = flightPos(r);document.getElementById('fc-alt').textContent = Math.round(r[2]) + ' m';document.getElementById('fc-spd').textContent = Math.round(r[3] * 3.6) + ' km/h';document.getElementById('fc-hdg').textContent = Math.round(r[4]) + '°';map.jumpTo({ center: p });if (map.getSource('sel')) {map.getSource('sel').setData({ type: 'FeatureCollection', features: [{ type: 'Feature', geometry: { type: 'Point', coordinates: p }, properties: {} }] });}}, 2500);['ev-conflict', 'ev-mil', 'ev-social', 'ev-diplo', 'ev-coop', 'ev-quake', 'ev-nature'].forEach((id) => {map.on('click', id, (e) => {3 unmodified linesmap.on('mouseenter', id, () => { map.getCanvas().style.cursor = 'pointer'; });map.on('mouseleave', id, () => { map.getCanvas().style.cursor = ''; });});map.on('mouseenter', 'fl-air', () => { map.getCanvas().style.cursor = 'pointer'; });map.on('mouseleave', 'fl-air', () => { map.getCanvas().style.cursor = ''; });map.on('click', (e) => {const hits = map.queryRenderedFeatures(e.point, { layers: ['fl-air', 'mil-pt'] });if (!hits.length) clearFlight();});window.addEventListener('keydown', (e) => { if (e.key === 'Escape') clearFlight(); });map.on('click', 'cdhe-pts', (e) => {const f = e.features[0];const s = f.properties.s;
deploy/globe/app.js+269-40