summaryrefslogtreecommitdiff
path: root/web/web_prompt.c
diff options
context:
space:
mode:
authorDavid Vazgenovich Shakaryan <dvshakaryan@gmail.com>2022-05-03 13:21:24 -0700
committerDavid Vazgenovich Shakaryan <dvshakaryan@gmail.com>2022-05-03 13:22:43 -0700
commite297ac65f8f0cde103880c73d0c92ad3cb50f161 (patch)
treed08677e97ae1a863f1c8eed49dc36560d544d7ca /web/web_prompt.c
parent9a0f3d15dfaac41657bb549c7e246d2ac81fdf4c (diff)
downloaddartboat-e297ac65f8f0cde103880c73d0c92ad3cb50f161.tar.gz
dartboat-e297ac65f8f0cde103880c73d0c92ad3cb50f161.tar.xz
web: more use of generic JS functions
Diffstat (limited to 'web/web_prompt.c')
-rw-r--r--web/web_prompt.c16
1 files changed, 9 insertions, 7 deletions
diff --git a/web/web_prompt.c b/web/web_prompt.c
index 7607009..e96e567 100644
--- a/web/web_prompt.c
+++ b/web/web_prompt.c
@@ -83,8 +83,10 @@ void set_prompt_mode(enum prompt_mode mode)
else
EM_ASM({elemRemoveClass($0, $1)}, "#prompt", "active");
- EM_ASM({setKeypad($0)}, pm == PM_DARTBOARD ? "dartboard" :
- pm == PM_SELECT_MODE ? "select_mode" : "default");
+ EM_ASM({elemSetUniqClass($0, $1, $2)},
+ (pm == PM_DARTBOARD ? "#keypad-dartboard" :
+ pm == PM_SELECT_MODE ? "#keypad-select_mode" : "#keypad-default"),
+ "visible", ".keypad");
}
void prompt_visit()
@@ -114,22 +116,22 @@ void prompt_num_darts()
void prompt_end_match()
{
- EM_ASM(setPlayerActive()); // sets all inactive
+ scoreboard_set_player_active(-1); // sets all inactive
set_prompt_mode(PM_END_MATCH);
prompt_set_msgl(
state->mode == M_PVC && state->legs[1]->rem <= 0 ? "Bot wins. :(" :
"You win! :)");
prompt_set_msgr(NULL);
- EM_ASM({elemSetContent($0, $1)}, "#key-submit", "OK");
+ EM_ASM({elemSetContent($0, $1)}, "#key-submit", "END MATCH");
EM_ASM({elemSetContent($0, $1)}, "#key-rem", "REMATCH");
}
void prompt_select_mode()
{
- for (int pn = 1; pn < 3; ++pn) {
- EM_ASM({hidePlayerInfo($0)}, pn);
+ EM_ASM({elemSetUniqClass($0, $1, $2)},
+ NULL, "visible", "[id$=-info-inner]");
+ for (int pn = 1; pn < 3; ++pn)
clear_player_info(pn);
- }
EM_ASM({elemSetContent($0, $1)}, "#visits", NULL);
set_prompt_mode(PM_SELECT_MODE);