From e091cdb3187b60a9901bd14d475eebc481c9a299 Mon Sep 17 00:00:00 2001 From: David Vazgenovich Shakaryan Date: Tue, 3 May 2022 15:40:09 -0700 Subject: web: move elem construction to shared dom file --- web/web_scoreboard.c | 18 +++++------------- 1 file changed, 5 insertions(+), 13 deletions(-) (limited to 'web/web_scoreboard.c') diff --git a/web/web_scoreboard.c b/web/web_scoreboard.c index 18835eb..bc1a9d0 100644 --- a/web/web_scoreboard.c +++ b/web/web_scoreboard.c @@ -1,3 +1,4 @@ +#include "web_dom.h" #include "web_match.h" #include "web_scoreboard.h" @@ -176,19 +177,6 @@ void clear_player_info(int pn) scoreboard_set_player_avg(pn, 0); } - -// FIXME move html/svg elem stuff to common file -struct elem { - char *ns, *name, *content; - int n_attrs, size_attrs; - char **attr_names, **attr_vals; -}; -struct elem *elem_init(char *ns, char *name, int size_attrs); -void elem_free(struct elem *e); -void elem_add_attr(struct elem *e, char *name, char *val); -void elem_add_attr_double(struct elem *e, char *name, double val); -void append_elemv(char *sel, int elemc, struct elem **elemv); - struct elem *gen_div(char *str, char *class) { struct elem *e = elem_init(NULL, "div", 1); @@ -262,5 +250,9 @@ void draw_visits() } append_elemv("#visits", elemc, elemv); + for (int i = 0; i < elemc; ++i) + elem_free(elemv[i]); + free(elemv); + EM_ASM({elemScrollToBottom($0)}, "#visits"); } -- cgit v1.2.3-70-g09d2