add support for extra rows in marker popup table

This commit is contained in:
Stanislav Lechev [0xAF] 2023-08-29 00:37:17 +03:00
parent 4ec15b08bf
commit ab14357ade
1 changed files with 13 additions and 2 deletions

View File

@ -189,9 +189,9 @@ Marker.makeListTitle = function(name) {
// Convert given name/value to an information section item.
Marker.makeListItem = function(name, value) {
return '<div style="border-bottom:1px dotted;white-space:nowrap;">'
return '<div style="display:flex;justify-content: space-between;border-bottom:1px dotted;white-space:nowrap;">'
+ '<span>' + name + '&nbsp;&nbsp;&nbsp;&nbsp;</span>'
+ '<span style="float:right;">' + value + '</span>'
+ '<span>' + value + '</span>'
+ '</div>';
};
@ -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<this.schedule.length ; ++j) {
var freq = this.schedule[j].freq;