From e2fe11469394c9827a0cdea9966188c833d93197 Mon Sep 17 00:00:00 2001 From: David Vazgenovich Shakaryan Date: Sat, 23 Apr 2022 21:11:50 -0700 Subject: web: implement prompt-aware keypad --- web/static/dartboat.js | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'web/static/dartboat.js') diff --git a/web/static/dartboat.js b/web/static/dartboat.js index 7324ad0..016742b 100644 --- a/web/static/dartboat.js +++ b/web/static/dartboat.js @@ -124,6 +124,12 @@ let prompt_handlers = { } }, + match_over: { + submit() { + Module.ccall('match_init'); + }, + }, + init: { append(val) { let e = document.getElementById('prompt-input'); @@ -153,6 +159,14 @@ let prompt_handlers = { function setPromptHandler(ptr) { prompt_handler = prompt_handlers[UTF8ToString(ptr)]; + + if (UTF8ToString(ptr) === "init") { + document.querySelectorAll('.keypad').forEach(e => e.style.display = 'none'); + document.getElementById('keypad-init').style.removeProperty('display'); + } else { + document.querySelectorAll('.keypad').forEach(e => e.style.display = 'none'); + document.getElementById('keypad-default').style.removeProperty('display'); + } } function promptHandle(action, ...args) { -- cgit v1.2.3-70-g09d2