From f23bdb21f630938ddfd339c76f5c43729025e22b Mon Sep 17 00:00:00 2001 From: James Wilson Date: Wed, 22 Feb 2017 12:17:18 -0600 Subject: [PATCH] Hide the altitude chart and checkbox if using custom colors since the chart is based on default colors --- public_html/index.html | 2 +- public_html/script.js | 14 ++++++++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/public_html/index.html b/public_html/index.html index dc051f1..1a2acbc 100644 --- a/public_html/index.html +++ b/public_html/index.html @@ -221,7 +221,7 @@
Aircraft Positions
-
+
Altitude Chart
diff --git a/public_html/script.js b/public_html/script.js index dc45eb6..892e33d 100644 --- a/public_html/script.js +++ b/public_html/script.js @@ -15,6 +15,7 @@ var SelectedAllPlanes = false; var HighlightedPlane = null; var FollowSelected = false; var infoBoxOriginalPosition = {}; +var customAltitudeColors = true; var SpecialSquawks = { '7500' : { cssClass: 'squawk7500', markerColor: 'rgb(255, 85, 85)', text: 'Aircraft Hijacking' }, @@ -235,6 +236,13 @@ function initialize() { } } }); + + // check if the altitude color values are default to enable the altitude filter + if (ColorByAlt.air.h.length === 3 && ColorByAlt.air.h[0].alt === 2000 && ColorByAlt.air.h[0].val === 20 && ColorByAlt.air.h[1].alt === 10000 && ColorByAlt.air.h[1].val === 140 && ColorByAlt.air.h[2].alt === 40000 && ColorByAlt.air.h[2].val === 300) { + customAltitudeColors = false; + } + + $("#altitude_filter_reset_button").click(onResetAltitudeFilter); $('#settingsCog').on('click', function() { @@ -1544,6 +1552,12 @@ function toggleAltitudeChart(switchToggle) { if (switchToggle === true) { altitudeChartDisplay = (altitudeChartDisplay === 'show') ? 'hidden' : 'show'; } + // if you're using custom colors always hide the chart + if (customAltitudeColors === true) { + altitudeChartDisplay = 'hidden'; + // also hide the control option + $('#altitude_chart_container').hide(); + } if (altitudeChartDisplay === 'show') { $('#altitude_checkbox').addClass('settingsCheckboxChecked'); $('#altitude_chart').show();