summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTor Andersson <tor@ccxvii.net>2023-09-15 20:48:05 +0200
committerTor Andersson <tor@ccxvii.net>2023-09-18 21:16:47 +0200
commit9e77cf5b29a533faf1909327772359d189e527b1 (patch)
treefaccd4ffcb85766d75152da8ccb8b5dd42f16c56
parentf5ea88328ef1b4dabd5f58b4c78ad4e175c96765 (diff)
downloadserver-9e77cf5b29a533faf1909327772359d189e527b1.tar.gz
Links to user pages from in-game role display.
-rw-r--r--public/common/play.css9
-rw-r--r--public/common/play.js5
2 files changed, 13 insertions, 1 deletions
diff --git a/public/common/play.css b/public/common/play.css
index 8fe084e..fd99175 100644
--- a/public/common/play.css
+++ b/public/common/play.css
@@ -326,6 +326,15 @@ header .viewpoint_button.selected:active:hover {
white-space: nowrap;
}
+.role_user a {
+ text-decoration: none;
+ color: black;
+}
+
+.role_user a:hover {
+ text-decoration: underline;
+}
+
.role_name::before {
content: "\25cb ";
opacity: 0.6;
diff --git a/public/common/play.js b/public/common/play.js
index e34f42c..73566bd 100644
--- a/public/common/play.js
+++ b/public/common/play.js
@@ -381,7 +381,10 @@ function on_game_over() {
function init_player_names(players) {
for (let i = 0; i < roles.length; ++i) {
let p = players.find(p => p.role === roles[i].role)
- document.getElementById(roles[i].id).querySelector(".role_user").textContent = p ? p.name : "NONE"
+ if (p)
+ document.getElementById(roles[i].id).querySelector(".role_user").innerHTML = `<a href="/user/${p.name}" target="_blank">${p.name}</a>`
+ else
+ document.getElementById(roles[i].id).querySelector(".role_user").textContent = "NONE"
}
}