From: Carl Worth Date: Sat, 6 Jun 2020 19:30:23 +0000 (-0700) Subject: Add a button to copy the game URL for sharing and tighten up text X-Git-Url: https://git.cworth.org/git?p=lmno.games;a=commitdiff_plain;h=656345d535b978e92cd9da0801a28f4571aaa6f2 Add a button to copy the game URL for sharing and tighten up text The way we are styling

right now makes it far too wasteful of vertical screen real estate. Instead, use the same font size/weight but inline with the sentence. Also, this button for copying the game URL should be handy, particularly on phones, etc. --- diff --git a/scribe/scribe.jsx b/scribe/scribe.jsx index 06a8541..be0de37 100644 --- a/scribe/scribe.jsx +++ b/scribe/scribe.jsx @@ -79,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} + {" "} +
); } @@ -132,7 +149,7 @@ function PlayerInfo(props) { return (
-

Players

+ Players: {props.player.name} {props.player.team ? ` (${props.player.team})` : ""} {props.first_move ? "" : " "} diff --git a/style.css b/style.css index 91cee83..6d5bdca 100644 --- a/style.css +++ b/style.css @@ -319,3 +319,14 @@ button:hover { .hide-button:hover { color: var(--danger-color-dark); } + +/*\ +|*| +|*| Game-specific markup +|*| +\*/ + +.game-id, .players-header { + font-size: 110%; + font-weight: bold; +}