commit 4998a030cad3e1c188b183d5c47a7414b8241b30 (patch)
parent 2d47ba313d46a7d7546188345fab9e5b353d9980
Author: Alex Karle <alex@karle.co>
Date: Sat, 4 Apr 2020 01:06:59 -0400
debug: Use pretty SVG cards for hands/trump
WOAHHHH NELLY! This looks _awesome_ :) It's finally coming together!
This is, of course, just a demo/debug site, but I think proof-of-concept
wise it's come a long way.
Diffstat:
1 file changed, 15 insertions(+), 4 deletions(-)
diff --git a/public/debug.html b/public/debug.html
@@ -3,7 +3,12 @@
<head>
<meta charset="utf-8">
<title>Euchre Live!!</title>
-</head>
+ <style>
+ img.card {
+ width: 100px;
+ }
+ </style>
+ </head>
<body>
<div id="content"></div>
<script>
@@ -16,13 +21,19 @@
gameState = '<br>Game: ' + msg.game.id + '<br>' +
'Players: ' + msg.game.players + '<br>' +
'Spectators: ' + msg.game.spectators + '<br>' +
- 'Game Phase: ' + msg.game.phase + '<br>' +
- 'Trump Nominee: ' + msg.game.trump_nominee + '<br>'
+ 'Game Phase: ' + msg.game.phase + '<br>'
+
+ if (typeof msg.game.trump_nominee !== 'undefined') {
+ gameState += 'Trump Nominee: ' + '<img class="card" src="cards/' + msg.game.trump_nominee + '.svg"><br>'
+ }
document.getElementById('game').innerHTML = gameState
} else if (msg.msg_type === 'error') {
document.getElementById('error').innerHTML += msg.msg + '<br>'
} else if (msg.msg_type === 'deal') {
- document.getElementById('hand').innerHTML = 'HAND: ' + msg.hand + '<br>'
+ document.getElementById('hand').innerHTML = 'HAND: <br>'
+ for (var i = 0; i < msg.hand.length; i++) {
+ document.getElementById('hand').innerHTML += '<img class="card" src="cards/' + msg.hand[i] + '.svg">'
+ }
}
};