diff --git a/html/planeObject.js b/html/planeObject.js
index 80fe9e5..27ad709 100644
--- a/html/planeObject.js
+++ b/html/planeObject.js
@@ -39,8 +39,7 @@ function PlaneObject(icao) {
this.typeLong = null;
this.wtc = null;
-
- this.regLoaded = this.registration != null;
+ this.dbinfoLoaded = false;
// request metadata
this.checkForDB();
@@ -2032,11 +2031,8 @@ PlaneObject.prototype.getAircraftData = function() {
let req = dbLoad(this.icao);
req.done(function(data) {
- if (this.regLoaded) {
- return;
- }
//console.log('fromDB');
- this.regLoaded = true;
+ this.dbinfoLoaded = true;
if (data == null) {
//console.log(this.icao + ': Not found in database!');
return;
@@ -2078,10 +2074,12 @@ PlaneObject.prototype.getAircraftData = function() {
}.bind(this));
req.fail(function(jqXHR,textStatus,errorThrown) {
- if (textStatus == 'timeout')
+ if (textStatus == 'timeout') {
this.getAircraftData();
- else
+ } else {
console.log(this.icao + ': Database load error: ' + textStatus + ' at URL: ' + jqXHR.url);
+ this.dbinfoLoaded = true;
+ }
}.bind(this));
};
@@ -2403,36 +2401,35 @@ PlaneObject.prototype.setTypeData = function() {
};
PlaneObject.prototype.checkForDB = function(t) {
- if (!(t && (t.r || t.t)) && !this.regLoaded && (!dbServer || showTrace || (!globeIndex && this.selected) || replay)) {
+ if (t) {
+
+ if (t.desc) this.typeLong = `${t.desc}`;
+ if (t.r) this.registration = `${t.r}`;
+
+ if (t.ownOp) this.ownOp = `${t.ownOp}`;
+ if (t.year) this.year = `${t.year}`;
+
+ if (t.t) {
+ this.icaoType = `${t.t}`;
+ this.setTypeData();
+ }
+ if (t.dbFlags) {
+ this.military = t.dbFlags & 1;
+ this.interesting = t.dbFlags & 2;
+ this.pia = t.dbFlags & 4;
+ this.ladd = t.dbFlags & 8;
+ if (this.pia)
+ this.registration = null;
+ }
+ if (t.r || t.t) {
+ //console.log('fromTrace');
+ this.dbinfoLoaded = true;
+ }
+ }
+ if (!this.dbinfoLoaded && (!dbServer || showTrace || (dbServer && !globeIndex && this.selected) || replay)) {
this.getAircraftData();
return;
}
- if (!t) {
- return;
- }
-
- if (t.desc) this.typeLong = `${t.desc}`;
- if (t.r) this.registration = `${t.r}`;
-
- if (t.ownOp) this.ownOp = `${t.ownOp}`;
- if (t.year) this.year = `${t.year}`;
-
- if (t.t) {
- this.icaoType = `${t.t}`;
- this.setTypeData();
- }
- if (t.dbFlags) {
- this.military = t.dbFlags & 1;
- this.interesting = t.dbFlags & 2;
- this.pia = t.dbFlags & 4;
- this.ladd = t.dbFlags & 8;
- if (this.pia)
- this.registration = null;
- }
- if (t.r || t.t) {
- //console.log('fromTrace');
- this.regLoaded = true;
- }
this.dataChanged();
};
PlaneObject.prototype.updateAlt = function(t) {
diff --git a/html/script.js b/html/script.js
index 15d1d1c..b18d7b9 100644
--- a/html/script.js
+++ b/html/script.js
@@ -2190,7 +2190,7 @@ function refreshPhoto(selected) {
}
let urlTail;
let param;
- if (!selected.regLoaded) {
+ if (!selected.dbinfoLoaded) {
displaySil();
return;
} else if (selected.registration != null && selected.registration.match(/^[0-9]{0,2}\+?[0-9]{0,2}$/)) {
@@ -2282,7 +2282,7 @@ function refreshSelected() {
jQuery('#anon_mlat_info').addClass('hidden');
jQuery('#reg_info').removeClass('hidden');
}
- let checkReg = selected.registration + ' ' + selected.regLoaded;
+ let checkReg = selected.registration + ' ' + selected.dbinfoLoaded;
if (checkReg != selReg) {
selReg = checkReg;
if (selected.registration) {