diff --git a/server/datahandler.js b/server/datahandler.js index 7d54f1a..1f4af93 100644 --- a/server/datahandler.js +++ b/server/datahandler.js @@ -416,7 +416,8 @@ function handleData(wss, receivedData, rdsWss) { azi: currentTx.azimuth, id: currentTx.id, pi: currentTx.pi, - reg: currentTx.reg + reg: currentTx.reg, + otherMatches: currentTx.others }; } }) diff --git a/server/endpoints.js b/server/endpoints.js index af3f429..fabc411 100644 --- a/server/endpoints.js +++ b/server/endpoints.js @@ -416,7 +416,7 @@ router.get('/log_fmlist', (req, res) => { client: { request_ip: clientIp }, - type: (req.query.type && dataHandler.dataToSend.txInfo.dist > 700) ? req.query.type : 'tropo', + type: req.query.type ? req.query.type : 'tropo', log_msg: "Logged PS: " + dataHandler.dataToSend.ps.replace(/\s+/g, '_') + ", PI: " + dataHandler.dataToSend.pi + ", Signal: " + (dataHandler.dataToSend.sig - 11.25).toFixed(0) + " dBµV", }); diff --git a/server/tx_search.js b/server/tx_search.js index 4cca38b..2380cce 100644 --- a/server/tx_search.js +++ b/server/tx_search.js @@ -149,10 +149,10 @@ function evaluateStation(station) { return score; } -// Fetch data from cached database +// Fetch data from maps async function fetchTx(freq, piCode, rdsPs) { let match = null; - // let multiMatches = []; + let multiMatches = []; const now = Date.now(); freq = parseFloat(freq); @@ -192,7 +192,7 @@ async function fetchTx(freq, piCode, rdsPs) { loc.score = evaluateStation(loc); } match = filteredLocations.reduce((max, obj) => obj.score > max.score ? obj : max, filteredLocations[0]); - // multiMatches = filteredLocations.filter(obj => obj !== match); + multiMatches = filteredLocations.filter(obj => obj !== match); } else if (filteredLocations.length === 1) { match = filteredLocations[0]; } @@ -218,7 +218,7 @@ async function fetchTx(freq, piCode, rdsPs) { pi: match.pi, foundStation: true, reg: match.detectedByPireg, - // others: multiMatches, + others: multiMatches, }; } else { return Promise.resolve(); diff --git a/web/index.ejs b/web/index.ejs index df37edf..5cce173 100644 --- a/web/index.ejs +++ b/web/index.ejs @@ -287,7 +287,7 @@ [] - kW [] + kW [] @@ -406,6 +406,17 @@ + +
diff --git a/web/js/main.js b/web/js/main.js index 5a121ac..bb13b6e 100644 --- a/web/js/main.js +++ b/web/js/main.js @@ -905,6 +905,33 @@ function throttle(fn, wait) { return wrapper; } +function buildAltTxList(txList) { + const wrapper = '
'; + let outString = ''; + outString += wrapper; + for (let i = 0; i < txList.length; i++) { + const tx = txList[i]; + outString += `
+
+

+ ${tx.station.replace("R.", "Radio ").replace(/%/g, '%25')} +

+

+ ${tx.name} [G] +

+ + ${tx.erp} kW [${tx.pol.toUpperCase()}] ${tx.distanceKm.toFixed(0)} km ${tx.azimuth.toFixed(0)}° + +
+
`; + if (i % 2 !== 0) { + outString += `
${wrapper}`; + } + } + outString += '
'; + 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 ? ('+' + parsedData.txInfo.otherMatches.length +'') : ''); 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 { diff --git a/web/js/modal.js b/web/js/modal.js index 6fee1e3..09415d1 100644 --- a/web/js/modal.js +++ b/web/js/modal.js @@ -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() {