mirror of
https://github.com/KubaPro010/fm-dx-webserver.git
synced 2026-07-31 01:09:18 +02:00
@@ -421,7 +421,8 @@ function handleData(wss, receivedData, rdsWss) {
|
|||||||
id: currentTx.id,
|
id: currentTx.id,
|
||||||
pi: currentTx.pi,
|
pi: currentTx.pi,
|
||||||
reg: currentTx.reg,
|
reg: currentTx.reg,
|
||||||
otherMatches: currentTx.others
|
otherMatches: currentTx.others,
|
||||||
|
score: currentTx.score,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -58,6 +58,7 @@ let serverConfig = {
|
|||||||
lat: "",
|
lat: "",
|
||||||
lon: "",
|
lon: "",
|
||||||
broadcastTuner: false,
|
broadcastTuner: false,
|
||||||
|
gpsMode: false,
|
||||||
proxyIp: "",
|
proxyIp: "",
|
||||||
contact: null,
|
contact: null,
|
||||||
},
|
},
|
||||||
|
|||||||
+163
-49
@@ -4,13 +4,21 @@ const consoleCmd = require('./console');
|
|||||||
|
|
||||||
let localDb = {};
|
let localDb = {};
|
||||||
let lastFetchTime = 0;
|
let lastFetchTime = 0;
|
||||||
|
let piFreqIndex = {}; // Indexing for speedier PI+Freq combinations
|
||||||
const fetchInterval = 1000;
|
const fetchInterval = 1000;
|
||||||
const esSwitchCache = {"lastCheck":0, "esSwitch":false};
|
const esSwitchCache = {"lastCheck": null, "esSwitch": false};
|
||||||
const esFetchInterval = 300000;
|
const esFetchInterval = 300000;
|
||||||
var currentPiCode = '';
|
var currentPiCode = '';
|
||||||
var currentRdsPs = '';
|
var currentRdsPs = '';
|
||||||
const usStatesGeoJsonUrl = "https://raw.githubusercontent.com/PublicaMundi/MappingAPI/master/data/geojson/us-states.json";
|
const usStatesGeoJsonUrl = "https://raw.githubusercontent.com/PublicaMundi/MappingAPI/master/data/geojson/us-states.json";
|
||||||
let usStatesGeoJson = null; // To cache the GeoJSON data for US states
|
let usStatesGeoJson = null; // To cache the GeoJSON data for US states
|
||||||
|
let Latitude = serverConfig.identification.lat;
|
||||||
|
let Longitude = serverConfig.identification.lon;
|
||||||
|
|
||||||
|
// Create WebSocket URL for GPS lat/lon update.
|
||||||
|
const webserverPort = serverConfig.webserver.webserverPort || 8080; // Fallback to port 8080
|
||||||
|
const externalWsUrl = `ws://127.0.0.1:${webserverPort}/data_plugins`;
|
||||||
|
const WebSocket = require('ws');
|
||||||
|
|
||||||
// Get weighting values based on algorithm setting.
|
// Get weighting values based on algorithm setting.
|
||||||
// Defaults = algorithm 1
|
// Defaults = algorithm 1
|
||||||
@@ -28,18 +36,89 @@ if (typeof algorithms[algoSetting] !== 'undefined') {
|
|||||||
weightedDist = algorithms[algoSetting][1];
|
weightedDist = algorithms[algoSetting][1];
|
||||||
}
|
}
|
||||||
|
|
||||||
// IIFE to build the local TX DB cache from the endpoint.
|
// Build the TX database.
|
||||||
(async () => {
|
setTimeout(buildTxDatabase, 3000);
|
||||||
try {
|
|
||||||
setTimeout(() => consoleCmd.logInfo('Fetching transmitter database...'), 0);
|
if (serverConfig.identification.gpsMode) {
|
||||||
const response = await fetch(`https://maps.fmdx.org/api?qth=${serverConfig.identification.lat},${serverConfig.identification.lon}`);
|
// 5-second delay before activation of GPS lat/lon websocket
|
||||||
if (!response.ok) throw new Error(`HTTP error! Status: ${response.status}`);
|
setTimeout(() => {
|
||||||
localDb = await response.json();
|
const websocket = new WebSocket(externalWsUrl);
|
||||||
consoleCmd.logInfo('Transmitter database successfully loaded.');
|
consoleCmd.logInfo('Set up GPS websocket for lat/lon');
|
||||||
} catch (error) {
|
// Event listener to receive data
|
||||||
consoleCmd.logError("Failed to fetch transmitter database:", error);
|
websocket.on('message', (data) => {
|
||||||
|
try {
|
||||||
|
// Parse the received data
|
||||||
|
const parsedData = JSON.parse(data);
|
||||||
|
|
||||||
|
// Check if the dataset is of type GPS
|
||||||
|
if (parsedData.type === "GPS" && parsedData.value) {
|
||||||
|
const gpsData = parsedData.value;
|
||||||
|
const { status, time, lat, lon, alt, mode } = gpsData;
|
||||||
|
|
||||||
|
if (status === "active") {
|
||||||
|
Latitude = parseFloat(lat);
|
||||||
|
Longitude = parseFloat(lon);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
consoleCmd.logError("Error processing WebSocket data:", error);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
}, 5000);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Function to build local TX database from FMDX Maps endpoint.
|
||||||
|
async function buildTxDatabase() {
|
||||||
|
if (Latitude.length > 0 && Longitude.length > 0) {
|
||||||
|
let awaitingTxInfo = true;
|
||||||
|
while (awaitingTxInfo) {
|
||||||
|
try {
|
||||||
|
consoleCmd.logInfo('Fetching transmitter database...');
|
||||||
|
const response = await fetch(`https://maps.fmdx.org/api?qth=${serverConfig.identification.lat},${serverConfig.identification.lon}`, {
|
||||||
|
method: 'GET',
|
||||||
|
headers: {
|
||||||
|
'Accept': 'application/json'
|
||||||
|
}
|
||||||
|
});
|
||||||
|
if (!response.ok) throw new Error(`HTTP error! Status: ${response.status}`);
|
||||||
|
localDb = await response.json();
|
||||||
|
buildPiFreqIndex();
|
||||||
|
consoleCmd.logInfo('Transmitter database successfully loaded.');
|
||||||
|
awaitingTxInfo = false;
|
||||||
|
} catch (error) {
|
||||||
|
consoleCmd.logError("Failed to fetch transmitter database:", error);
|
||||||
|
await new Promise(res => setTimeout(res, 30000));
|
||||||
|
consoleCmd.logInfo('Retrying transmitter database download...');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
consoleCmd.logInfo('Server latitude and longitude must be set before transmitter database can be built');
|
||||||
}
|
}
|
||||||
})();
|
}
|
||||||
|
|
||||||
|
// Function to build index map of PI+Freq combinations
|
||||||
|
function buildPiFreqIndex() {
|
||||||
|
piFreqIndex = {}; // reset
|
||||||
|
for (const locData of Object.values(localDb.locations || {})) {
|
||||||
|
for (const station of locData.stations || []) {
|
||||||
|
if (!station.freq) continue;
|
||||||
|
const freq = station.freq;
|
||||||
|
const pi = station.pi?.toUpperCase();
|
||||||
|
const pireg = station.pireg?.toUpperCase();
|
||||||
|
if (pi) {
|
||||||
|
const key = `${freq}|${pi}`;
|
||||||
|
if (!piFreqIndex[key]) piFreqIndex[key] = [];
|
||||||
|
piFreqIndex[key].push({ ...locData, station });
|
||||||
|
}
|
||||||
|
if (pireg) {
|
||||||
|
const regKey = `${freq}|${pireg}`;
|
||||||
|
if (!piFreqIndex[regKey]) piFreqIndex[regKey] = [];
|
||||||
|
piFreqIndex[regKey].push({ ...locData, station });
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Load the US states GeoJSON data
|
// Load the US states GeoJSON data
|
||||||
async function loadUsStatesGeoJson() {
|
async function loadUsStatesGeoJson() {
|
||||||
@@ -105,14 +184,22 @@ function getStateForCoordinates(lat, lon) {
|
|||||||
* If at least three valid matches are found for any token, the function returns true.
|
* If at least three valid matches are found for any token, the function returns true.
|
||||||
*/
|
*/
|
||||||
function validPsCompare(rdsPs, stationPs) {
|
function validPsCompare(rdsPs, stationPs) {
|
||||||
|
if (typeof stationPs !== 'string' || typeof rdsPs !== 'string') {
|
||||||
|
consoleCmd.logError(`Invalid TX values. stationPs: ${stationPs}, rdsPs: ${rdsPs}`);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
// Standardize the rdsPs string: replace spaces with underscores and convert to lowercase.
|
// Standardize the rdsPs string: replace spaces with underscores and convert to lowercase.
|
||||||
const standardizedRdsPs = rdsPs.replace(/ /g, '_').toLowerCase();
|
const standardizedRdsPs = rdsPs.replace(/ /g, '_').toLowerCase();
|
||||||
|
|
||||||
// Split stationPs into tokens (e.g., "__mdr___ _kultur_" -> ["__mdr___", "_kultur_"])
|
// Split stationPs into tokens (e.g., "__mdr___ _kultur_" -> ["__mdr___", "_kultur_"])
|
||||||
const psTokens = stationPs.split(/\s+/).filter(token => token.length > 0).map(token => token.toLowerCase());
|
const psTokens = stationPs.split(/\s+/).filter(token => token.length > 0).map(token => { const lower = token.toLowerCase(); return lower.length < 8 ? lower.padEnd(8, '_') : lower; });
|
||||||
|
|
||||||
// Iterate through all tokens and check if any token yields at least three valid (non "_" ) matches.
|
// Iterate through all tokens and check if any token yields at least three valid (non "_" ) matches.
|
||||||
for (let token of psTokens) {
|
for (let token of psTokens) {
|
||||||
|
// If total non "_" length of token is less than 3, allow match based on that length instead
|
||||||
|
const tokenLength = token.replace(/_/g, "").length;
|
||||||
|
const minMatchLen = tokenLength > 2 ? 3 : tokenLength;
|
||||||
// If the token's length does not match the standardized rdsPs length, skip this token.
|
// If the token's length does not match the standardized rdsPs length, skip this token.
|
||||||
if (token.length !== standardizedRdsPs.length) continue;
|
if (token.length !== standardizedRdsPs.length) continue;
|
||||||
|
|
||||||
@@ -124,21 +211,20 @@ function validPsCompare(rdsPs, stationPs) {
|
|||||||
matchCount++;
|
matchCount++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (matchCount >= 3) {
|
if (matchCount >= minMatchLen) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
function evaluateStation(station) {
|
function evaluateStation(station, esMode) {
|
||||||
let esMode = checkEs();
|
|
||||||
let weightDistance = station.distanceKm;
|
let weightDistance = station.distanceKm;
|
||||||
if (esMode && station.distanceKm > 500) {
|
if (esMode && station.distanceKm > 700) {
|
||||||
weightDistance = Math.abs(station.distanceKm - 1500);
|
weightDistance = Math.abs(station.distanceKm - 1500) + 200;
|
||||||
}
|
}
|
||||||
let erp = station.erp && station.erp > 0 ? station.erp : 1;
|
let erp = station.erp && station.erp > 0 ? station.erp : 1;
|
||||||
let extraWeight = erp > 30 && station.distanceKm <= 500 ? 0.3 : 0;
|
let extraWeight = erp > weightedErp && station.distanceKm <= weightDistance ? 0.3 : 0;
|
||||||
let score = 0;
|
let score = 0;
|
||||||
// If ERP is 1W, use a simpler formula to avoid zero-scoring.
|
// If ERP is 1W, use a simpler formula to avoid zero-scoring.
|
||||||
if (erp === 0.001) {
|
if (erp === 0.001) {
|
||||||
@@ -156,45 +242,67 @@ async function fetchTx(freq, piCode, rdsPs) {
|
|||||||
const now = Date.now();
|
const now = Date.now();
|
||||||
freq = parseFloat(freq);
|
freq = parseFloat(freq);
|
||||||
|
|
||||||
if (isNaN(freq)) return;
|
if (
|
||||||
if (now - lastFetchTime < fetchInterval
|
isNaN(freq) ||
|
||||||
|| serverConfig.identification.lat.length < 2
|
now - lastFetchTime < fetchInterval ||
|
||||||
|| freq < 87
|
Latitude.length < 2 ||
|
||||||
|| Object.keys(localDb).length === 0
|
freq < 87 ||
|
||||||
|| (currentPiCode == piCode && currentRdsPs == rdsPs)) {
|
Object.keys(localDb).length === 0 ||
|
||||||
return Promise.resolve();
|
(currentPiCode === piCode && currentRdsPs === rdsPs)
|
||||||
}
|
) return Promise.resolve();
|
||||||
|
|
||||||
lastFetchTime = now;
|
lastFetchTime = now;
|
||||||
|
currentPiCode = piCode;
|
||||||
|
currentRdsPs = rdsPs;
|
||||||
if (serverConfig.webserver.rdsMode === true) await loadUsStatesGeoJson();
|
if (serverConfig.webserver.rdsMode === true) await loadUsStatesGeoJson();
|
||||||
|
|
||||||
const filteredLocations = Object.values(localDb.locations)
|
const key = `${freq}|${piCode.toUpperCase()}`;
|
||||||
.map(locData => ({
|
let rawMatches = piFreqIndex[key] || [];
|
||||||
...locData,
|
|
||||||
stations: locData.stations.filter(station =>
|
// Format the results into the same structure as before
|
||||||
station.freq === freq &&
|
let filteredLocations = rawMatches.map(({ station, ...locData }) => ({
|
||||||
(station.pi === piCode.toUpperCase() || station.pireg === piCode.toUpperCase() ) &&
|
...locData,
|
||||||
validPsCompare(rdsPs, station.ps)
|
stations: [station]
|
||||||
)
|
}));
|
||||||
}))
|
|
||||||
.filter(locData => locData.stations.length > 0); // Ensure locations with at least one matching station remain
|
// Only check PS if we have more than one match.
|
||||||
|
if (filteredLocations.length > 1) {
|
||||||
|
filteredLocations = filteredLocations.map(locData => ({
|
||||||
|
...locData,
|
||||||
|
stations: locData.stations.filter(station => validPsCompare(rdsPs, station.ps))
|
||||||
|
})).filter(locData => locData.stations.length > 0);
|
||||||
|
}
|
||||||
|
|
||||||
for (loc of filteredLocations) {
|
for (let loc of filteredLocations) {
|
||||||
loc = Object.assign(loc, loc.stations[0]);
|
loc = Object.assign(loc, loc.stations[0]);
|
||||||
delete loc.stations;
|
delete loc.stations;
|
||||||
const dist = haversine(serverConfig.identification.lat, serverConfig.identification.lon, loc.lat, loc.lon);
|
const dist = haversine(Latitude, Longitude, loc.lat, loc.lon);
|
||||||
loc = Object.assign(loc, dist);
|
loc = Object.assign(loc, dist);
|
||||||
loc.detectedByPireg = (loc.pireg === piCode.toUpperCase());
|
loc.detectedByPireg = (loc.pireg === piCode.toUpperCase());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (filteredLocations.length > 1) {
|
if (filteredLocations.length > 1) {
|
||||||
for (loc of filteredLocations) {
|
// Check for any 10kW+ stations within 700km, and don't Es weight if any found.
|
||||||
loc.score = evaluateStation(loc);
|
const tropoPriority = filteredLocations.some(
|
||||||
|
loc => loc.distanceKm < 700 && loc.erp >= 10
|
||||||
|
);
|
||||||
|
let esMode = false;
|
||||||
|
if (!tropoPriority) {
|
||||||
|
esMode = checkEs();
|
||||||
}
|
}
|
||||||
match = filteredLocations.reduce((max, obj) => obj.score > max.score ? obj : max, filteredLocations[0]);
|
for (let loc of filteredLocations) {
|
||||||
multiMatches = filteredLocations.filter(obj => obj !== match);
|
loc.score = evaluateStation(loc, esMode);
|
||||||
|
}
|
||||||
|
// Sort by score in descending order
|
||||||
|
filteredLocations.sort((a, b) => b.score - a.score);
|
||||||
|
match = filteredLocations[0];
|
||||||
|
// Have a maximum of 10 extra matches and remove any with less than 1/10 of the winning score
|
||||||
|
multiMatches = filteredLocations
|
||||||
|
.slice(1, 11)
|
||||||
|
.filter(obj => obj.score >= (match.score / 10));
|
||||||
} else if (filteredLocations.length === 1) {
|
} else if (filteredLocations.length === 1) {
|
||||||
match = filteredLocations[0];
|
match = filteredLocations[0];
|
||||||
|
match.score = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (match) {
|
if (match) {
|
||||||
@@ -204,7 +312,7 @@ async function fetchTx(freq, piCode, rdsPs) {
|
|||||||
match.state = state; // Add state to matchingCity
|
match.state = state; // Add state to matchingCity
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return {
|
const result = {
|
||||||
station: match.detectedByPireg
|
station: match.detectedByPireg
|
||||||
? `${match.station.replace("R.", "Radio ")}${match.regname ? ' ' + match.regname : ''}`
|
? `${match.station.replace("R.", "Radio ")}${match.regname ? ' ' + match.regname : ''}`
|
||||||
: match.station.replace("R.", "Radio "),
|
: match.station.replace("R.", "Radio "),
|
||||||
@@ -218,9 +326,15 @@ async function fetchTx(freq, piCode, rdsPs) {
|
|||||||
pi: match.pi,
|
pi: match.pi,
|
||||||
foundStation: true,
|
foundStation: true,
|
||||||
reg: match.detectedByPireg,
|
reg: match.detectedByPireg,
|
||||||
others: multiMatches,
|
score: match.score,
|
||||||
|
others: multiMatches.slice(),
|
||||||
};
|
};
|
||||||
|
filteredLocations.length = 0;
|
||||||
|
multiMatches.length = 0;
|
||||||
|
return result;
|
||||||
} else {
|
} else {
|
||||||
|
filteredLocations.length = 0;
|
||||||
|
multiMatches.length = 0;
|
||||||
return Promise.resolve();
|
return Promise.resolve();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -229,11 +343,11 @@ function checkEs() {
|
|||||||
const now = Date.now();
|
const now = Date.now();
|
||||||
const url = "https://fmdx.org/includes/tools/get_muf.php";
|
const url = "https://fmdx.org/includes/tools/get_muf.php";
|
||||||
|
|
||||||
if (now - esSwitchCache.lastCheck < esFetchInterval) {
|
if (esSwitchCache.lastCheck && now - esSwitchCache.lastCheck < esFetchInterval) {
|
||||||
return esSwitchCache.esSwitch;
|
return esSwitchCache.esSwitch;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (serverConfig.identification.lat > 20) {
|
if (Latitude > 20) {
|
||||||
esSwitchCache.lastCheck = now;
|
esSwitchCache.lastCheck = now;
|
||||||
fetch(url)
|
fetch(url)
|
||||||
.then(response => {
|
.then(response => {
|
||||||
@@ -241,8 +355,8 @@ function checkEs() {
|
|||||||
return response.json();
|
return response.json();
|
||||||
})
|
})
|
||||||
.then(data => {
|
.then(data => {
|
||||||
if ((serverConfig.identification.lon < -32 && data.north_america.max_frequency !== "No data") ||
|
if ((Longitude < -32 && data.north_america.max_frequency !== "No data") ||
|
||||||
(serverConfig.identification.lon >= -32 && data.europe.max_frequency !== "No data")) {
|
(Longitude >= -32 && data.europe.max_frequency !== "No data")) {
|
||||||
esSwitchCache.esSwitch = true;
|
esSwitchCache.esSwitch = true;
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|||||||
+1
-1
@@ -290,7 +290,7 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="panel-33 hover-brighten tooltip no-bg-phone" style="min-height: 91px;" data-tooltip="This panel contains the current TX info when RDS is loaded.<br><strong>Clicking on this panel copies the info into the clipboard.</strong>">
|
<div class="panel-33 hover-brighten tooltip no-bg-phone" style="min-height: 91px;" data-tooltip="This panel contains the current TX info when RDS is loaded.<br><strong>Clicking on this panel copies the info into the clipboard.</strong>">
|
||||||
<div id="data-station-container">
|
<div id="data-station-container" data-score="0">
|
||||||
<h2 style="margin-top: 0;" class="mb-0">
|
<h2 style="margin-top: 0;" class="mb-0">
|
||||||
<span id="data-station-name"></span>
|
<span id="data-station-name"></span>
|
||||||
</h2>
|
</h2>
|
||||||
|
|||||||
+8
-7
@@ -925,13 +925,11 @@ function throttle(fn, wait) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function buildAltTxList(txList) {
|
function buildAltTxList(txList) {
|
||||||
const wrapper = '<div class="panel-100-real m-0" style="background:none;backdrop-filter:none;">';
|
|
||||||
let outString = '';
|
let outString = '';
|
||||||
outString += wrapper;
|
|
||||||
for (let i = 0; i < txList.length; i++) {
|
for (let i = 0; i < txList.length; i++) {
|
||||||
const tx = txList[i];
|
const tx = txList[i];
|
||||||
outString += `<div class="panel-100-real m-0 hover-brighten no-bg-phone m-0 br-0 p-10" style="min-height: 72px;padding-left: 20px;">
|
outString += `<div class="panel-100-real m-0 hover-brighten no-bg-phone m-0 br-0 p-10" style="min-height: 72px;padding-left: 20px;">
|
||||||
<div id="data-station-container-${i}" style="display: block;" class="text-left">
|
<div id="data-station-container-${i}" style="display: block;" class="text-left" data-score="${tx.score}">
|
||||||
<h2 style="margin-top: 0;" class="mb-0">
|
<h2 style="margin-top: 0;" class="mb-0">
|
||||||
<span id="data-station-name-${i}">${tx.station.replace("R.", "Radio ").replace(/%/g, '%25')}</span>
|
<span id="data-station-name-${i}">${tx.station.replace("R.", "Radio ").replace(/%/g, '%25')}</span>
|
||||||
</h2>
|
</h2>
|
||||||
@@ -942,11 +940,7 @@ function buildAltTxList(txList) {
|
|||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
</div>`;
|
</div>`;
|
||||||
if (i % 2 !== 0) {
|
|
||||||
outString += `</div>${wrapper}`;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
outString += '</div>';
|
|
||||||
return outString;
|
return outString;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -962,6 +956,12 @@ function updateHtmlIfChanged($element, newHtml) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function updateDatasetValIfChanged($element, dataLabel, newVal) {
|
||||||
|
if ($element.attr(dataLabel) !== newVal) {
|
||||||
|
$element.attr(dataLabel, newVal);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Main function to update data elements, optimized
|
// Main function to update data elements, optimized
|
||||||
const updateDataElements = throttle(function(parsedData) {
|
const updateDataElements = throttle(function(parsedData) {
|
||||||
updateTextIfChanged($dataFrequency, parsedData.freq);
|
updateTextIfChanged($dataFrequency, parsedData.freq);
|
||||||
@@ -1022,6 +1022,7 @@ const updateDataElements = throttle(function(parsedData) {
|
|||||||
updateTextIfChanged($('#data-station-pol'), parsedData.txInfo.pol);
|
updateTextIfChanged($('#data-station-pol'), parsedData.txInfo.pol);
|
||||||
updateHtmlIfChanged($('#data-station-azimuth'), parsedData.txInfo.azi + '°');
|
updateHtmlIfChanged($('#data-station-azimuth'), parsedData.txInfo.azi + '°');
|
||||||
updateHtmlIfChanged($('#data-station-others'), parsedData.txInfo.otherMatches.length > 0 ? ('<span>+' + parsedData.txInfo.otherMatches.length +'</span>') : '');
|
updateHtmlIfChanged($('#data-station-others'), parsedData.txInfo.otherMatches.length > 0 ? ('<span>+' + parsedData.txInfo.otherMatches.length +'</span>') : '');
|
||||||
|
updateDatasetValIfChanged($('#data-station-container'), "data-score", parsedData.txInfo.score);
|
||||||
const txDistance = localStorage.getItem('imperialUnits') == "true" ? (Number(parsedData.txInfo.dist) * 0.621371192).toFixed(0) + " mi" : parsedData.txInfo.dist + " km";
|
const txDistance = localStorage.getItem('imperialUnits') == "true" ? (Number(parsedData.txInfo.dist) * 0.621371192).toFixed(0) + " mi" : parsedData.txInfo.dist + " km";
|
||||||
const altTxInfo = buildAltTxList(parsedData.txInfo.otherMatches);
|
const altTxInfo = buildAltTxList(parsedData.txInfo.otherMatches);
|
||||||
updateHtmlIfChanged($('#alternative-txes'), altTxInfo);
|
updateHtmlIfChanged($('#alternative-txes'), altTxInfo);
|
||||||
|
|||||||
Reference in New Issue
Block a user