diff --git a/public_html/script.js b/public_html/script.js index 6d5efca..4fd4212 100644 --- a/public_html/script.js +++ b/public_html/script.js @@ -38,6 +38,9 @@ function fetchData() { } PlanesOnTable = data.length; + + /* For special squawk tests */ + //Planes['867840'].squawk = '7700'; }); } @@ -149,7 +152,7 @@ function initialize() { window.setInterval(function() { fetchData(); refreshTableInfo(); - refreshSelected() + refreshSelected(); reaper(); extendedPulse(); }, 1000); @@ -177,57 +180,86 @@ function reaper() { } // Refresh the detail window about the plane -// TODO: Find out why when deselecting it sticks function refreshSelected() { - if (( SelectedPlane != "ICAO") && (SelectedPlane != null)) { - var selected = Planes[SelectedPlane]; - if (selected.flight == "") { - selected.flight="N/A (" + selected.icao + ")"; - } - var html = ''; - html += ''; - // Lets hope we never see this... Aircraft Hijacking - if (selected.squawk == 7500) { - html += '' - } - // Radio Failure - if (selected.squawk == 7600) { - html += '' - } - // Emergancy - if (selected.squawk == 7700) { - html += '' - } - html += ''; - - if (selected.squawk != '0000') { - html += ''; - } else { - html += ''; - } - - html += ''; - } else { - html += 'n/a'; - } - - html += ''; - - html += ''; - html += '
' + selected.flight + '
Squawking: Aircraft Hijacking
Squawking: Communication Loss (Radio Failure)
Squawking: Emergancy
Altitude: ' + selected.altitude + 'Squawk: ' + selected.squawk + '
Squawk: n/a
Track: ' - if (selected.vTrack) { - html += selected.track; - html += ' (' + normalizeTrack(selected.track, selected.vTrack)[1] +')ICAO (hex): ' + selected.icao + '
Lat/Long: '; - if (selected.vPosition) { - html += selected.latitude + ', ' + selected.longitude; - } else { - html += 'n/a'; - } - - html += '
'; + var selected = false; + if (typeof SelectedPlane !== 'undefined' && SelectedPlane != "ICAO" && SelectedPlane != null) { + selected = Planes[SelectedPlane]; + } + + var columns = 2; + var html = ''; + + if (selected) { + html += ''; + } else { + html += '
'; + } + + // Flight header line including squawk if needed + if (selected && selected.flight == "") { + html += ''; + + if (selected) { + html += ''; + } else { + html += ''; + } + + if (selected && selected.squawk != '0000') { + html += ''; + } else { + html += ''; + } + + html += ''; + + if (selected) { + html += ''; + } else { + html += ''; // Something is wrong if we are here + } + + html += ''; + + html += ''; + + html += '
N/A (' + selected.icao + ')'; + } else if (selected && selected.flight != "") { + html += '
' + selected.flight + ''; } else { - var html = ''; + html += '
DUMP1090'; } + + if (selected && selected.squawk == 7500) { // Lets hope we never see this... Aircraft Hijacking + html += '  Squawking: Aircraft Hijacking '; + } else if (selected && selected.squawk == 7600) { // Radio Failure + html += '  Squawking: Radio Failure '; + } else if (selected && selected.squawk == 7700) { // General Emergency + html += '  Squawking: General Emergency '; + } else if (selected && selected.flight != '') { + html += ' [FlightStats]'; + } + html += '
Altitude: ' + selected.altitude + '
Altitude: n/aSquawk: ' + selected.squawk + '
Squawk: n/a
Speed: ' + if (selected) { + html += selected.speed + ' kt'; + } else { + html += 'n/a'; + } + html += 'ICAO (hex): ' + selected.icao + '
ICAO (hex): n/a
Track: ' + if (selected && selected.vTrack) { + html += selected.track + ' (' + normalizeTrack(selected.track, selected.vTrack)[1] +')'; + } else { + html += 'n/a'; + } + html += ' 
Lat/Long: '; + if (selected && selected.vPosition) { + html += selected.latitude + ', ' + selected.longitude; + } else { + html += 'n/a'; + } + html += '
'; + document.getElementById('plane_detail').innerHTML = html; } diff --git a/public_html/style.css b/public_html/style.css index ff72490..c628ea0 100644 --- a/public_html/style.css +++ b/public_html/style.css @@ -1,4 +1,7 @@ -html, body { margin: 0; padding: 0; background-color: #ffffff; font-family: Tahoma, Sans-Serif; font-size: 10pt; overflow: auto; } +html, body { + margin: 0; padding: 0; background-color: #ffffff; font-family: Tahoma, Sans-Serif; + font-size: 10pt; overflow: auto; +} div#map_container { float: left; width: 100%; height: 100%; } div#map_canvas { height: 100%; margin-right: 420px; } @@ -6,13 +9,14 @@ div#sidebar_container { float: left; width: 410px; margin-left: -410px; height: #tableinfo { font-size: x-small; font-family: monospace; } -.vPosition { font-weight: bold; background-color: #f5fff5; } +.vPosition { font-weight: bold; background-color: #f5fff5; } .squawk7500 { font-weight: bold; background-color: #ff5555; } .squawk7600 { font-weight: bold; background-color: #00ffff; } .squawk7700 { font-weight: bold; background-color: #ffff00; } -.selected { font-weight: bold; background-color: #dddddd; } +.selected { background-color: #dddddd; } .plane_table_row { cursor: pointer; } -#selectedinfotitle { font-size: larger; } -#selectedinfo { font-size: small; } - +#selectedinfotitle { font-size: larger; } +#selectedinfo { font-size: small; } +#selectedinfo a { text-decoration: none; color: blue;} +#selectedinfo.dim { opacity: 0.3; filter:alpha(opacity=30); /* For IE8 and earlier */ }