Add toggle to show/hide altitude chart

This commit is contained in:
James Wilson 2017-02-10 14:41:48 -06:00
parent fddb2298ee
commit e0e09ed3a4
2 changed files with 27 additions and 0 deletions

View file

@ -221,6 +221,10 @@
<div class="settingsCheckbox" id="acpositions_checkbox"></div> <div class="settingsCheckbox" id="acpositions_checkbox"></div>
<div class="settingsText">Aircraft Positions</div> <div class="settingsText">Aircraft Positions</div>
</div> </div>
<div class="settingsOptionContainer">
<div class="settingsCheckbox" id="altitude_checkbox"></div>
<div class="settingsText">Altitude Chart</div>
</div>
</div> </div>
<div class="settingsColumn"> <div class="settingsColumn">
<div class="settingsOptionContainer"> <div class="settingsOptionContainer">

View file

@ -268,6 +268,10 @@ function initialize() {
}); });
$('#altitude_checkbox').on('click', function() {
toggleAltitudeChart(true);
});
$('#selectall_checkbox').on('click', function() { $('#selectall_checkbox').on('click', function() {
if ($('#selectall_checkbox').hasClass('settingsCheckboxChecked')) { if ($('#selectall_checkbox').hasClass('settingsCheckboxChecked')) {
deselectAllPlanes(); deselectAllPlanes();
@ -285,6 +289,7 @@ function initialize() {
filterGroundVehicles(false); filterGroundVehicles(false);
filterBlockedMLAT(false); filterBlockedMLAT(false);
toggleAltitudeChart(false);
// Get receiver metadata, reconfigure using it, then continue // Get receiver metadata, reconfigure using it, then continue
// with initialization // with initialization
@ -1531,6 +1536,24 @@ function filterBlockedMLAT(switchFilter) {
PlaneFilter.blockedMLAT = blockedMLATFilter; 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) { function onResetAltitudeFilter(e) {
$("#altitude_filter_min").val(""); $("#altitude_filter_min").val("");
$("#altitude_filter_max").val(""); $("#altitude_filter_max").val("");