From 8f1663cb98609e667b171cc8aaedea8911b2cb89 Mon Sep 17 00:00:00 2001 From: Oliver Jowett Date: Tue, 25 Oct 2016 21:09:27 +0100 Subject: [PATCH] Prune the special handling for 000000 which is not needed. --- public_html/script.js | 57 +++++++++++++++++-------------------------- 1 file changed, 23 insertions(+), 34 deletions(-) diff --git a/public_html/script.js b/public_html/script.js index f9680d6..3a70b73 100644 --- a/public_html/script.js +++ b/public_html/script.js @@ -8,7 +8,6 @@ var SiteCircleFeatures = new ol.Collection(); var PlaneIconFeatures = new ol.Collection(); var PlaneTrailFeatures = new ol.Collection(); var Planes = {}; -var PlanesNoHex = {}; var PlanesOrdered = []; var PlaneFilter = {}; var SelectedPlane = null; @@ -72,10 +71,8 @@ function processReceiverUpdate(data) { // Do we already have this plane object in Planes? // If not make it. - if (hex !== "000000" && Planes[hex]) { + if (Planes[hex]) { plane = Planes[hex]; - } else if (hex === "000000" && PlanesNoHex[squawk]) { - plane = PlanesNoHex[squawk]; } else { plane = new PlaneObject(hex); plane.filter = PlaneFilter; @@ -97,34 +94,30 @@ function processReceiverUpdate(data) { $('img', plane.tr.cells[1]).css('display', 'none'); } - if (hex !== "000000") { - plane.tr.addEventListener('click', function(h, evt) { - if (evt.srcElement instanceof HTMLAnchorElement) { - evt.stopPropagation(); - return; - } + plane.tr.addEventListener('click', function(h, evt) { + if (evt.srcElement instanceof HTMLAnchorElement) { + evt.stopPropagation(); + return; + } - if (!$("#map_container").is(":visible")) { - showMap(); - } - selectPlaneByHex(h, false); - adjustSelectedInfoBlockPosition(); - evt.preventDefault(); - }.bind(undefined, hex)); + if (!$("#map_container").is(":visible")) { + showMap(); + } + selectPlaneByHex(h, false); + adjustSelectedInfoBlockPosition(); + evt.preventDefault(); + }.bind(undefined, hex)); - plane.tr.addEventListener('dblclick', function(h, evt) { - if (!$("#map_container").is(":visible")) { - showMap(); - } - selectPlaneByHex(h, true); - adjustSelectedInfoBlockPosition(); - evt.preventDefault(); - }.bind(undefined, hex)); + plane.tr.addEventListener('dblclick', function(h, evt) { + if (!$("#map_container").is(":visible")) { + showMap(); + } + selectPlaneByHex(h, true); + adjustSelectedInfoBlockPosition(); + evt.preventDefault(); + }.bind(undefined, hex)); - Planes[hex] = plane; - } else { - PlanesNoHex[squawk] = plane; - } + Planes[hex] = plane; PlanesOrdered.push(plane); } @@ -697,11 +690,7 @@ function reaper() { // Reap it. plane.tr.parentNode.removeChild(plane.tr); plane.tr = null; - if (plane.icao === "000000") { - delete PlanesNoHex[plane.squawk]; - } else { - delete Planes[plane.icao]; - } + delete Planes[plane.icao]; plane.destroy(); } else { // Keep it.