[fix](trx-frontend-http): move escapeMapHtml to global scope in app.js

escapeMapHtml was defined inside the map-core.js IIFE, making it
inaccessible to app.js and plugin files (aprs, ais, vdes, cw, hf-aprs)
that call it from global scope, causing ReferenceError at runtime.

Move the function definition to app.js (global scope), export it via
window.trx, and destructure it in map-core.js like other shared utils.

https://claude.ai/code/session_01RhL8cCcszaguKqoWn5XUxL
Signed-off-by: Claude <noreply@anthropic.com>
This commit is contained in:
Claude
2026-04-01 10:49:19 +00:00
committed by Stan Grams
parent c12cdb4c57
commit de3b9f0bbb
2 changed files with 9 additions and 10 deletions
@@ -35,6 +35,13 @@ function loadSetting(key, fallback) {
return v !== null ? JSON.parse(v) : fallback;
} catch(e) { return fallback; }
}
function escapeMapHtml(input) {
return String(input)
.replaceAll("&", "&amp;")
.replaceAll("<", "&lt;")
.replaceAll(">", "&gt;")
.replaceAll("\"", "&quot;");
}
// --- Authentication ---
let authRole = null; // null (not authenticated), "rx" (read-only), or "control" (full access)
@@ -4591,7 +4598,7 @@ Object.defineProperties(window.trx, {
});
// -- Shared utility functions --
Object.assign(window.trx, {
saveSetting, loadSetting, showHint, formatFreq, formatFreqForHumans,
saveSetting, loadSetting, showHint, escapeMapHtml, formatFreq, formatFreqForHumans,
formatWavelength, formatBwLabel, formatUptime, formatSigStrength, formatSignal,
postPath, scheduleUiFrameJob, navigateToTab, rigBadgeColor,
latLonToMaidenhead, locatorToLatLon, haversineKm, formatDistanceKm,
@@ -5,7 +5,7 @@
const T = window.trx;
// Destructure shared utility functions for convenience
const { saveSetting, loadSetting, showHint, formatFreq, formatFreqForHumans,
const { saveSetting, loadSetting, showHint, escapeMapHtml, formatFreq, formatFreqForHumans,
postPath, scheduleUiFrameJob, navigateToTab, rigBadgeColor,
formatUptime, latLonToMaidenhead, locatorToLatLon, haversineKm,
formatDistanceKm, formatTimeAgo, currentDecodeHistoryRetentionMs,
@@ -2430,14 +2430,6 @@
});
}
function escapeMapHtml(input) {
return String(input)
.replaceAll("&", "&amp;")
.replaceAll("<", "&lt;")
.replaceAll(">", "&gt;")
.replaceAll("\"", "&quot;");
}
function formatDecodeLocatorTime(tsMs) {
if (!Number.isFinite(tsMs)) return "--:--:--";
return new Date(tsMs).toLocaleTimeString([], {