Now linking HFDL data display to flight/aircraft lookup sites.
This commit is contained in:
parent
75ca095f22
commit
eeedcaa4df
|
|
@ -1240,6 +1240,10 @@ img.openwebrx-mirror-img
|
|||
height: 180px;
|
||||
}
|
||||
|
||||
#openwebrx-panel-hfdl-message a {
|
||||
color: inherit;
|
||||
}
|
||||
|
||||
#openwebrx-panel-hfdl-message tbody {
|
||||
height: 150px;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -333,6 +333,8 @@ $.fn.pageMessagePanel = function() {
|
|||
HfdlMessagePanel = function(el) {
|
||||
MessagePanel.call(this, el);
|
||||
this.initClearTimer();
|
||||
this.aircraft_url = null;
|
||||
this.flight_url = null;
|
||||
}
|
||||
|
||||
HfdlMessagePanel.prototype = new MessagePanel();
|
||||
|
|
@ -341,6 +343,38 @@ HfdlMessagePanel.prototype.supportsMessage = function(message) {
|
|||
return message['mode'] === 'HFDL';
|
||||
};
|
||||
|
||||
HfdlMessagePanel.prototype.setAircraftUrl = function(url) {
|
||||
this.aircraft_url = url;
|
||||
};
|
||||
|
||||
HfdlMessagePanel.prototype.setFlightUrl = function(url) {
|
||||
this.flight_url = url;
|
||||
};
|
||||
|
||||
HfdlMessagePanel.prototype.linkify = function(id) {
|
||||
var url = null;
|
||||
|
||||
// Do not linkify empty strings
|
||||
if (id.len<=0) return(id);
|
||||
|
||||
// 6 hexadecimal digits are an ICAO aircraft ID
|
||||
if (id.match(new RegExp('^[0-9A-F]{6}$')))
|
||||
url = this.aircraft_url;
|
||||
// Dot with a name is an aircraft ID
|
||||
else if (id.match(new RegExp('^\.[0-9A-Z]{1,3}-[0-9A-Z]{1,5}$')))
|
||||
url = this.aircraft_url;
|
||||
// Everything else is a flight ID
|
||||
else
|
||||
url = this.flight_url;
|
||||
|
||||
// Must have valid lookup URL
|
||||
if ((url == null) || (url == ''))
|
||||
return id;
|
||||
else
|
||||
return '<a target="callsign_info" href="' +
|
||||
url.replaceAll('{}', id) + '">' + id + '</a>';
|
||||
};
|
||||
|
||||
HfdlMessagePanel.prototype.render = function() {
|
||||
$(this.el).append($(
|
||||
'<table>' +
|
||||
|
|
@ -356,8 +390,7 @@ HfdlMessagePanel.prototype.render = function() {
|
|||
};
|
||||
|
||||
HfdlMessagePanel.prototype.pushMessage = function(msg) {
|
||||
// Assume white color if missing
|
||||
var color = msg.hasOwnProperty('color')? msg.color : '#FFF';
|
||||
var color = msg.hasOwnProperty('color')? msg.color : '#00000000';
|
||||
var aircraft = msg.hasOwnProperty('aircraft')? msg.aircraft : '';
|
||||
var flight = msg.hasOwnProperty('flight')? msg.flight : '';
|
||||
|
||||
|
|
@ -378,8 +411,8 @@ HfdlMessagePanel.prototype.pushMessage = function(msg) {
|
|||
$b.append($(
|
||||
'<tr>' +
|
||||
'<td class="timestamp">' + tstamp + '</td>' +
|
||||
'<td class="flight">' + flight + '</td>' +
|
||||
'<td class="aircraft">' + aircraft + '</td>' +
|
||||
'<td class="flight">' + this.linkify(flight) + '</td>' +
|
||||
'<td class="aircraft">' + this.linkify(aircraft) + '</td>' +
|
||||
'<td class="data">' + data + '</td>' +
|
||||
'</tr>'
|
||||
).css('background-color', color).css('color', '#000'));
|
||||
|
|
|
|||
|
|
@ -1097,6 +1097,16 @@ function on_ws_recv(evt) {
|
|||
$('.openwebrx-record-button').css('display', x? '':'none');
|
||||
}
|
||||
|
||||
if ('flight_url' in config) {
|
||||
var panel = $('#openwebrx-panel-hfdl-message').hfdlMessagePanel();
|
||||
panel.setFlightUrl(config['flight_url']);
|
||||
}
|
||||
|
||||
if ('aircraft_url' in config) {
|
||||
var panel = $('#openwebrx-panel-hfdl-message').hfdlMessagePanel();
|
||||
panel.setAircraftUrl(config['aircraft_url']);
|
||||
}
|
||||
|
||||
break;
|
||||
case "secondary_config":
|
||||
var s = json['value'];
|
||||
|
|
|
|||
|
|
@ -142,6 +142,8 @@ class OpenWebRxReceiverClient(OpenWebRxClient, SdrSourceEventClient):
|
|||
"allow_center_freq_changes",
|
||||
"allow_audio_recording",
|
||||
"magic_key",
|
||||
"aircraft_url",
|
||||
"flight_url",
|
||||
]
|
||||
|
||||
def __init__(self, conn):
|
||||
|
|
|
|||
Loading…
Reference in New Issue