You've already forked fm-dx-webserver
mirror of
https://github.com/KubaPro010/fm-dx-webserver.git
synced 2026-02-26 22:13:53 +01:00
Multi TX ID functionality
Return alternative matches from TX search algorithm and show them in frontend panel
This commit is contained in:
@@ -287,7 +287,7 @@
|
||||
<span id="data-station-city" style="font-size: 16px;"></span> <span class="text-small">[<span id="data-station-itu"></span>]</span>
|
||||
</h4>
|
||||
<span class="text-small">
|
||||
<span id="data-station-erp"></span> kW [<span id="data-station-pol"></span>] <span class="text-gray">•</span> <span id="data-station-distance"></span> <span class="text-gray">•</span> <span id="data-station-azimuth"></span>
|
||||
<span id="data-station-erp"></span> kW [<span id="data-station-pol"></span>] <span class="text-gray">•</span> <span id="data-station-distance"></span> <span class="text-gray">•</span> <span id="data-station-azimuth"></span> <span id="data-station-others"></span>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
@@ -406,6 +406,17 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="popup-window" id="popup-panel-transmitters">
|
||||
<div class="flex-container flex-column flex-phone flex-phone-column" style="height: calc(100%);">
|
||||
<div class="popup-header hover-brighten flex-center">
|
||||
<p class="color-4" style="margin: 0; padding-left: 10px;">Possible transmitters</p>
|
||||
<button class="popup-close">✖</button>
|
||||
</div>
|
||||
<div id="alternative-txes" class="popup-content text-left flex-container flex-phone flex-column p-10" style="flex: 1;">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="mobileTray" class="hide-desktop">
|
||||
<button class="playbutton" aria-label="Play / Stop" style="width: 64px; height: 64px; position:absolute;display: block;top: -50%;left: 50%; transform: translateX(-50%);"><i class="fa-solid fa-play fa-lg"></i></button>
|
||||
|
||||
|
||||
@@ -905,6 +905,33 @@ function throttle(fn, wait) {
|
||||
return wrapper;
|
||||
}
|
||||
|
||||
function buildAltTxList(txList) {
|
||||
const wrapper = '<div class="panel-100 flex-container flex-phone" style="background:none;backdrop-filter:none;">';
|
||||
let outString = '';
|
||||
outString += wrapper;
|
||||
for (let i = 0; i < txList.length; i++) {
|
||||
const tx = txList[i];
|
||||
outString += `<div class="panel-50 hover-brighten no-bg-phone" style="min-height: 91px;">
|
||||
<div id="data-station-container-${i}" style="display: block;">
|
||||
<h2 style="margin-top: 0;" class="mb-0">
|
||||
<span id="data-station-name-${i}">${tx.station.replace("R.", "Radio ").replace(/%/g, '%25')}</span>
|
||||
</h2>
|
||||
<h4 class="m-0">
|
||||
<span id="data-station-city-${i}" style="font-size: 16px;">${tx.name}</span> <span class="text-small">[<span id="data-station-itu">G</span>]</span>
|
||||
</h4>
|
||||
<span class="text-small">
|
||||
<span id="data-station-erp">${tx.erp}</span> kW [<span id="data-station-pol">${tx.pol.toUpperCase()}</span>] <span class="text-gray">•</span> <span id="data-station-distance">${tx.distanceKm.toFixed(0)} km</span> <span class="text-gray">•</span> <span id="data-station-azimuth">${tx.azimuth.toFixed(0)}°</span>
|
||||
</span>
|
||||
</div>
|
||||
</div>`;
|
||||
if (i % 2 !== 0) {
|
||||
outString += `</div>${wrapper}`;
|
||||
}
|
||||
}
|
||||
outString += '</div>';
|
||||
return outString;
|
||||
}
|
||||
|
||||
function updateTextIfChanged($element, newText) {
|
||||
if ($element.text() !== newText) {
|
||||
$element.text(newText);
|
||||
@@ -976,7 +1003,10 @@ const updateDataElements = throttle(function(parsedData) {
|
||||
updateTextIfChanged($('#data-station-itu'), parsedData.txInfo.itu);
|
||||
updateTextIfChanged($('#data-station-pol'), parsedData.txInfo.pol);
|
||||
updateHtmlIfChanged($('#data-station-azimuth'), parsedData.txInfo.azi + '°');
|
||||
updateHtmlIfChanged($('#data-station-others'), parsedData.txInfo.otherMatches.length > 0 ? ('<span>+' + parsedData.txInfo.otherMatches.length +'</span>') : '');
|
||||
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);
|
||||
updateHtmlIfChanged($('#alternative-txes'), altTxInfo);
|
||||
updateTextIfChanged($('#data-station-distance'), txDistance);
|
||||
$dataStationContainer.css('display', 'block');
|
||||
} else {
|
||||
|
||||
@@ -45,7 +45,12 @@ $(document).ready(function() {
|
||||
$(".tuner-mobile-settings").on("click", function () {
|
||||
$(".popup-window").fadeOut(200);
|
||||
$("#popup-panel-mobile-settings").fadeIn(200);
|
||||
});
|
||||
});
|
||||
|
||||
$("#data-station-others").on("click", function () {
|
||||
$(".popup-window").fadeOut(200);
|
||||
$("#popup-panel-transmitters").fadeIn(200);
|
||||
});
|
||||
});
|
||||
|
||||
function initPopups() {
|
||||
|
||||
Reference in New Issue
Block a user