Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Merge pull request #2 from saschaludwig/master
added squawk code description lookup, fonts are now loaded protocol d…
  • Loading branch information
tedsluis committed May 12, 2017
2 parents 1f4c1c7 + bdba692 commit a32d7a3
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 2 deletions.
8 changes: 6 additions & 2 deletions public_html/gmap.html
Expand Up @@ -3,8 +3,8 @@
<head>
<meta charset="utf-8"/>
<link rel="stylesheet" type="text/css" href="style.css" />
<link rel="stylesheet" type="text/css" href="http://fonts.googleapis.com/css?family=Open+Sans|Raleway" />
<link rel="stylesheet" type="text/css" href="http://code.jquery.com/ui/1.10.3/themes/smoothness/jquery-ui.css" />
<link rel="stylesheet" type="text/css" href="//fonts.googleapis.com/css?family=Open+Sans|Raleway" />
<link rel="stylesheet" type="text/css" href="//code.jquery.com/ui/1.10.3/themes/smoothness/jquery-ui.css" />
<link rel="stylesheet" type="text/css" href="https://code.jquery.com/ui/1.11.0/themes/smoothness/jquery-ui.css">
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
<script src="//ajax.googleapis.com/ajax/libs/jqueryui/1.10.3/jquery-ui.min.js"></script>
Expand Down Expand Up @@ -173,6 +173,10 @@
<td colspan="2">Country of registration: <span id="selected_country">n/a</span></td>
</tr>

<tr class="infoblock_body">
<td colspan="2">Squawk: <span id="selected_squawk_description">n/a</span></td>
</tr>

<tr class="infoblock_body">
<td style="width: 55%">Altitude: <span id="selected_altitude"></span></td>
<td style="width: 45%">Squawk: <span id="selected_squawk"></span></td>
Expand Down
16 changes: 16 additions & 0 deletions public_html/script.js
Expand Up @@ -44,6 +44,8 @@ var MessageRate = 0;

var NBSP='\u00a0';

var squawks = [];

// This converts numbers with commas
function numberWithCommas(x) {
return x.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",");
Expand Down Expand Up @@ -251,6 +253,18 @@ function initialize() {
initialize_map();
start_load_history();
});

// Load squawk code descriptions
$.ajax({ url: 'squawk.json',
timeout: 5000,
cache: false,
dataType: 'json' })

.done(function(data) {
squawks = data;
})


}

var CurrentHistoryFetch = null;
Expand Down Expand Up @@ -844,8 +858,10 @@ function refreshSelected() {

if (selected.squawk === null || selected.squawk === '0000') {
$('#selected_squawk').text('n/a');
$('#selected_squawk_description').text('n/a');
} else {
$('#selected_squawk').text(selected.squawk);
$('#selected_squawk_description').text(squawks[selected.squawk]);
}

$('#selected_speed').text(format_speed_long(selected.speed));
Expand Down
1 change: 1 addition & 0 deletions public_html/squawk.json

Large diffs are not rendered by default.

0 comments on commit a32d7a3

Please sign in to comment.