Add link to FlightAware flight tracking page

This commit is contained in:
Carlos Salaverria 2016-08-19 18:45:39 -05:00
parent 2215a98a08
commit c99375d51c
2 changed files with 21 additions and 2 deletions

View file

@ -185,3 +185,11 @@ function format_data_source(source) {
return ""; return "";
} }
function format_ident(ident) {
if (ident !== null && ident !== "") {
return "<a href=\"https://flightaware.com/live/flight/" + ident.trim() + "\">" + ident + "</a>";
}
return "";
}

View file

@ -91,11 +91,22 @@ function processReceiverUpdate(data) {
} }
plane.tr.addEventListener('click', function(h, evt) { plane.tr.addEventListener('click', function(h, evt) {
if (evt.srcElement instanceof HTMLAnchorElement) {
evt.stopPropagation();
return;
}
if (!$("#map_container").is(":visible")) {
showMap();
}
selectPlaneByHex(h, false); selectPlaneByHex(h, false);
evt.preventDefault(); evt.preventDefault();
}.bind(undefined, hex)); }.bind(undefined, hex));
plane.tr.addEventListener('dblclick', function(h, evt) { plane.tr.addEventListener('dblclick', function(h, evt) {
if (!$("#map_container").is(":visible")) {
showMap();
}
selectPlaneByHex(h, true); selectPlaneByHex(h, true);
evt.preventDefault(); evt.preventDefault();
}.bind(undefined, hex)); }.bind(undefined, hex));
@ -215,7 +226,7 @@ function initialize() {
var mapResizeTimeout; var mapResizeTimeout;
$("#sidebar_container").on("resize", function() { $("#sidebar_container").on("resize", function() {
clearTimeout(mapResizeTimeout); clearTimeout(mapResizeTimeout);
mapResizeTimeout = setTimeout(updateMapSize, 50); mapResizeTimeout = setTimeout(updateMapSize, 10);
}); });
// Get receiver metadata, reconfigure using it, then continue // Get receiver metadata, reconfigure using it, then continue
@ -789,7 +800,7 @@ function refreshTableInfo() {
} }
// ICAO doesn't change // ICAO doesn't change
tableplane.tr.cells[2].textContent = (tableplane.flight !== null ? tableplane.flight : ""); tableplane.tr.cells[2].innerHTML = format_ident(tableplane.flight);
tableplane.tr.cells[3].textContent = (tableplane.registration !== null ? tableplane.registration : ""); tableplane.tr.cells[3].textContent = (tableplane.registration !== null ? tableplane.registration : "");
tableplane.tr.cells[4].textContent = (tableplane.icaotype !== null ? tableplane.icaotype : ""); tableplane.tr.cells[4].textContent = (tableplane.icaotype !== null ? tableplane.icaotype : "");
tableplane.tr.cells[5].textContent = (tableplane.squawk !== null ? tableplane.squawk : ""); tableplane.tr.cells[5].textContent = (tableplane.squawk !== null ? tableplane.squawk : "");