diff options
author | David Vazgenovich Shakaryan <dvshakaryan@gmail.com> | 2022-05-09 15:56:22 -0700 |
---|---|---|
committer | David Vazgenovich Shakaryan <dvshakaryan@gmail.com> | 2022-05-09 15:56:22 -0700 |
commit | 9ba644fd849ef7664be009e00206bf5eb1b85762 (patch) | |
tree | 2a154ab0891b4c4d070a547341893f47072f7b4e /web/static/dartboat.js | |
parent | 22750c5853698817278cef512d253175ccc08c56 (diff) | |
download | dartboat-9ba644fd849ef7664be009e00206bf5eb1b85762.tar.gz dartboat-9ba644fd849ef7664be009e00206bf5eb1b85762.tar.xz |
web: dynamically generate (list-mode) keypad keys
This is currently only for match mode selection, but we'll reuse it to
implement more menus.
Diffstat (limited to 'web/static/dartboat.js')
-rw-r--r-- | web/static/dartboat.js | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/web/static/dartboat.js b/web/static/dartboat.js index 22c0728..eb1b8fa 100644 --- a/web/static/dartboat.js +++ b/web/static/dartboat.js @@ -122,9 +122,12 @@ function flipControls(store_opt = true) { document.addEventListener('DOMContentLoaded', () => { let f; - f = e => e.target.dataset.command.split(';').forEach(x => - promptHandle(...x.split(':', 2))); - $$('[data-command]').forEach(x => x.addEventListener('click', f)); + $('#controls').addEventListener('click', e => { + const command = e.target.dataset.command; + if (!command) return; + command.split(';').forEach(x => + promptHandle(...x.split(':', 2))); + }); f = e => _set_opt(toCString(e.target.dataset.opt), toCString(e.target.value)); |