fixed table display column problem

This is the final version for this project. (I hope!)
This commit is contained in:
Dynomity 2015-08-30 10:16:40 -06:00
parent 95f90fe799
commit 402e40fc36
3 changed files with 36 additions and 28 deletions

View file

@ -101,3 +101,5 @@ PageName = "DUMP1090";
// Path to country flags subfolder
flag_dir = "flags-tiny";

View file

@ -11,8 +11,8 @@
<script type="text/javascript" src="dbloader.js"></script>
<script type="text/javascript" src="planeObject.js"></script>
<script type="text/javascript" src="formatter.js"></script>
<script type="text/javascript" src="script.js"></script>
<script type="text/javascript" src="flags.js"></script>
<script type="text/javascript" src="script.js"></script>
<script type="text/javascript" src="coolclock/excanvas.js"></script>
<script type="text/javascript" src="coolclock/coolclock.js"></script>
<script type="text/javascript" src="coolclock/moreskins.js"></script>
@ -115,7 +115,7 @@
<a href="http://www.airframes.org/" onclick="document.getElementById('horrible_hack').submit.call(document.getElementById('airframes_post')); return false;">
<span id="selected_icao"></span>
</a>
<span id="selected_flag"></span>
<span id="selected_flag"></span>
<span id="selected_registration"></span>
<span id="selected_icaotype"></span>
<span id="selected_emergency"></span>
@ -143,7 +143,7 @@
</tr>
<tr class="infoblock_body">
<td colspan=1>Position: <span id="selected_position">n/a</span></td>
<td colspan=2>Position: <span id="selected_position">n/a</span></td>
<td>Country: <span id="selected_country">n/a</span></td>
</tr>
@ -155,8 +155,9 @@
<div id="planes_table">
<table id="tableinfo" width="100%">
<thead style="background-color: #BBBBBB; cursor: pointer;">
<td colspan="2" id="icao" onclick="sortByICAO();">ICAO</td>
<td id="flight" onclick="sortByFlight();">Flight</td>
<td id="icao" onclick="sortByICAO();">ICAO</td>
<td>Country</td>
<td id="flight" onclick="sortByFlight();">Flight</td>
<td id="squawk" onclick="sortBySquawk();" align="right">Squawk</td>
<td id="altitude" onclick="sortByAltitude();" align="right">Altitude</td>
<td id="speed" onclick="sortBySpeed();" align="right">Speed</td>
@ -168,7 +169,8 @@
<tbody>
<tr id="plane_row_template" class="plane_table_row hidden">
<td>ICAO</td>
<td>FLIGHT</td>
<td>COUNTRY</td>
<td>FLIGHT</td>
<td align="right">SQUAWK</td>
<td align="right">ALTITUDE</td>
<td align="right">SPEED</td>

View file

@ -46,7 +46,8 @@ function processReceiverUpdate(data) {
// Detect stats reset
if (MessageCountHistory.length > 0 && MessageCountHistory[MessageCountHistory.length-1].messages > data.messages) {
MessageCountHistory = [{'time' : MessageCountHistory[MessageCountHistory.length-1].time, 'messages' : 0}];
MessageCountHistory = [{'time' : MessageCountHistory[MessageCountHistory.length-1].time,
'messages' : 0}];
}
// Note the message count in the history
@ -68,27 +69,26 @@ function processReceiverUpdate(data) {
} else {
plane = new PlaneObject(hex);
plane.tr = PlaneRowTemplate.cloneNode(true);
// Lookup ICAO country flag
var hexa = +("0x" + hex);
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 + '\">';
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
// 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 = ("");
} else {
plane.tr.cells[0].textContent = (hex);
plane.tr.cells[1].innerHTML = (plane.Flag);
plane.tr.cells[1].textContent = null;
} else {
plane.tr.cells[0].textContent = hex;
plane.tr.cells[1].innerHTML = plane.Flag;
}
plane.tr.addEventListener('click', selectPlaneByHex.bind(undefined,hex,false));
@ -324,7 +324,7 @@ function initialize_map() {
sortByDistance();
} else {
SitePosition = null;
PlaneRowTemplate.cells[5].style.display = 'none'; // hide distance column
PlaneRowTemplate.cells[6].style.display = 'none'; // hide distance column
document.getElementById("distance").style.display = 'none'; // hide distance header
sortByAltitude();
}
@ -465,12 +465,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
}
}
}
}
}
@ -608,11 +608,16 @@ function refreshSelected() {
$('#selected_seen').text(selected.seen.toFixed(1) + 's');
}
// add the country and flag to the selected section
// add the country and flag
$('#selected_country').text(selected.Country);
if (selected.Flag !== null) {
$('#selected_flag').html(selected.Flag);
}
if (selected.Flag !== null) {
//$('#selected_flag').html('<img src="' + flag_dir + '/' + selected.flag.icon_fn + '" height=12 width=20 title="' + selected.flag.Country + '">' + NBSP + selected.flag.Country);
$('#selected_flag').html(selected.Flag);
} else {
$('#selected_flag').text('Unrecognized');
}
if (selected.position === null) {
$('#selected_position').text('n/a');
@ -671,14 +676,13 @@ 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;
}