summaryrefslogtreecommitdiff
path: root/web/web_scoreboard.c
diff options
context:
space:
mode:
authorDavid Vazgenovich Shakaryan <dvshakaryan@gmail.com>2022-05-20 02:04:44 -0700
committerDavid Vazgenovich Shakaryan <dvshakaryan@gmail.com>2022-05-20 02:04:44 -0700
commitea0bafa754757ddb9ca06ae1cd3c40bc4649b83a (patch)
treeed8cd732454cdca7a4501dcd8250cea8130a7b37 /web/web_scoreboard.c
parenta4f1e60ece6dac22c4d913fc70124873803f30ab (diff)
downloaddartboat-ea0bafa754757ddb9ca06ae1cd3c40bc4649b83a.tar.gz
dartboat-ea0bafa754757ddb9ca06ae1cd3c40bc4649b83a.tar.xz
web: use generic player slots in HTML/CSS
Diffstat (limited to 'web/web_scoreboard.c')
-rw-r--r--web/web_scoreboard.c14
1 files changed, 7 insertions, 7 deletions
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);