diff options
author | Tor Andersson <tor@ccxvii.net> | 2021-06-28 12:38:42 +0200 |
---|---|---|
committer | Tor Andersson <tor@ccxvii.net> | 2021-06-28 22:10:44 +0200 |
commit | 401a13ff9e7792f0e060ccfb15afdbd3bc5fc557 (patch) | |
tree | b96febaeaa3cc78bb5872be58c10bccc7a04d622 /public | |
parent | dd165d03e95f252150a94fc27d0280551d7e041b (diff) | |
download | server-401a13ff9e7792f0e060ccfb15afdbd3bc5fc557.tar.gz |
Clean up SQL and use table views.
Diffstat (limited to 'public')
-rw-r--r-- | public/common/client.js | 2 | ||||
-rw-r--r-- | public/join.js | 15 | ||||
-rw-r--r-- | public/style.css | 2 |
3 files changed, 9 insertions, 10 deletions
diff --git a/public/common/client.js b/public/common/client.js index 28b4f8e..670fa07 100644 --- a/public/common/client.js +++ b/public/common/client.js @@ -220,7 +220,7 @@ function init_client(roles) { document.querySelector(".grid_top").classList.add(player); for (let i = 0; i < roles.length; ++i) { let p = players.find(p => p.role == roles[i]); - document.querySelector(USER_SEL[i]).textContent = p ? p.name : "NONE"; + document.querySelector(USER_SEL[i]).textContent = p ? p.user_name : "NONE"; } }); diff --git a/public/join.js b/public/join.js index d2d39ab..5353f11 100644 --- a/public/join.js +++ b/public/join.js @@ -84,24 +84,23 @@ function update() { let element = document.getElementById(role_id); if (player) { if (game.status > 0) { - if (game.active === role || game.active === "Both" || game.active === "All") - element.className = "your_turn"; + if (game.active_role === role || game.active_role === "Both" || game.active_role === "All") + element.className = "is_your_turn"; else element.className = ""; if (player.user_id === user_id) element.innerHTML = `<a href="/play/${game.game_id}/${role}">Play</a>`; else - element.innerHTML = player.name; + element.innerHTML = player.user_name; } else { if ((player.user_id === user_id) || (game.owner_id === user_id)) - element.innerHTML = `<a class="red" href="javascript:send('/part/${game.game_id}/${role}')">\u274c</a> ${player.name}`; + element.innerHTML = `<a class="red" href="javascript:send('/part/${game.game_id}/${role}')">\u274c</a> ${player.user_name}`; else - element.innerHTML = player.name; + element.innerHTML = player.user_name; } } else { if (game.status === 0) - //element.innerHTML = `<a class="join" href="javascript:send('/join/${game.game_id}/${role}')">Join</a>`; - element.innerHTML = `<a class="join" onclick="send('/join/${game.game_id}/${role}')" href="javascript:void 0">Join</a>`; + element.innerHTML = `<a class="join" href="javascript:send('/join/${game.game_id}/${role}')">Join</a>`; else element.innerHTML = "<i>Empty</i>"; } @@ -122,7 +121,7 @@ function update() { if (game.owner_id === user_id) { window.start_button.disabled = !ready; window.start_button.classList = (game.status === 0) ? "" : "hide"; - window.delete_button.classList = (game.status === 0 || solo) ? "" : "hide"; + window.delete_button.classList = (game.status === 0 || game.is_solo) ? "" : "hide"; } if (game.status === 0 && ready) diff --git a/public/style.css b/public/style.css index 0503574..d5c4230 100644 --- a/public/style.css +++ b/public/style.css @@ -39,7 +39,7 @@ input[type="text"], input[type="password"] { padding: 5px; } select { padding-right: 20px; } form { display: inline; } .nowrap { white-space: nowrap; } -.your_turn { background-color: lemonchiffon; } +.is_your_turn { background-color: lemonchiffon; } button, select { margin: 5px 10px 5px 0; padding: 1px 10px; |