177f9eb30d8023cc2abf4557fa9280e302e87494
[vchess.git] / client / src / views / Game.vue
1 <template lang="pug">
2 main
3 input#modalChat.modal(type="checkbox" @click="resetChatColor")
4 div#chatWrap(role="dialog" data-checkbox="modalChat" aria-labelledby="inputChat")
5 #chat.card
6 label.modal-close(for="modalChat")
7 #participants
8 span {{ Object.keys(people).length + " " + st.tr["participant(s):"] }}
9 span(v-for="p in Object.values(people)" v-if="!!p.name")
10 | {{ p.name }}
11 span.anonymous(v-if="Object.values(people).some(p => !p.name)")
12 | + @nonymous
13 Chat(:players="game.players" :pastChats="game.chats"
14 :newChat="newChat" @mychat="processChat")
15 .row
16 #aboveBoard.col-sm-12.col-md-9.col-md-offset-3.col-lg-10.col-lg-offset-2
17 span.variant-info {{ game.vname }}
18 button#chatBtn(onClick="doClick('modalChat')") Chat
19 #actions(v-if="game.score=='*'")
20 button(@click="clickDraw" :class="{['draw-' + drawOffer]: true}")
21 | {{ st.tr["Draw"] }}
22 button(v-if="!!game.mycolor" @click="abortGame") {{ st.tr["Abort"] }}
23 button(v-if="!!game.mycolor" @click="resign") {{ st.tr["Resign"] }}
24 #playersInfo
25 p
26 span.name(:class="{connected: isConnected(0)}")
27 | {{ game.players[0].name || "@nonymous" }}
28 span.time(v-if="game.score=='*'") {{ virtualClocks[0] }}
29 span.split-names -
30 span.name(:class="{connected: isConnected(1)}")
31 | {{ game.players[1].name || "@nonymous" }}
32 span.time(v-if="game.score=='*'") {{ virtualClocks[1] }}
33 BaseGame(:game="game" :vr="vr" ref="basegame"
34 @newmove="processMove" @gameover="gameOver")
35 </template>
36
37 <script>
38 import BaseGame from "@/components/BaseGame.vue";
39 import Chat from "@/components/Chat.vue";
40 import { store } from "@/store";
41 import { GameStorage } from "@/utils/gameStorage";
42 import { ppt } from "@/utils/datetime";
43 import { extractTime } from "@/utils/timeControl";
44 import { ArrayFun } from "@/utils/array";
45 import { processModalClick } from "@/utils/modalClick";
46 import { getScoreMessage } from "@/utils/scoring";
47 import params from "@/parameters";
48
49 export default {
50 name: 'my-game',
51 components: {
52 BaseGame,
53 Chat,
54 },
55 // gameRef: to find the game in (potentially remote) storage
56 data: function() {
57 return {
58 st: store.state,
59 gameRef: { //given in URL (rid = remote ID)
60 id: "",
61 rid: ""
62 },
63 game: { //passed to BaseGame
64 players:[{name:""},{name:""}],
65 rendered: false,
66 },
67 virtualClocks: [0, 0], //initialized with true game.clocks
68 vr: null, //"variant rules" object initialized from FEN
69 drawOffer: "",
70 people: {}, //players + observers
71 lastate: undefined, //used if opponent send lastate before game is ready
72 repeat: {}, //detect position repetition
73 newChat: "",
74 conn: null,
75 page: "",
76 tempId: "", //to distinguish several tabs
77 };
78 },
79 watch: {
80 "$route": function(to, from) {
81 this.gameRef.id = to.params["id"];
82 this.gameRef.rid = to.query["rid"];
83 this.loadGame();
84 },
85 "game.clocks": function(newState) {
86 if (this.game.moves.length < 2 || this.game.score != "*")
87 {
88 // 1st move not completed yet, or game over: freeze time
89 this.virtualClocks = newState.map(s => ppt(s));
90 return;
91 }
92 const currentTurn = this.vr.turn;
93 const colorIdx = ["w","b"].indexOf(currentTurn);
94 let countdown = newState[colorIdx] -
95 (Date.now() - this.game.initime[colorIdx])/1000;
96 this.virtualClocks = [0,1].map(i => {
97 const removeTime = i == colorIdx
98 ? (Date.now() - this.game.initime[colorIdx])/1000
99 : 0;
100 return ppt(newState[i] - removeTime);
101 });
102 let clockUpdate = setInterval(() => {
103 if (countdown < 0 || this.vr.turn != currentTurn || this.game.score != "*")
104 {
105 clearInterval(clockUpdate);
106 if (countdown < 0)
107 this.gameOver(this.vr.turn=="w" ? "0-1" : "1-0", this.st.tr["Time"]);
108 }
109 else
110 this.$set(this.virtualClocks, colorIdx, ppt(Math.max(0, --countdown)));
111 }, 1000);
112 },
113 },
114 // NOTE: some redundant code with Hall.vue (related to people array)
115 created: function() {
116 // Always add myself to players' list
117 const my = this.st.user;
118 this.$set(this.people, my.sid, {id:my.id, name:my.name});
119 this.gameRef.id = this.$route.params["id"];
120 this.gameRef.rid = this.$route.query["rid"]; //may be undefined
121 // Initialize connection
122 this.page = this.$route.path;
123 const connexionString = params.socketUrl +
124 "/?sid=" + this.st.user.sid +
125 "&tmpId=" + this.tempId +
126 "&page=" + encodeURIComponent(this.page);
127 this.conn = new WebSocket(connexionString);
128 this.conn.onmessage = this.socketMessageListener;
129 const socketCloseListener = () => {
130 this.conn = new WebSocket(connexionString);
131 this.conn.addEventListener('message', this.socketMessageListener);
132 this.conn.addEventListener('close', socketCloseListener);
133 };
134 this.conn.onclose = socketCloseListener;
135 // Socket init required before loading remote game:
136 const socketInit = (callback) => {
137 if (!!this.conn && this.conn.readyState == 1) //1 == OPEN state
138 callback();
139 else //socket not ready yet (initial loading)
140 this.conn.onopen = callback;
141 };
142 if (!this.gameRef.rid) //game stored locally or on server
143 this.loadGame(null, () => socketInit(this.roomInit));
144 else //game stored remotely: need socket to retrieve it
145 {
146 // NOTE: the callback "roomInit" will be lost, so we don't provide it.
147 // --> It will be given when receiving "fullgame" socket event.
148 // A more general approach would be to store it somewhere.
149 socketInit(this.loadGame);
150 }
151 },
152 mounted: function() {
153 document.getElementById("chatWrap").addEventListener(
154 "click", processModalClick);
155 },
156 beforeDestroy: function() {
157 this.conn.send(JSON.stringify({code:"disconnect",page:this.page}));
158 },
159 methods: {
160 // O.1] Ask server for room composition:
161 roomInit: function() {
162 // Notify the room only now that I connected, because
163 // messages might be lost otherwise (if game loading is slow)
164 this.conn.send(JSON.stringify({code:"connect"}));
165 this.conn.send(JSON.stringify({code:"pollclients"}));
166 },
167 isConnected: function(index) {
168 const player = this.game.players[index];
169 // Is it me ?
170 if (this.st.user.sid == player.sid || this.st.user.id == player.uid)
171 return true;
172 // Try to find a match in people:
173 return Object.keys(this.people).some(sid => sid == player.sid) ||
174 Object.values(this.people).some(p => p.id == player.uid);
175 },
176 socketMessageListener: function(msg) {
177 const data = JSON.parse(msg.data);
178 switch (data.code)
179 {
180 case "duplicate":
181 this.conn.send(JSON.stringify({code:"duplicate",
182 page:"/game/" + this.game.id}));
183 alert(this.st.tr["This tab is now offline"]);
184 break;
185 // 0.2] Receive clients list (just socket IDs)
186 case "pollclients":
187 data.sockIds.forEach(sid => {
188 if (!!this.people[sid])
189 return;
190 this.$set(this.people, sid, {id:0, name:""});
191 // Ask only identity
192 this.conn.send(JSON.stringify({code:"askidentity", target:sid}));
193 });
194 break;
195 case "askidentity":
196 // Request for identification: reply if I'm not anonymous
197 if (this.st.user.id > 0)
198 {
199 this.conn.send(JSON.stringify({code:"identity",
200 user: {
201 // NOTE: decompose to avoid revealing email
202 name: this.st.user.name,
203 sid: this.st.user.sid,
204 id: this.st.user.id,
205 },
206 target:data.from}));
207 }
208 break;
209 case "identity":
210 this.$set(this.people, data.user.sid,
211 {id: data.user.id, name: data.user.name});
212 // Ask potentially missed last state, if opponent and I play
213 if (!!this.game.mycolor
214 && this.game.type == "live" && this.game.score == "*"
215 && this.game.players.some(p => p.sid == data.user.sid))
216 {
217 this.conn.send(JSON.stringify({code:"asklastate", target:data.user.sid}));
218 }
219 break;
220 case "asklastate":
221 // Sending last state if I played a move or score != "*"
222 if ((this.game.moves.length > 0 && this.vr.turn != this.game.mycolor)
223 || this.game.score != "*" || this.drawOffer == "sent")
224 {
225 // Send our "last state" informations to opponent
226 const L = this.game.moves.length;
227 const myIdx = ["w","b"].indexOf(this.game.mycolor);
228 this.conn.send(JSON.stringify({
229 code: "lastate",
230 target: data.from,
231 state:
232 {
233 // NOTE: lastMove (when defined) includes addTime
234 lastMove: (L>0 ? this.game.moves[L-1] : undefined),
235 // Since we played a move (or abort or resign),
236 // only drawOffer=="sent" is possible
237 drawSent: this.drawOffer == "sent",
238 score: this.game.score,
239 movesCount: L,
240 initime: this.game.initime[1-myIdx], //relevant only if I played
241 }
242 }));
243 }
244 break;
245 case "askgame":
246 // Send current (live) game if I play in (not an observer),
247 // and not asked by opponent (!)
248 if (this.game.type == "live"
249 && this.game.players.some(p => p.sid == this.st.user.sid)
250 && this.game.players.every(p => p.sid != data.from))
251 {
252 const myGame =
253 {
254 // Minimal game informations:
255 id: this.game.id,
256 players: this.game.players,
257 vid: this.game.vid,
258 timeControl: this.game.timeControl,
259 score: this.game.score,
260 };
261 this.conn.send(JSON.stringify({code:"game",
262 game:myGame, target:data.from}));
263 }
264 break;
265 case "newmove":
266 if (!!data.move.cancelDrawOffer) //opponent refuses draw
267 {
268 this.drawOffer = "";
269 // NOTE for corr games: drawOffer reset by player in turn
270 if (this.game.type == "live" && !!this.game.mycolor)
271 GameStorage.update(this.gameRef.id, {drawOffer: ""});
272 }
273 this.$set(this.game, "moveToPlay", data.move);
274 break;
275 case "newchat":
276 this.newChat = data.chat;
277 if (!document.getElementById("modalChat").checked)
278 document.getElementById("chatBtn").style.backgroundColor = "#c5fefe";
279 break;
280 case "lastate": //got opponent infos about last move
281 this.lastate = data.state;
282 if (this.game.rendered) //game is rendered (Board component)
283 this.processLastate();
284 //else: will be processed when game is ready
285 break;
286 case "resign":
287 this.gameOver(data.side=="b" ? "1-0" : "0-1", "Resign");
288 break;
289 case "abort":
290 this.gameOver("?", "Abort");
291 break;
292 case "draw":
293 this.gameOver("1/2", data.message);
294 break;
295 case "drawoffer":
296 // NOTE: observers don't know who offered draw
297 this.drawOffer = "received";
298 break;
299 case "askfullgame":
300 this.conn.send(JSON.stringify({code:"fullgame",
301 game:this.game, target:data.from}));
302 break;
303 case "fullgame":
304 // Callback "roomInit" to poll clients only after game is loaded
305 this.loadGame(data.game, this.roomInit);
306 break;
307 case "connect":
308 this.$set(this.people, data.from, {name:"", id:0});
309 this.conn.send(JSON.stringify({code:"askidentity", target:data.from}));
310 break;
311 case "disconnect":
312 this.$delete(this.people, data.from);
313 break;
314 }
315 },
316 // lastate was received, but maybe game wasn't ready yet:
317 processLastate: function() {
318 const data = this.lastate;
319 this.lastate = undefined; //security...
320 const L = this.game.moves.length;
321 if (data.movesCount > L)
322 {
323 // Just got last move from him
324 this.$set(this.game, "moveToPlay", Object.assign({}, data.lastMove, {initime: data.initime}));
325 }
326 if (data.drawSent)
327 this.drawOffer = "received";
328 if (data.score != "*")
329 {
330 this.drawOffer = "";
331 if (this.game.score == "*")
332 this.gameOver(data.score);
333 }
334 },
335 clickDraw: function() {
336 if (!this.game.mycolor)
337 return; //I'm just spectator
338 if (["received","threerep"].includes(this.drawOffer))
339 {
340 if (!confirm(this.st.tr["Accept draw?"]))
341 return;
342 const message = (this.drawOffer == "received"
343 ? "Mutual agreement"
344 : "Three repetitions");
345 Object.keys(this.people).forEach(sid => {
346 if (sid != this.st.user.sid)
347 {
348 this.conn.send(JSON.stringify({code:"draw",
349 message:message, target:sid}));
350 }
351 });
352 this.gameOver("1/2", message);
353 }
354 else if (this.drawOffer == "") //no effect if drawOffer == "sent"
355 {
356 if (this.game.mycolor != this.vr.turn)
357 return alert(this.st.tr["Draw offer only in your turn"]);
358 if (!confirm(this.st.tr["Offer draw?"]))
359 return;
360 this.drawOffer = "sent";
361 Object.keys(this.people).forEach(sid => {
362 if (sid != this.st.user.sid)
363 this.conn.send(JSON.stringify({code:"drawoffer", target:sid}));
364 });
365 GameStorage.update(this.gameRef.id, {drawOffer: this.game.mycolor});
366 }
367 },
368 abortGame: function() {
369 if (!this.game.mycolor || !confirm(this.st.tr["Terminate game?"]))
370 return;
371 this.gameOver("?", "Abort");
372 Object.keys(this.people).forEach(sid => {
373 if (sid != this.st.user.sid)
374 {
375 this.conn.send(JSON.stringify({
376 code: "abort",
377 target: sid,
378 }));
379 }
380 });
381 },
382 resign: function(e) {
383 if (!this.game.mycolor || !confirm(this.st.tr["Resign the game?"]))
384 return;
385 Object.keys(this.people).forEach(sid => {
386 if (sid != this.st.user.sid)
387 {
388 this.conn.send(JSON.stringify({code:"resign",
389 side:this.game.mycolor, target:sid}));
390 }
391 });
392 this.gameOver(this.game.mycolor=="w" ? "0-1" : "1-0", "Resign");
393 },
394 // 3 cases for loading a game:
395 // - from indexedDB (running or completed live game I play)
396 // - from server (one correspondance game I play[ed] or not)
397 // - from remote peer (one live game I don't play, finished or not)
398 loadGame: function(game, callback) {
399 const afterRetrieval = async (game) => {
400 const vModule = await import("@/variants/" + game.vname + ".js");
401 window.V = vModule.VariantRules;
402 this.vr = new V(game.fen);
403 const gtype = (game.timeControl.indexOf('d') >= 0 ? "corr" : "live");
404 const tc = extractTime(game.timeControl);
405 if (gtype == "corr")
406 {
407 if (game.players[0].color == "b")
408 {
409 // Adopt the same convention for live and corr games: [0] = white
410 [ game.players[0], game.players[1] ] =
411 [ game.players[1], game.players[0] ];
412 }
413 // corr game: needs to compute the clocks + initime
414 // NOTE: clocks in seconds, initime in milliseconds
415 game.clocks = [tc.mainTime, tc.mainTime];
416 game.moves.sort((m1,m2) => m1.idx - m2.idx); //in case of
417 if (game.score == "*") //otherwise no need to bother with time
418 {
419 game.initime = [0, 0];
420 const L = game.moves.length;
421 if (L >= 3)
422 {
423 let addTime = [0, 0];
424 for (let i=2; i<L; i++)
425 {
426 addTime[i%2] += tc.increment -
427 (game.moves[i].played - game.moves[i-1].played) / 1000;
428 }
429 for (let i=0; i<=1; i++)
430 game.clocks[i] += addTime[i];
431 }
432 if (L >= 1)
433 game.initime[L%2] = game.moves[L-1].played;
434 }
435 // Now that we used idx and played, re-format moves as for live games
436 game.moves = game.moves.map( (m) => {
437 const s = m.squares;
438 return {
439 appear: s.appear,
440 vanish: s.vanish,
441 start: s.start,
442 end: s.end,
443 };
444 });
445 // Also sort chat messages (if any)
446 game.chats.sort( (c1,c2) => { return c2.added - c1.added; });
447 }
448 const myIdx = game.players.findIndex(p => {
449 return p.sid == this.st.user.sid || p.uid == this.st.user.id;
450 });
451 if (gtype == "live" && game.clocks[0] < 0) //game unstarted
452 {
453 game.clocks = [tc.mainTime, tc.mainTime];
454 if (game.score == "*")
455 {
456 game.initime[0] = Date.now();
457 if (myIdx >= 0)
458 {
459 // I play in this live game; corr games don't have clocks+initime
460 GameStorage.update(game.id,
461 {
462 clocks: game.clocks,
463 initime: game.initime,
464 });
465 }
466 }
467 }
468 if (!!game.drawOffer)
469 {
470 if (game.drawOffer == "t") //three repetitions
471 this.drawOffer = "threerep";
472 else
473 {
474 if (myIdx < 0)
475 this.drawOffer = "received"; //by any of the players
476 else
477 {
478 // I play in this game:
479 if ((game.drawOffer == "w" && myIdx==0) || (game.drawOffer=="b" && myIdx==1))
480 this.drawOffer = "sent";
481 else //all other cases
482 this.drawOffer = "received";
483 }
484 }
485 }
486 if (!!game.scoreMsg)
487 game.scoreMsg = this.st.tr[game.scoreMsg]; //stored in english
488 this.game = Object.assign({},
489 game,
490 // NOTE: assign mycolor here, since BaseGame could also be VS computer
491 {
492 type: gtype,
493 increment: tc.increment,
494 mycolor: [undefined,"w","b"][myIdx+1],
495 // opponent sid not strictly required (or available), but easier
496 // at least oppsid or oppid is available anyway:
497 oppsid: (myIdx < 0 ? undefined : game.players[1-myIdx].sid),
498 oppid: (myIdx < 0 ? undefined : game.players[1-myIdx].uid),
499 }
500 );
501 this.$nextTick(() => {
502 this.game.rendered = true;
503 // Did lastate arrive before game was rendered?
504 if (!!this.lastate)
505 this.processLastate();
506 });
507 this.repeat = {}; //reset: scan past moves' FEN:
508 let repIdx = 0;
509 // NOTE: vr_tmp to obtain FEN strings is redundant with BaseGame
510 let vr_tmp = new V(game.fenStart);
511 game.moves.forEach(m => {
512 vr_tmp.play(m);
513 const fenObj = V.ParseFen( vr_tmp.getFen() );
514 repIdx = fenObj.position + "_" + fenObj.turn;
515 if (!!fenObj.flags)
516 repIdx += "_" + fenObj.flags;
517 this.repeat[repIdx] = (!!this.repeat[repIdx]
518 ? this.repeat[repIdx]+1
519 : 1);
520 });
521 if (this.repeat[repIdx] >= 3)
522 this.drawOffer = "threerep";
523 callback();
524 };
525 if (!!game)
526 return afterRetrieval(game);
527 if (!!this.gameRef.rid)
528 {
529 // Remote live game: forgetting about callback func... (TODO: design)
530 this.conn.send(JSON.stringify(
531 {code:"askfullgame", target:this.gameRef.rid}));
532 }
533 else
534 {
535 // Local or corr game
536 GameStorage.get(this.gameRef.id, afterRetrieval);
537 }
538 },
539 // Post-process a move (which was just played)
540 processMove: function(move) {
541 // Update storage (corr or live) if I play in the game
542 const colorIdx = ["w","b"].indexOf(move.color);
543 const nextIdx = ["w","b"].indexOf(this.vr.turn);
544 // https://stackoverflow.com/a/38750895
545 if (!!this.game.mycolor)
546 {
547 const allowed_fields = ["appear", "vanish", "start", "end"];
548 // NOTE: 'var' to see this variable outside this block
549 var filtered_move = Object.keys(move)
550 .filter(key => allowed_fields.includes(key))
551 .reduce((obj, key) => {
552 obj[key] = move[key];
553 return obj;
554 }, {});
555 }
556 // Send move ("newmove" event) to people in the room (if our turn)
557 let addTime = 0;
558 if (move.color == this.game.mycolor)
559 {
560 if (this.drawOffer == "received") //I refuse draw
561 this.drawOffer = "";
562 if (this.game.moves.length >= 2) //after first move
563 {
564 const elapsed = Date.now() - this.game.initime[colorIdx];
565 // elapsed time is measured in milliseconds
566 addTime = this.game.increment - elapsed/1000;
567 }
568 const sendMove = Object.assign({},
569 filtered_move,
570 {
571 addTime: addTime,
572 cancelDrawOffer: this.drawOffer=="",
573 });
574 Object.keys(this.people).forEach(sid => {
575 if (sid != this.st.user.sid)
576 {
577 this.conn.send(JSON.stringify({
578 code: "newmove",
579 target: sid,
580 move: sendMove,
581 }));
582 }
583 });
584 // (Add)Time indication: useful in case of lastate infos requested
585 move.addTime = addTime;
586 }
587 else
588 addTime = move.addTime; //supposed transmitted
589 // Update current game object:
590 this.game.moves.push(move);
591 this.game.fen = move.fen;
592 this.$set(this.game.clocks, colorIdx, this.game.clocks[colorIdx] + addTime);
593 // move.initime is set only when I receive a "lastate" move from opponent
594 this.game.initime[nextIdx] = move.initime || Date.now();
595 // If repetition detected, consider that a draw offer was received:
596 const fenObj = V.ParseFen(move.fen);
597 let repIdx = fenObj.position + "_" + fenObj.turn;
598 if (!!fenObj.flags)
599 repIdx += "_" + fenObj.flags;
600 this.repeat[repIdx] = (!!this.repeat[repIdx]
601 ? this.repeat[repIdx]+1
602 : 1);
603 if (this.repeat[repIdx] >= 3)
604 this.drawOffer = "threerep";
605 else if (this.drawOffer == "threerep")
606 this.drawOffer = "";
607 // Since corr games are stored at only one location, update should be
608 // done only by one player for each move:
609 if (!!this.game.mycolor &&
610 (this.game.type == "live" || move.color == this.game.mycolor))
611 {
612 let drawCode = "";
613 switch (this.drawOffer)
614 {
615 case "threerep":
616 drawCode = "t";
617 break;
618 case "sent":
619 drawCode = this.game.mycolor;
620 break;
621 case "received":
622 drawCode = this.vr.turn;
623 break;
624 }
625 if (this.game.type == "corr")
626 {
627 GameStorage.update(this.gameRef.id,
628 {
629 fen: move.fen,
630 move:
631 {
632 squares: filtered_move,
633 played: Date.now(),
634 idx: this.game.moves.length - 1,
635 },
636 drawOffer: drawCode || "n", //"n" for "None" to force reset (otherwise it's ignored)
637 });
638 }
639 else //live
640 {
641 GameStorage.update(this.gameRef.id,
642 {
643 fen: move.fen,
644 move: filtered_move,
645 clocks: this.game.clocks,
646 initime: this.game.initime,
647 drawOffer: drawCode,
648 });
649 }
650 }
651 },
652 resetChatColor: function() {
653 // TODO: this is called twice, once on opening an once on closing
654 document.getElementById("chatBtn").style.backgroundColor = "#e2e2e2";
655 },
656 processChat: function(chat) {
657 this.conn.send(JSON.stringify({code:"newchat", chat:chat}));
658 // NOTE: anonymous chats in corr games are not stored on server (TODO?)
659 if (this.game.type == "corr" && this.st.user.id > 0)
660 GameStorage.update(this.gameRef.id, {chat: chat});
661 },
662 gameOver: function(score, scoreMsg) {
663 this.game.score = score;
664 this.game.scoreMsg = this.st.tr[(!!scoreMsg
665 ? scoreMsg
666 : getScoreMessage(score))];
667 const myIdx = this.game.players.findIndex(p => {
668 return p.sid == this.st.user.sid || p.uid == this.st.user.id;
669 });
670 if (myIdx >= 0) //OK, I play in this game
671 {
672 GameStorage.update(this.gameRef.id,
673 {score: score, scoreMsg: scoreMsg});
674 }
675 },
676 },
677 };
678 </script>
679
680 <style lang="sass" scoped>
681 .connected
682 background-color: lightgreen
683
684 #participants
685 margin-left: 5px
686
687 .anonymous
688 color: grey
689 font-style: italic
690
691 @media screen and (min-width: 768px)
692 #actions
693 width: 300px
694 @media screen and (max-width: 767px)
695 .game
696 width: 100%
697
698 #actions
699 display: inline-block
700 margin-top: 10px
701 button
702 display: inline-block
703 margin: 0
704
705 @media screen and (max-width: 767px)
706 #aboveBoard
707 text-align: center
708 @media screen and (min-width: 768px)
709 #aboveBoard
710 margin-left: 30%
711
712 .variant-info
713 font-weight: bold
714 padding-right: 10px
715
716 .name
717 font-size: 1.5rem
718 padding: 1px
719
720 .time
721 font-size: 2rem
722 display: inline-block
723 margin-left: 10px
724
725 .split-names
726 display: inline-block
727 margin: 0 15px
728
729 #chat
730 padding-top: 20px
731 max-width: 600px
732 border: none;
733
734 #chatBtn
735 margin: 0 10px 0 0
736
737 .draw-sent, .draw-sent:hover
738 background-color: lightyellow
739
740 .draw-received, .draw-received:hover
741 background-color: lightgreen
742
743 .draw-threerep, .draw-threerep:hover
744 background-color: #e4d1fc
745 </style>