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 @@
+