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 // Path to country flags subfolder
flag_dir = "flags-tiny"; flag_dir = "flags-tiny";

View file

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

View file

@ -46,7 +46,8 @@ function processReceiverUpdate(data) {
// Detect stats reset // Detect stats reset
if (MessageCountHistory.length > 0 && MessageCountHistory[MessageCountHistory.length-1].messages > data.messages) { 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 // Note the message count in the history
@ -70,25 +71,24 @@ function processReceiverUpdate(data) {
plane.tr = PlaneRowTemplate.cloneNode(true); plane.tr = PlaneRowTemplate.cloneNode(true);
// Lookup ICAO country flag // Lookup ICAO country flag
var hexa = +("0x" + hex); var hexa = +("0x" + hex);
for (var i = 0; i < ICAO_Codes.length; i++) { for (var i = 0; i < ICAO_Codes.length; i++) {
if ( hexa >= ICAO_Codes[i].start && hexa <= ICAO_Codes[i].end) { if ( hexa >= ICAO_Codes[i].start && hexa <= ICAO_Codes[i].end) {
plane.Country = 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 + '\">'; 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] === '~') { if (hex[0] === '~') {
// Non-ICAO address // Non-ICAO address
plane.tr.cells[0].textContent = hex.substring(1); plane.tr.cells[0].textContent = hex.substring(1);
$(plane.tr).css('font-style', 'italic'); $(plane.tr).css('font-style', 'italic');
plane.tr.cells[1].textContent = (""); plane.tr.cells[1].textContent = null;
} else { } else {
plane.tr.cells[0].textContent = (hex); plane.tr.cells[0].textContent = hex;
plane.tr.cells[1].innerHTML = (plane.Flag); plane.tr.cells[1].innerHTML = plane.Flag;
} }
plane.tr.addEventListener('click', selectPlaneByHex.bind(undefined,hex,false)); plane.tr.addEventListener('click', selectPlaneByHex.bind(undefined,hex,false));
@ -324,7 +324,7 @@ function initialize_map() {
sortByDistance(); sortByDistance();
} else { } else {
SitePosition = null; 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 document.getElementById("distance").style.display = 'none'; // hide distance header
sortByAltitude(); sortByAltitude();
} }
@ -466,7 +466,7 @@ function initialize_map() {
zIndex: -99999 zIndex: -99999
}); });
if (SiteCircles) { if (SiteCircles) {
for (var i=0;i<SiteCirclesDistances.length;i++) { for (var i=0;i<SiteCirclesDistances.length;i++) {
drawCircle(marker, SiteCirclesDistances[i]); // in meters drawCircle(marker, SiteCirclesDistances[i]); // in meters
} }
@ -608,11 +608,16 @@ function refreshSelected() {
$('#selected_seen').text(selected.seen.toFixed(1) + 's'); $('#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); $('#selected_country').text(selected.Country);
if (selected.Flag !== null) { if (selected.Flag !== null) {
$('#selected_flag').html(selected.Flag); //$('#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) { if (selected.position === null) {
$('#selected_position').text('n/a'); $('#selected_position').text('n/a');
@ -678,7 +683,6 @@ function refreshTableInfo() {
tableplane.tr.cells[7].textContent = format_track_brief(tableplane.track); tableplane.tr.cells[7].textContent = format_track_brief(tableplane.track);
tableplane.tr.cells[8].textContent = tableplane.messages; tableplane.tr.cells[8].textContent = tableplane.messages;
tableplane.tr.cells[9].textContent = tableplane.seen.toFixed(0); tableplane.tr.cells[9].textContent = tableplane.seen.toFixed(0);
tableplane.tr.className = classes; tableplane.tr.className = classes;
} }