From e297ac65f8f0cde103880c73d0c92ad3cb50f161 Mon Sep 17 00:00:00 2001 From: David Vazgenovich Shakaryan Date: Tue, 3 May 2022 13:21:24 -0700 Subject: web: more use of generic JS functions --- web/web_prompt.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) (limited to 'web/web_prompt.c') 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); -- cgit v1.2.3-70-g09d2