X-Git-Url: https://git.cworth.org/git?p=lmno.games;a=blobdiff_plain;f=scribe%2Fscribe.jsx;h=be0de3799acf1f6bedaeb2171de86e9588832c38;hp=d81932b7b847e6bb813993fd06a20a336a90d0ec;hb=a3d68ced6e2f65187e4fc076a488715a777b8a62;hpb=35db0996e270ea66c7d0a94f1ddb2506005b22a3 diff --git a/scribe/scribe.jsx b/scribe/scribe.jsx index d81932b..be0de37 100644 --- a/scribe/scribe.jsx +++ b/scribe/scribe.jsx @@ -1,8 +1,8 @@ function team_symbol(team) { if (team === "+") - return "🞥"; + return "+"; else - return "🞇"; + return "o"; } function undisplay(element) { @@ -26,7 +26,9 @@ const events = new EventSource("events"); events.onerror = function(event) { if (event.target.readyState === EventSource.CLOSED) { + setTimeout(() => { add_message("danger", "Connection to server lost."); + }, 1000); } }; @@ -77,14 +79,31 @@ events.addEventListener("game-state", event => { * Game and supporting classes * *********************************************************/ +function copy_to_clipboard(id) +{ + const tmp = document.createElement("input"); + tmp.setAttribute("value", document.getElementById(id).innerHTML); + document.body.appendChild(tmp); + tmp.select(); + document.execCommand("copy"); + document.body.removeChild(tmp); +} + function GameInfo(props) { if (! props.id) return null; return (
-

{props.id}

- Invite a friend to play by sending this URL: {props.url} + {props.id} + {" "} + Share this link to invite a friend:{" "} + {props.url} + {" "} +
); } @@ -130,7 +149,7 @@ function PlayerInfo(props) { return (
-

Players

+ Players: {props.player.name} {props.player.team ? ` (${props.player.team})` : ""} {props.first_move ? "" : " "}