From e0e09ed3a4fe29b059362560c0dfa1cb39074981 Mon Sep 17 00:00:00 2001 From: James Wilson Date: Fri, 10 Feb 2017 14:41:48 -0600 Subject: [PATCH] Add toggle to show/hide altitude chart --- public_html/index.html | 4 ++++ public_html/script.js | 23 +++++++++++++++++++++++ 2 files changed, 27 insertions(+) diff --git a/public_html/index.html b/public_html/index.html index 962390c..dc051f1 100644 --- a/public_html/index.html +++ b/public_html/index.html @@ -221,6 +221,10 @@
Aircraft Positions
+
+
+
Altitude Chart
+
diff --git a/public_html/script.js b/public_html/script.js index ea3431f..dc45eb6 100644 --- a/public_html/script.js +++ b/public_html/script.js @@ -268,6 +268,10 @@ function initialize() { }); + $('#altitude_checkbox').on('click', function() { + toggleAltitudeChart(true); + }); + $('#selectall_checkbox').on('click', function() { if ($('#selectall_checkbox').hasClass('settingsCheckboxChecked')) { deselectAllPlanes(); @@ -285,6 +289,7 @@ function initialize() { filterGroundVehicles(false); filterBlockedMLAT(false); + toggleAltitudeChart(false); // Get receiver metadata, reconfigure using it, then continue // with initialization @@ -1531,6 +1536,24 @@ function filterBlockedMLAT(switchFilter) { PlaneFilter.blockedMLAT = blockedMLATFilter; } +function toggleAltitudeChart(switchToggle) { + if (typeof localStorage['altitudeChart'] === 'undefined') { + localStorage['altitudeChart'] = 'show'; + } + var altitudeChartDisplay = localStorage['altitudeChart']; + if (switchToggle === true) { + altitudeChartDisplay = (altitudeChartDisplay === 'show') ? 'hidden' : 'show'; + } + if (altitudeChartDisplay === 'show') { + $('#altitude_checkbox').addClass('settingsCheckboxChecked'); + $('#altitude_chart').show(); + } else { + $('#altitude_checkbox').removeClass('settingsCheckboxChecked'); + $('#altitude_chart').hide(); + } + localStorage['altitudeChart'] = altitudeChartDisplay; +} + function onResetAltitudeFilter(e) { $("#altitude_filter_min").val(""); $("#altitude_filter_max").val("");