From ea0bafa754757ddb9ca06ae1cd3c40bc4649b83a Mon Sep 17 00:00:00 2001 From: David Vazgenovich Shakaryan Date: Fri, 20 May 2022 02:04:44 -0700 Subject: web: use generic player slots in HTML/CSS --- web/web_scoreboard.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'web/web_scoreboard.c') diff --git a/web/web_scoreboard.c b/web/web_scoreboard.c index 79bddb2..57090fb 100644 --- a/web/web_scoreboard.c +++ b/web/web_scoreboard.c @@ -28,7 +28,7 @@ static void flush_slot(int slot) // FIXME: should be combined with flushing player info char sel[32]; - int len = sprintf(sel, "#p%d-", slot); + int len = sprintf(sel, "#info-slot-%d .", slot); strcpy(sel + len, "name"); dom_set_content(sel, bufstr_flush(&bufs[pn-1].name)); strcpy(sel + len, "rem"); @@ -64,9 +64,9 @@ static void set_slot_active(int slot) if (slot == -1) sel = NULL; else - sprintf(sel, "#p%d-info", slot); + sprintf(sel, "#info-slot-%d", slot); - dom_set_uniq_class(sel, "active", "[id$=-info]"); + dom_set_uniq_class(sel, "active", ".info-slot"); } EMSCRIPTEN_KEEPALIVE @@ -143,7 +143,7 @@ void scoreboard_flush_player_info(int pn) if (slot == -1) return; char sel[32]; - int len = sprintf(sel, "#p%d-", slot); + int len = sprintf(sel, "#info-slot-%d .", slot); if (bufstr_changed(&bufs[pn-1].name)) { strcpy(sel + len, "name"); @@ -225,11 +225,11 @@ void update_player_rem(int pn, int rem) void scoreboard_show_info(int num_players) { set_slot_player(1, 1); - dom_add_class("#p1-info-inner", "visible"); + dom_add_class("#info-slot-1 .inner", "visible"); if (num_players > 1) { set_slot_player(2, 2); - dom_add_class("#p2-info-inner", "visible"); + dom_add_class("#info-slot-2 .inner", "visible"); } if (num_players > 2) { @@ -248,7 +248,7 @@ static void clear_player_info(int pn) void scoreboard_hide_info() { - dom_set_uniq_class(NULL, "visible", "[id$=-info-inner]"); + dom_set_uniq_class(NULL, "visible", ".info-slot .inner"); for (int pn = 1; pn < 4; ++pn) // FIXME clear_player_info(pn); -- cgit v1.2.3-70-g09d2