summaryrefslogtreecommitdiff
path: root/public/join.js
diff options
context:
space:
mode:
authorTor Andersson <tor@ccxvii.net>2023-10-10 18:50:20 +0200
committerTor Andersson <tor@ccxvii.net>2023-10-13 20:03:41 +0200
commitf642d234d346138552809a9c11357127e15fb0f3 (patch)
tree7588966a09a5049563e4673914de3a9701c04406 /public/join.js
parent6d5a4328e52a67df35545647e550223a7bf8d9a4 (diff)
downloadserver-f642d234d346138552809a9c11357127e15fb0f3.tar.gz
Handle invites for active games.
Diffstat (limited to 'public/join.js')
-rw-r--r--public/join.js27
1 files changed, 19 insertions, 8 deletions
diff --git a/public/join.js b/public/join.js
index 2774241..704868f 100644
--- a/public/join.js
+++ b/public/join.js
@@ -184,13 +184,25 @@ function update() {
element.innerHTML = user_link(player)
break
case 1:
- element.classList.toggle("is_active", is_active(player, role))
- if (player.user_id === user_id)
- element.innerHTML = play_link(player) + action_link(player, "part", "red", "\u274c")
- else if (game.owner_id === user_id)
- element.innerHTML = user_link(player) + action_link(player, "kick", "red", "\u274c")
- else
- element.innerHTML = user_link(player)
+ if (player.is_invite) {
+ element.classList.add("is_invite")
+ if (player.user_id === user_id)
+ element.innerHTML = player.name + " ?" +
+ action_link(player, "part", "red", "\u274c") +
+ action_link(player, "accept", "green", "\u2714")
+ else if (game.owner_id === user_id)
+ element.innerHTML = user_link(player) + " ?" + action_link(player, "kick", "red", "\u274c")
+ else
+ element.innerHTML = user_link(player) + " ?"
+ } else {
+ element.classList.toggle("is_active", is_active(player, role))
+ if (player.user_id === user_id)
+ element.innerHTML = play_link(player) + action_link(player, "part", "red", "\u274c")
+ else if (game.owner_id === user_id)
+ element.innerHTML = user_link(player) + action_link(player, "kick", "red", "\u274c")
+ else
+ element.innerHTML = user_link(player)
+ }
break
case 0:
if (player.is_invite) {
@@ -204,7 +216,6 @@ function update() {
else
element.innerHTML = user_link(player) + " ?"
} else {
- element.classList.remove("is_invite")
if (player.user_id === user_id)
element.innerHTML = player.name + action_link(player, "part", "red", "\u274c")
else if (game.owner_id === user_id)