diff --git a/html/early.js b/html/early.js
index 31f3cdb..fab905a 100644
--- a/html/early.js
+++ b/html/early.js
@@ -28,60 +28,73 @@ try {
}
// get configuration json files, will be used in initialize function
+var get_receiver_defer = $.ajax({ url: 'data/receiver.json',
+ timeout: 15000,
+ cache: false,
+ dataType: 'json'
+});
var test_chunk_defer = $.ajax({
url:'chunks/chunks.json',
timeout: 10000,
cache: false,
dataType: 'json'
});
-var get_receiver_defer = $.ajax({ url: 'data/receiver.json',
- timeout: 15000,
- cache: false,
- dataType: 'json'
-});
+if (uuid != null) {
+ get_receiver_defer = null;
+ receiverJson = null;
+ Dump1090Version = 'unknown';
+ RefreshInterval = 5000;
+ configureReceiver.resolve();
+ console.time("Downloaded History");
+} else {
+ $.when(get_receiver_defer).done(function(data){
+ get_receiver_defer = null;
+ receiverJson = data;
+ Dump1090Version = data.version;
+ RefreshInterval = data.refresh;
+ nHistoryItems = (data.history < 2) ? 0 : data.history;
+ $.when(test_chunk_defer).done(function(data) {
+ HistoryChunks = true;
+ chunkNames = data.chunks;
+ nHistoryItems = chunkNames.length;
+ enable_uat = (data.enable_uat == "true");
+ enable_pf_data = (data.pf_data == "true");
+ if (enable_uat)
+ console.log("UAT/978 enabled!");
+ console.log("Chunks enabled");
+ get_history();
+ configureReceiver.resolve();
+ }).fail(function() {
+ HistoryChunks = false;
+ get_history();
+ configureReceiver.resolve();
+ });
+ });
+}
-$.when(test_chunk_defer).done(function(data) {
- HistoryChunks = true;
- chunkNames = data.chunks;
- nHistoryItems = chunkNames.length;
- enable_uat = (data.enable_uat == "true");
- enable_pf_data = (data.pf_data == "true");
- if (enable_uat)
- console.log("UAT/978 enabled!");
- console.log("Chunks enabled");
- get_history();
-}).fail(function() {
- HistoryChunks = false;
- get_history();
-});
function get_history() {
- nHistoryItems++;
- var request = $.ajax({ url: 'data/aircraft.json',
- timeout: historyTimeout*800,
- cache: false,
- dataType: 'json' });
- deferHistory.push(request);
- if (enable_uat) {
- nHistoryItems++;
- request = $.ajax({ url: 'chunks/978.json',
- timeout: historyTimeout*800,
- cache: false,
- dataType: 'json' });
- deferHistory.push(request);
- }
+ if (!receiverJson.globeIndexGrid) {
+ nHistoryItems++;
+ var request = $.ajax({ url: 'data/aircraft.json',
+ timeout: historyTimeout*800,
+ cache: false,
+ dataType: 'json' });
+ deferHistory.push(request);
+ if (enable_uat) {
+ nHistoryItems++;
+ request = $.ajax({ url: 'chunks/978.json',
+ timeout: historyTimeout*800,
+ cache: false,
+ dataType: 'json' });
+ deferHistory.push(request);
+ }
+ }
- if (uuid != null) {
- get_receiver_defer = null;
- receiverJson = null;
- Dump1090Version = 'unknown';
- RefreshInterval = 5000;
- configureReceiver.resolve();
- console.time("Downloaded History");
- } else if (HistoryChunks) {
+ if (HistoryChunks) {
if (nHistoryItems > 0) {
console.log("Starting to load history (" + nHistoryItems + " chunks)");
console.time("Downloaded History");
@@ -89,31 +102,14 @@ function get_history() {
get_history_item(i);
}
}
- $.when(get_receiver_defer).done(function(data){
- get_receiver_defer = null;
- receiverJson = data;
- Dump1090Version = data.version;
- RefreshInterval = data.refresh;
- configureReceiver.resolve();
- });
- } else {
- $.when(get_receiver_defer).done(function(data){
- get_receiver_defer = null;
- receiverJson = data;
- Dump1090Version = data.version;
- RefreshInterval = data.refresh;
- nHistoryItems = data.history;
- if (nHistoryItems > 0) {
- console.log("Starting to load history (" + nHistoryItems + " items)");
- console.time("Downloaded History");
- // Queue up the history file downloads
- for (var i = nHistoryItems-1; i >= 0; i--) {
- get_history_item(i);
- }
- }
- configureReceiver.resolve();
- });
- }
+ } else if (nHistoryItems > 0) {
+ console.log("Starting to load history (" + nHistoryItems + " items)");
+ console.time("Downloaded History");
+ // Queue up the history file downloads
+ for (var i = nHistoryItems-1; i >= 0; i--) {
+ get_history_item(i);
+ }
+ }
}
function get_history_item(i) {
diff --git a/html/script.js b/html/script.js
index 809086c..2e9b728 100644
--- a/html/script.js
+++ b/html/script.js
@@ -850,6 +850,7 @@ function initialize_map() {
if (receiverJson && receiverJson.globeIndexGrid != null) {
globeIndexGrid = receiverJson.globeIndexGrid;
globeIndex = 1;
+ toggleTableInView(true);
}
// Load stored map settings if present
CenterLon = Number(localStorage['CenterLon']) || DefaultCenterLon;
@@ -1771,6 +1772,9 @@ function refreshTableInfo() {
} else if (globeIndex && nTablePlanes > 100) {
TrackedAircraft++;
classes = "plane_table_row hidden";
+ if (tableplane.position != null && (noVanish || tableplane.seen_pos < 60)) {
+ ++TrackedAircraftPositions;
+ }
} else {
TrackedAircraft++;
classes = "plane_table_row";
@@ -2530,7 +2534,7 @@ function followRandomPlane() {
}
function toggleTableInView(switchOn) {
- if (switchOn) {
+ if (switchOn || globeIndex) {
tableInView = true;
} else {
tableInView = !tableInView;
@@ -2901,22 +2905,29 @@ function globeIndexes() {
// all longtitudes in view, only check latitude
x1 = -180;
x2 = 180;
- } else if (x1 > x2) {
- var tmp = x1;
- x1 = x2;
- x2 = tmp;
}
+ if (y1 < -90)
+ y1 = -90;
+ if (y2 > 90)
+ y2 = 90;
var indexes = [];
//console.log(x1 + ' ' + x2);
var grid = globeIndexGrid;
- for (var lon = x1; lon < x2 + grid; lon += grid) {
+ var x3 = (x1 < x2) ? x2 : 300;
+ var count = 0;
+
+ for (var lon = x1; lon < x3 + grid; lon += grid) {
+ if (x1 >= x2 && lon > 180) {
+ lon -= 360;
+ x3 = x2;
+ }
for (var lat = y1; lat < y2 + grid; lat += grid) {
- if (lat > y2)
- lat = y2 + 0.01;
- if (lon > x2)
- lon = x2 + 0.01;
var index = globe_index(lat, lon);
+ if (lat > y2)
+ index = globe_index(y2 , lon);
+ if (lon > x2)
+ index = globe_index(lat , x2);
//console.log(lat + ' ' + lon + ' ' + index);
if (!indexes.includes(index)) {
indexes.push(index);
@@ -2967,7 +2978,7 @@ function globe_index(lat, lon) {
}
// North Atlantic
- if (lat >=5 && lon >= -50 && lon <= 15) {
+ if (lat >=5 && lon >= -50 && lon <= -15) {
return 8;
}