From cfb8caddc4b4a79c77a7345df2f61b5f0db7733f Mon Sep 17 00:00:00 2001 From: Vlad Kirienko Date: Fri, 30 Oct 2020 20:42:43 -0400 Subject: [PATCH] Allow columns selection in planes table in runtime --- html/early.js | 21 ++++---- html/index.html | 43 ++++++++++------- html/script.js | 124 ++++++++++++++++++++++++++++++++++-------------- html/style.css | 7 ++- 4 files changed, 135 insertions(+), 60 deletions(-) diff --git a/html/early.js b/html/early.js index 62736ad..9d7f63b 100644 --- a/html/early.js +++ b/html/early.js @@ -338,21 +338,22 @@ function get_history_item(i) { deferHistory.push(request); } -let toggles = {}; +const toggles = {}; function Toggle(arg) { - this.key = arg.key; - toggles[this.key] = this; this.state = (arg.init ? true : false); this.doStuff = arg.toggle; this.checkbox = '#' + this.key + '_cb'; this.display = arg.display; this.container = arg.container; + + toggles[this.key] = this; + this.init(); } -Toggle.prototype.init = function() { +Toggle.prototype.init = function() { $(this.container).append(( '
' + '
' @@ -361,9 +362,9 @@ Toggle.prototype.init = function() { $(this.checkbox).on('click', this.toggle.bind(this)); - if (localStorage[this.key] == "true") + if (localStorage[this.key] == 'true') this.state = true; - if (localStorage[this.key] == "false") + if (localStorage[this.key] == 'false') this.state = false this.toggle(this.state); @@ -378,11 +379,11 @@ Toggle.prototype.toggle = function(override) { this.state = !this.state; if (this.state == false) { - localStorage[this.key] = "false"; + localStorage[this.key] = 'false'; $(this.checkbox).removeClass('settingsCheckboxChecked'); } if (this.state == true) { - localStorage[this.key] = "true"; + localStorage[this.key] = 'true'; $(this.checkbox).addClass('settingsCheckboxChecked'); } @@ -390,6 +391,10 @@ Toggle.prototype.toggle = function(override) { this.doStuff(this.state); } +Toggle.prototype.hide = function () { + $(this.checkbox).parent().hide(); +} + // Set the name of the hidden property and the change event for visibility let hidden, visibilityChange; if (typeof document.hidden !== "undefined") { // Opera 12.10 and Firefox 18 and later support diff --git a/html/index.html b/html/index.html index 37aafc3..ed69f27 100644 --- a/html/index.html +++ b/html/index.html @@ -670,18 +670,22 @@
+
- +
+
+
+
Overlay Toggles
@@ -716,6 +720,20 @@
Group by Data Type
+
+
+
+
+ +
+
+
+
+
+
+
+
+
@@ -796,7 +814,7 @@ - + @@ -814,7 +832,7 @@ - + @@ -829,7 +847,7 @@
- Jump to airport: + Jump to Airport:
@@ -840,7 +858,7 @@ - + @@ -870,7 +888,7 @@
- +
@@ -896,7 +914,6 @@
-
@@ -904,7 +921,7 @@ ICAO - +      Ident      Registration Type @@ -915,7 +932,7 @@ Dist. () Heading Msgs - Age + Seen RSSI Latitude Longitude @@ -956,16 +973,10 @@
- - - - - - - +