diff options
author | Kyle Gunger <kgunger12@gmail.com> | 2022-07-28 01:32:49 -0400 |
---|---|---|
committer | Kyle Gunger <kgunger12@gmail.com> | 2022-07-28 01:32:49 -0400 |
commit | 81b562233188569b66fc2fb2a7ff952bdae0a4ec (patch) | |
tree | 35aa636b6d4f978a5b8c8054b145026d1cfc4b4a /scripts/gui/input.js | |
parent | e1af055dc8bcb2676969b9d57b098e6781df2b01 (diff) |
Sending user options to the server
Diffstat (limited to 'scripts/gui/input.js')
-rw-r--r-- | scripts/gui/input.js | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/scripts/gui/input.js b/scripts/gui/input.js index da19d95..24450f0 100644 --- a/scripts/gui/input.js +++ b/scripts/gui/input.js @@ -48,6 +48,13 @@ class MakeInput { return el; } + static buttonInput (text) + { + let el = MakeInput.createInput("button", false, false); + el.textContent = text; + return el; + } + static passwordInput (value, placeholder) { let el = MakeInput.createInput("password"); @@ -302,8 +309,10 @@ class Settings extends EventTarget { applyEvents (template) { for(let key in template) { - if(typeof MakeInput[template[key].type+"Input"] != null) - this.settings[key].el.onchange = (function () {this.dispatchEvent(new CustomEvent("change"));}).bind(this); + if (template[key].type == "button") + this.settings[key].el.onclick = (function() {this.dispatchEvent(new CustomEvent("click", {detail: key}))}).bind(this); + else if(typeof MakeInput[template[key].type+"Input"] != null) + this.settings[key].el.onchange = (function () {this.dispatchEvent(new CustomEvent("change", {detail: key}));}).bind(this); } } |