Cleanups, reformatting, a few bugfixes, add sort-by-country.
This commit is contained in:
parent
7bebcc558f
commit
b5960fd44a
5 changed files with 255 additions and 227 deletions
|
|
@ -69,27 +69,21 @@ function processReceiverUpdate(data) {
|
|||
} else {
|
||||
plane = new PlaneObject(hex);
|
||||
plane.tr = PlaneRowTemplate.cloneNode(true);
|
||||
|
||||
// Lookup ICAO country flag
|
||||
|
||||
var hexa = +("0x" + hex);
|
||||
|
||||
for (var i = 0; i < ICAO_Codes.length; i++) {
|
||||
if ( hexa >= ICAO_Codes[i].start && hexa <= ICAO_Codes[i].end) {
|
||||
plane.Country = ICAO_Codes[i].Country;
|
||||
plane.Flag = '<img src="' + flag_dir + '/' + ICAO_Codes[i].icon_fn + '" title="' + ICAO_Codes[i].Country + '\">';
|
||||
}
|
||||
}
|
||||
// end of flag lookup
|
||||
|
||||
if (hex[0] === '~') {
|
||||
// Non-ICAO address
|
||||
plane.tr.cells[0].textContent = hex.substring(1);
|
||||
$(plane.tr).css('font-style', 'italic');
|
||||
plane.tr.cells[1].textContent = null;
|
||||
} else {
|
||||
plane.tr.cells[0].textContent = hex;
|
||||
plane.tr.cells[1].innerHTML = plane.Flag;
|
||||
}
|
||||
|
||||
// set flag image if available
|
||||
if (ShowFlags && plane.icaorange.flag_image !== null) {
|
||||
$('img', plane.tr.cells[1]).attr('src', FlagPath + plane.icaorange.flag_image);
|
||||
$('img', plane.tr.cells[1]).attr('title', plane.icaorange.country);
|
||||
} else {
|
||||
$('img', plane.tr.cells[1]).css('display', 'none');
|
||||
}
|
||||
|
||||
plane.tr.addEventListener('click', selectPlaneByHex.bind(undefined,hex,false));
|
||||
|
|
@ -330,6 +324,13 @@ function initialize_map() {
|
|||
sortByAltitude();
|
||||
}
|
||||
|
||||
// Maybe hide flag info
|
||||
if (!ShowFlags) {
|
||||
PlaneRowTemplate.cells[1].style.display = 'none'; // hide flag column
|
||||
document.getElementById("flag").style.display = 'none'; // hide flag header
|
||||
document.getElementById("infoblock_country").style.display = 'none'; // hide country row
|
||||
}
|
||||
|
||||
// Make a list of all the available map IDs
|
||||
var mapTypeIds = [];
|
||||
for(var type in google.maps.MapTypeId) {
|
||||
|
|
@ -466,12 +467,12 @@ function initialize_map() {
|
|||
title: SiteName,
|
||||
zIndex: -99999
|
||||
});
|
||||
|
||||
if (SiteCircles) {
|
||||
|
||||
if (SiteCircles) {
|
||||
for (var i=0;i<SiteCirclesDistances.length;i++) {
|
||||
drawCircle(marker, SiteCirclesDistances[i]); // in meters
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -609,15 +610,14 @@ function refreshSelected() {
|
|||
$('#selected_seen').text(selected.seen.toFixed(1) + 's');
|
||||
}
|
||||
|
||||
|
||||
// add the country and flag
|
||||
$('#selected_country').text(selected.Country);
|
||||
if (selected.Flag !== null) {
|
||||
$('#selected_flag').html(selected.Flag);
|
||||
} else {
|
||||
$('#selected_flag').text('Unrecognized');
|
||||
}
|
||||
|
||||
$('#selected_country').text(selected.icaorange.country);
|
||||
if (ShowFlags && selected.icaorange.flag_image !== null) {
|
||||
$('#selected_flag').removeClass('hidden');
|
||||
$('#selected_flag img').attr('src', FlagPath + selected.icaorange.flag_image);
|
||||
$('#selected_flag img').attr('title', selected.icaorange.country);
|
||||
} else {
|
||||
$('#selected_flag').addClass('hidden');
|
||||
}
|
||||
|
||||
if (selected.position === null) {
|
||||
$('#selected_position').text('n/a');
|
||||
|
|
@ -676,15 +676,14 @@ function refreshTableInfo() {
|
|||
|
||||
// ICAO doesn't change
|
||||
tableplane.tr.cells[2].textContent = (tableplane.flight !== null ? tableplane.flight : "");
|
||||
tableplane.tr.cells[3].textContent = (tableplane.squawk !== null ? tableplane.squawk : "");
|
||||
tableplane.tr.cells[3].textContent = (tableplane.squawk !== null ? tableplane.squawk : "");
|
||||
tableplane.tr.cells[4].textContent = format_altitude_brief(tableplane.altitude, tableplane.vert_rate);
|
||||
tableplane.tr.cells[5].textContent = format_speed_brief(tableplane.speed);
|
||||
tableplane.tr.cells[6].textContent = format_distance_brief(tableplane.sitedist);
|
||||
tableplane.tr.cells[6].textContent = format_distance_brief(tableplane.sitedist);
|
||||
tableplane.tr.cells[7].textContent = format_track_brief(tableplane.track);
|
||||
tableplane.tr.cells[8].textContent = tableplane.messages;
|
||||
tableplane.tr.cells[9].textContent = tableplane.seen.toFixed(0);
|
||||
tableplane.tr.className = classes;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -725,6 +724,7 @@ function sortByDistance() { sortBy('sitedist',compareNumeric, function(x) { retu
|
|||
function sortByTrack() { sortBy('track', compareNumeric, function(x) { return x.track; }); }
|
||||
function sortByMsgs() { sortBy('msgs', compareNumeric, function(x) { return x.messages; }); }
|
||||
function sortBySeen() { sortBy('seen', compareNumeric, function(x) { return x.seen; }); }
|
||||
function sortByCountry() { sortBy('country', compareAlpha, function(x) { return x.icaorange.country; }); }
|
||||
|
||||
var sortId = '';
|
||||
var sortCompare = null;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue