summaryrefslogtreecommitdiff
path: root/web/web_scoreboard.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_scoreboard.c
parent9a0f3d15dfaac41657bb549c7e246d2ac81fdf4c (diff)
downloaddartboat-e297ac65f8f0cde103880c73d0c92ad3cb50f161.tar.gz
dartboat-e297ac65f8f0cde103880c73d0c92ad3cb50f161.tar.xz
web: more use of generic JS functions
Diffstat (limited to 'web/web_scoreboard.c')
-rw-r--r--web/web_scoreboard.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/web/web_scoreboard.c b/web/web_scoreboard.c
index 34ee4c5..b9b4688 100644
--- a/web/web_scoreboard.c
+++ b/web/web_scoreboard.c
@@ -17,6 +17,18 @@ struct player_info {
struct player_info buffered_info[2], flushed_info[2];
+void scoreboard_set_player_active(int pn)
+{
+ char sel[64], *psel = sel;
+
+ if (pn == -1)
+ psel = NULL;
+ else
+ sprintf(sel, "#p%d-info", pn);
+
+ EM_ASM({elemSetUniqClass($0, $1, $2)}, psel, "active", "[id$=-info]");
+}
+
static inline void buffer_str(char *str, char **buffer, char *flushed)
{
if (str == *buffer || (str && *buffer && !strcmp(str, *buffer)))
@@ -149,6 +161,13 @@ void update_player_rem(int pn, int rem)
update_player_sugg(pn, rem);
}
+void show_player_info(int pn)
+{
+ char sel[64];
+ sprintf(sel, "#p%d-info-inner", pn);
+ EM_ASM({elemAddClass($0, $1)}, sel, "visible");
+}
+
void clear_player_info(int pn)
{
scoreboard_set_player_name(pn, NULL);