summaryrefslogtreecommitdiff
path: root/scripts/gui/input.js
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/gui/input.js')
-rw-r--r--scripts/gui/input.js13
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);
}
}