diff --git a/html/planeObject.js b/html/planeObject.js
index 6729e82..cd1220b 100644
--- a/html/planeObject.js
+++ b/html/planeObject.js
@@ -810,11 +810,14 @@ PlaneObject.prototype.updateLines = function() {
PlaneObject.prototype.destroy = function() {
this.clearLines();
this.clearMarker();
- this.tr.removeEventListener('click', plane.clickListener);
- this.tr.removeEventListener('dblclick', plane.dblclickListener);
+ if (this.tr) {
+ this.tr.removeEventListener('click', this.clickListener);
+ this.tr.removeEventListener('dblclick', this.dblclickListener);
+ this.tr.parentNode.removeChild(this.tr);
+ this.tr = null;
+ }
this.track_linesegs = null;
this.filter = null;
this.markerIcon = null;
this.markerStyle = null;
- this.tr = null;
};
diff --git a/html/script.js b/html/script.js
index 029820b..9d2a6fe 100644
--- a/html/script.js
+++ b/html/script.js
@@ -525,21 +525,7 @@ function parse_history() {
+ PositionHistoryBuffer.length + " from: "
+ (new Date(now * 1000)).toLocaleTimeString());
- var newPlanes = [];
- var plane;
- while (plane = PlanesOrdered.pop()) {
- plane.seen = now - this.last_message_time;
- if (plane.seen > 600) {
- // Reap it.
- delete Planes[plane.icao];
- plane.destroy();
- } else {
- // Keep it.
- newPlanes.push(plane);
- }
- };
-
- PlanesOrdered = newPlanes;
+ reaper();
}
if (uat) {
@@ -952,12 +938,12 @@ function reaper() {
var newPlanes = [];
var plane;
while (plane = PlanesOrdered.pop()) {
+ plane.seen = LastReceiverTimestamp - plane.last_message_time;
if (plane.seen > 600) {
// Reap it.
- plane.tr.parentNode.removeChild(plane.tr);
- plane.tr = null;
- delete Planes[plane.icao];
+ //console.log("Removed " + plane.icao);
plane.destroy();
+ delete Planes[plane.icao];
} else {
// Keep it.
newPlanes.push(plane);
@@ -965,9 +951,6 @@ function reaper() {
};
PlanesOrdered = newPlanes;
- refreshTableInfo();
- refreshSelected();
- refreshHighlighted();
}
// Page Title update function