Removing dash from APRS callsigns and showing distance to them.

This commit is contained in:
Marat Fayzullin 2022-09-26 15:24:59 -04:00
parent 7a61f991ad
commit 0127e32ea1

View File

@ -342,14 +342,14 @@ $(function(){
delete infowindow.locator; delete infowindow.locator;
delete infowindow.callsign; delete infowindow.callsign;
return infowindow; return infowindow;
} };
var linkifyCallsign = function(callsign) { var linkifyCallsign = function(callsign) {
if ((callsign_url == null) || (callsign_url == '')) if ((callsign_url == null) || (callsign_url == ''))
return callsign; return callsign;
else else
return '<a target="callsign_info" href="' + return '<a target="callsign_info" href="' +
callsign_url.replaceAll('{}', callsign) + callsign_url.replaceAll('{}', callsign.replace(new RegExp('-.*$'), '')) +
'">' + callsign + '</a>'; '">' + callsign + '</a>';
}; };
@ -368,7 +368,7 @@ $(function(){
Math.cos(rlat1) * Math.cos(rlat2) * Math.sin(difflon/2) * Math.sin(difflon/2) Math.cos(rlat1) * Math.cos(rlat2) * Math.sin(difflon/2) * Math.sin(difflon/2)
)); ));
return Math.round(d); return Math.round(d);
} };
var infowindow; var infowindow;
var showLocatorInfoWindow = function(locator, pos) { var showLocatorInfoWindow = function(locator, pos) {
@ -406,16 +406,20 @@ $(function(){
var marker = markers[callsign]; var marker = markers[callsign];
var timestring = moment(marker.lastseen).fromNow(); var timestring = moment(marker.lastseen).fromNow();
var commentString = ""; var commentString = "";
var distance = "";
if (marker.comment) { if (marker.comment) {
commentString = '<div>' + marker.comment + '</div>'; commentString = '<div>' + marker.comment + '</div>';
} }
if (receiverMarker) {
distance = " at " + distanceKm(receiverMarker.position, marker.position) + " km";
}
infowindow.setContent( infowindow.setContent(
'<h3>' + linkifyCallsign(callsign) + '</h3>' + '<h3>' + linkifyCallsign(callsign) + distance + '</h3>' +
'<div>' + timestring + ' using ' + marker.mode + ( marker.band ? ' on ' + marker.band : '' ) + '</div>' + '<div>' + timestring + ' using ' + marker.mode + ( marker.band ? ' on ' + marker.band : '' ) + '</div>' +
commentString commentString
); );
infowindow.open(map, marker); infowindow.open(map, marker);
} };
var showReceiverInfoWindow = function(marker) { var showReceiverInfoWindow = function(marker) {
var infowindow = getInfoWindow() var infowindow = getInfoWindow()
@ -424,7 +428,7 @@ $(function(){
'<div>Receiver location</div>' '<div>Receiver location</div>'
); );
infowindow.open(map, marker); infowindow.open(map, marker);
} };
var getScale = function(lastseen) { var getScale = function(lastseen) {
var age = new Date().getTime() - lastseen; var age = new Date().getTime() - lastseen;