From ab14357adeacf5ae7bd18a671c8bf149754393ac Mon Sep 17 00:00:00 2001 From: "Stanislav Lechev [0xAF]" Date: Tue, 29 Aug 2023 00:37:17 +0300 Subject: [PATCH] add support for extra rows in marker popup table --- htdocs/lib/MapMarkers.js | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/htdocs/lib/MapMarkers.js b/htdocs/lib/MapMarkers.js index 8a3d1d19..d95b622c 100644 --- a/htdocs/lib/MapMarkers.js +++ b/htdocs/lib/MapMarkers.js @@ -189,9 +189,9 @@ Marker.makeListTitle = function(name) { // Convert given name/value to an information section item. Marker.makeListItem = function(name, value) { - return '
' + return '
' + '' + name + '    ' - + '' + value + '' + + '' + value + '' + '
'; }; @@ -252,6 +252,12 @@ FeatureMarker.prototype.update = function(update) { this.status = update.location.status; this.updated = update.location.updated; this.mmode = update.location.mmode; + var detailsObj = {}; + var detailsKeys = Object.keys(update.location).filter(function (k) {return k.startsWith('details_')}); + detailsKeys.forEach(function (d) { + detailsObj[d.substring(8)] = update.location[d]; + }); + this.detailsData = detailsObj; // Implementation-dependent function call this.setMarkerPosition(update.callsign, update.location.lat, update.location.lon); @@ -340,6 +346,11 @@ FeatureMarker.prototype.getInfoHTML = function(name, receiverMarker = null) { } } + var markerExtra = this.detailsData; + Object.keys(this.detailsData).sort().forEach(function (k, i) { + detailsString += Marker.makeListItem(k.charAt(0).toUpperCase() + k.slice(1), markerExtra[k]); + }); + if (this.schedule) { for (var j=0 ; j