From 9ba644fd849ef7664be009e00206bf5eb1b85762 Mon Sep 17 00:00:00 2001 From: David Vazgenovich Shakaryan Date: Mon, 9 May 2022 15:56:22 -0700 Subject: web: dynamically generate (list-mode) keypad keys This is currently only for match mode selection, but we'll reuse it to implement more menus. --- web/static/dartboat.js | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'web/static/dartboat.js') 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)); -- cgit v1.2.3-70-g09d2