From 3120570e1a615706e69ec29c97adac6afbe8932a Mon Sep 17 00:00:00 2001 From: Alejandro Araya Date: Fri, 10 Oct 2014 13:24:07 -0500 Subject: [PATCH] FB24621 move html out of JS into html page. use on click instead of attaching event listeners that never get destroyed. --- public_html/gmap.html | 17 ++++++++++++++++- public_html/script.js | 40 ++++++++++------------------------------ 2 files changed, 26 insertions(+), 31 deletions(-) diff --git a/public_html/gmap.html b/public_html/gmap.html index 61562a9..ffc707a 100644 --- a/public_html/gmap.html +++ b/public_html/gmap.html @@ -49,7 +49,22 @@
-
+
+ + + + + + + + + + + + + +
ICAOFlightSquawkAltitudeSpeedTrackMsgsSeen
+
diff --git a/public_html/script.js b/public_html/script.js index 265e30f..c9dba03 100644 --- a/public_html/script.js +++ b/public_html/script.js @@ -403,22 +403,7 @@ function normalizeTrack(track, valid){ // Refeshes the larger table of all the planes function refreshTableInfo() { - var html = ''; - html += ''; - html += ''; - html += ''; - html += ''; - html += ''; - html += ''; - html += ''; - html += ''; - html += ''; + var html = ''; for (var tablep in Planes) { var tableplane = Planes[tablep] if (!tableplane.reapable) { @@ -441,9 +426,9 @@ function refreshTableInfo() { } if (tableplane.vPosition == true) { - html += ''; + html += ''; } else { - html += ''; + html += ''; } html += ''; @@ -475,9 +460,8 @@ function refreshTableInfo() { html += ''; } } - html += '
ICAOFlightSquawkAltitudeSpeedTrackMsgsSeen
' + tableplane.icao + '
'; - document.getElementById('planes_table').innerHTML = html; + document.getElementById('dataTable').innerHTML = html; if (SpecialSquawk) { $('#SpecialSquawkWarning').css('display', 'inline'); @@ -485,16 +469,6 @@ function refreshTableInfo() { $('#SpecialSquawkWarning').css('display', 'none'); } - // Click event for table - $('#planes_table').find('tr').click( function(){ - var hex = $(this).find('td:first').text(); - if (hex != "ICAO") { - selectPlaneByHex(hex); - refreshTableInfo(); - refreshSelected(); - } - }); - sortTable("tableinfo"); } @@ -639,3 +613,9 @@ function drawCircle(marker, distance) { }); circle.bindTo('center', marker, 'position'); } + +function planeTRclick(hex) { + selectPlaneByHex(hex); + refreshTableInfo(); + refreshSelected(); +} \ No newline at end of file