From 47b2b1512484d66cd92ea38b27f94d4dd70cd0b6 Mon Sep 17 00:00:00 2001 From: stale Date: Tue, 31 May 2022 15:49:57 -0300 Subject: changed log style, implemented room player limits --- assets/index.html | 16 +++++++++------- assets/style.css | 2 +- 2 files changed, 10 insertions(+), 8 deletions(-) (limited to 'assets') diff --git a/assets/index.html b/assets/index.html index f85b733..69f1958 100644 --- a/assets/index.html +++ b/assets/index.html @@ -18,18 +18,20 @@ let pcounts = info[1]; Object.keys(rooms).forEach(x => { let roominfo = JSON.parse(rooms[x]); - let pc = Number(pcounts[x]); + let pc = Number(pcounts[x][0]); + let pcap = Number(pcounts[x][1]); let bc = roominfo.board_conf; - let a = document.createElement('a'); let h1 = document.createElement('h1'); - let ptxt = (pc > 0)? ((pc > 1)? `${pc} players`: `${pc} player`) : "no players"; + let full = pc == pcap; + let ptxt = `${pc}/${pcap} players` + ((full)? " (full)" : ""); h1.appendChild(document.createTextNode(`> ${roominfo.name} — ${ptxt}`)); let h4 = document.createElement('h4'); h4.appendChild(document.createTextNode(`${bc.w} by ${bc.h} with ${bc.mine_ratio[0]} in every ${bc.mine_ratio[1]} tiles mined`)); - a.append(h1); - a.append(h4); - a.href = 'room/' + x; - rlist.append(a); + let entry = (full)? document.createElement('span') : document.createElement('a'); + entry.append(h1); + entry.append(h4); + entry.href = 'room/' + x; + rlist.append(entry); rlist.append(document.createElement('br')); }); }); diff --git a/assets/style.css b/assets/style.css index cf9f8a6..66130eb 100644 --- a/assets/style.css +++ b/assets/style.css @@ -36,7 +36,7 @@ body { padding: 0.1em 0.1em; } -#rlist a { +#rlist a, span { text-decoration: none; line-height: 0.4; color: #dfdfff; -- cgit v1.2.3