diff options
Diffstat (limited to 'web/web_prompt.c')
-rw-r--r-- | web/web_prompt.c | 40 |
1 files changed, 20 insertions, 20 deletions
diff --git a/web/web_prompt.c b/web/web_prompt.c index 06aa089..0278817 100644 --- a/web/web_prompt.c +++ b/web/web_prompt.c @@ -22,7 +22,7 @@ enum prompt_mode pm; void oi() { - dom_elem_add_class("#oi", "visible"); + dom_add_class("#oi", "visible"); oi_timeout = EM_ASM_INT({return scheduleCCall($0, $1)}, "clear_oi", 3000); } @@ -32,7 +32,7 @@ void clear_oi() { if (!oi_timeout) return; - dom_elem_remove_class("#oi", "visible"); + dom_remove_class("#oi", "visible"); EM_ASM({clearTimeout($0)}, oi_timeout); oi_timeout = 0; } @@ -78,11 +78,11 @@ static inline void free_flushed_str(char *flushed, char *buffered) void prompt_flush() { if (buffered_str_changed(prompt_buffered.msgl, prompt_flushed.msgl)) - dom_elem_set_content("#prompt-msg-l", prompt_buffered.msgl); + dom_set_content("#prompt-msg-l", prompt_buffered.msgl); if (buffered_str_changed(prompt_buffered.msgr, prompt_flushed.msgr)) - dom_elem_set_content("#prompt-msg-r", prompt_buffered.msgr); + dom_set_content("#prompt-msg-r", prompt_buffered.msgr); if (buffered_str_changed(prompt_buffered.input, prompt_flushed.input)) - dom_elem_set_content("#prompt-input", prompt_buffered.input); + dom_set_content("#prompt-input", prompt_buffered.input); free_flushed_str(prompt_flushed.msgl, prompt_buffered.msgl); free_flushed_str(prompt_flushed.msgr, prompt_buffered.msgr); @@ -96,11 +96,11 @@ void set_prompt_mode(enum prompt_mode mode) pm = mode; if (pm != PM_DARTBOARD) - dom_elem_add_class("#prompt", "active"); + dom_add_class("#prompt", "active"); else - dom_elem_remove_class("#prompt", "active"); + dom_remove_class("#prompt", "active"); - dom_elem_set_uniq_class( + dom_set_uniq_class( pm == PM_DARTBOARD ? "#keypad-dartboard" : pm == PM_SELECT_MODE ? "#keypad-select_mode" : "#keypad-default", @@ -112,8 +112,8 @@ void prompt_visit() set_prompt_mode(PM_VISIT); prompt_set_msgl("Enter points:"); prompt_set_msgr(NULL); - dom_elem_set_content("#key-submit", "OK"); - dom_elem_set_content("#key-rem", "REMAINING"); + dom_set_content("#key-submit", "OK"); + dom_set_content("#key-rem", "REMAINING"); } void prompt_bot_visit() @@ -128,8 +128,8 @@ void prompt_num_darts() set_prompt_mode(PM_NUM_DARTS); prompt_set_msgl("Darts needed?"); prompt_set_msgr(NULL); - dom_elem_set_content("#key-submit", "OK"); - dom_elem_set_content("#key-rem", "REMAINING"); + dom_set_content("#key-submit", "OK"); + dom_set_content("#key-rem", "REMAINING"); } void prompt_end_match() @@ -140,16 +140,16 @@ void prompt_end_match() state->mode == M_PVC && state->legs[1]->rem <= 0 ? "Bot wins. :(" : "You win! :)"); prompt_set_msgr(NULL); - dom_elem_set_content("#key-submit", "END MATCH"); - dom_elem_set_content("#key-rem", "REMATCH"); + dom_set_content("#key-submit", "END MATCH"); + dom_set_content("#key-rem", "REMATCH"); } void prompt_select_mode() { - dom_elem_set_uniq_class(NULL, "visible", "[id$=-info-inner]"); + dom_set_uniq_class(NULL, "visible", "[id$=-info-inner]"); for (int pn = 1; pn < 3; ++pn) clear_player_info(pn); - dom_elem_set_content("#visits", NULL); + dom_set_content("#visits", NULL); set_prompt_mode(PM_SELECT_MODE); prompt_set_msgl("Select match mode:"); @@ -160,26 +160,26 @@ bool key_is_active(char *k) { char sel[64]; sprintf(sel, "#key-%s", k); - return dom_elem_has_class(sel, "active"); + return dom_has_class(sel, "active"); } void toggle_key(char *k) { char sel[64]; sprintf(sel, "#key-%s", k); - dom_elem_toggle_class(sel, "active"); + dom_toggle_class(sel, "active"); } void deactivate_key(char *k) { char sel[64]; sprintf(sel, "#key-%s", k); - dom_elem_remove_class(sel, "active"); + dom_remove_class(sel, "active"); } char *prompt_get() { - return dom_elem_get_content("#prompt-input"); + return dom_get_content("#prompt-input"); } void prompt_handle_pre(char *command) |