e309c5dfd7437202df69c396bb25f10d033d1186
[vchess.git] / client / src / components / BaseGame.vue
1 <template lang="pug">
2 div#baseGame
3 input#modalEog.modal(type="checkbox")
4 div#eogDiv(
5 role="dialog"
6 data-checkbox="modalEog"
7 )
8 .card.text-center
9 label.modal-close(for="modalEog")
10 h3.section {{ endgameMessage }}
11 #gameContainer
12 #boardContainer
13 Board(
14 ref="board"
15 :vr="vr"
16 :last-move="lastMove"
17 :analyze="mode=='analyze'"
18 :score="game.score"
19 :user-color="game.mycolor"
20 :orientation="orientation"
21 :vname="game.vname"
22 :incheck="incheck"
23 @play-move="play"
24 @click-square="clickSquare"
25 )
26 #turnIndicator(v-if="showTurn") {{ turn }}
27 #controls.button-group
28 button(@click="gotoBegin()")
29 img.inline(src="/images/icons/fast-forward_rev.svg")
30 button(@click="undo()")
31 img.inline(src="/images/icons/play_rev.svg")
32 button(v-if="canFlip" @click="flip()")
33 img.inline(src="/images/icons/flip.svg")
34 button(
35 @click="runAutoplay()"
36 :class="{'in-autoplay': autoplay}"
37 )
38 img.inline(src="/images/icons/autoplay.svg")
39 button(@click="play()")
40 img.inline(src="/images/icons/play.svg")
41 button(@click="gotoEnd()")
42 img.inline(src="/images/icons/fast-forward.svg")
43 p#fenAnalyze(v-show="showFen") {{ (!!vr ? vr.getFen() : "") }}
44 #movesList
45 MoveList(
46 :show="showMoves"
47 :canAnalyze="canAnalyze"
48 :canDownload="allowDownloadPGN"
49 :score="game.score"
50 :message="game.scoreMsg"
51 :firstNum="firstMoveNumber"
52 :moves="moves"
53 :cursor="cursor"
54 @download="download"
55 @showrules="showRules"
56 @analyze="toggleAnalyze"
57 @goto-move="gotoMove"
58 @reset-arrows="resetArrows"
59 )
60 .clearer
61 </template>
62
63 <script>
64 import Board from "@/components/Board.vue";
65 import MoveList from "@/components/MoveList.vue";
66 import params from "@/parameters";
67 import { store } from "@/store";
68 import { getSquareId } from "@/utils/squareId";
69 import { getDate } from "@/utils/datetime";
70 import { processModalClick } from "@/utils/modalClick";
71 import { getScoreMessage } from "@/utils/scoring";
72 import { getFullNotation } from "@/utils/notation";
73 import { undoMove } from "@/utils/playUndo";
74 export default {
75 name: "my-base-game",
76 components: {
77 Board,
78 MoveList
79 },
80 props: ["game"],
81 data: function() {
82 return {
83 st: store.state,
84 // NOTE: all following variables must be reset at the beginning of a game
85 vr: null, //VariantRules object, game state
86 endgameMessage: "",
87 orientation: "w",
88 mode: "",
89 score: "*", //'*' means 'unfinished'
90 moves: [],
91 cursor: -1, //index of the move just played
92 lastMove: null,
93 firstMoveNumber: 0, //for printing
94 incheck: [], //for Board
95 inMultimove: false,
96 autoplay: false,
97 inPlay: false,
98 stackToPlay: []
99 };
100 },
101 computed: {
102 turn: function() {
103 if (!this.vr) return "";
104 if (this.vr.showMoves != "all") {
105 return this.st.tr[
106 (this.vr.turn == 'w' ? "White" : "Black") + " to move"];
107 }
108 // Cannot flip (racing king or circular chess), or Monochrome
109 return (
110 this.vr.movesCount == 0 && this.game.mycolor == "w"
111 ? this.st.tr["It's your turn!"]
112 : ""
113 );
114 },
115 showFen: function() {
116 return (
117 this.mode == "analyze" &&
118 this.$router.currentRoute.path.indexOf("/analyse") === -1
119 );
120 },
121 // TODO: is it OK to pass "computed" as properties?
122 // Also, some are seemingly not recomputed when vr is initialized.
123 showMoves: function() {
124 return this.game.score != "*"
125 ? "all"
126 : (!!this.vr ? this.vr.showMoves : "none");
127 },
128 showTurn: function() {
129 return (
130 this.game.score == '*' &&
131 !!this.vr &&
132 (
133 this.vr.showMoves != "all" ||
134 !this.vr.canFlip ||
135 this.vr.showFirstTurn
136 )
137 );
138 },
139 canAnalyze: function() {
140 return (
141 this.game.mode != "analyze" &&
142 !!this.vr && this.vr.canAnalyze
143 );
144 },
145 canFlip: function() {
146 return !!this.vr && this.vr.canFlip;
147 },
148 allowDownloadPGN: function() {
149 return (
150 this.game.score != "*" ||
151 (!!this.vr && this.vr.showMoves == "all")
152 );
153 }
154 },
155 created: function() {
156 if (!!this.game.fenStart) this.re_setVariables();
157 },
158 mounted: function() {
159 if (!("ontouchstart" in window)) {
160 // Desktop browser:
161 const baseGameDiv = document.getElementById("baseGame");
162 baseGameDiv.tabIndex = 0;
163 baseGameDiv.addEventListener("click", this.focusBg);
164 baseGameDiv.addEventListener("keydown", this.handleKeys);
165 baseGameDiv.addEventListener("wheel", this.handleScroll);
166 }
167 document.getElementById("eogDiv")
168 .addEventListener("click", processModalClick);
169 },
170 beforeDestroy: function() {
171 // TODO: probably not required
172 this.autoplay = false;
173 },
174 methods: {
175 focusBg: function() {
176 document.getElementById("baseGame").focus();
177 },
178 handleKeys: function(e) {
179 if ([32, 37, 38, 39, 40].includes(e.keyCode)) e.preventDefault();
180 switch (e.keyCode) {
181 case 37:
182 this.undo();
183 break;
184 case 39:
185 this.play();
186 break;
187 case 38:
188 this.gotoBegin();
189 break;
190 case 40:
191 this.gotoEnd();
192 break;
193 case 32:
194 this.flip();
195 break;
196 }
197 },
198 handleScroll: function(e) {
199 e.preventDefault();
200 if (e.deltaY < 0) this.undo();
201 else if (e.deltaY > 0) this.play();
202 },
203 resetArrows: function() {
204 // TODO: make arrows scale with board, and remove this
205 this.$refs["board"].cancelResetArrows();
206 },
207 showRules: function() {
208 // The button is here only on Game page:
209 document.getElementById("modalRules").checked = true;
210 },
211 re_setVariables: function(game) {
212 if (!game) game = this.game; //in case of...
213 this.endgameMessage = "";
214 // "w": default orientation for observed games
215 this.orientation = game.mycolor || "w";
216 this.mode = game.mode || game.type; //TODO: merge...
217 this.moves = JSON.parse(JSON.stringify(game.moves || []));
218 // Post-processing: decorate each move with notation and FEN
219 this.vr = new V(game.fenStart);
220 this.inMultimove = false; //in case of
221 if (!!this.$refs["board"])
222 // Also in case of:
223 this.$refs["board"].resetCurrentAttempt();
224 let analyseBtn = document.getElementById("analyzeBtn");
225 if (!!analyseBtn) analyseBtn.classList.remove("active");
226 const parsedFen = V.ParseFen(game.fenStart);
227 const firstMoveColor = parsedFen.turn;
228 this.firstMoveNumber = Math.floor(parsedFen.movesCount / 2) + 1;
229 let L = this.moves.length;
230 if (L == 0) {
231 // Could be started on a random position in analysis mode:
232 this.incheck = this.vr.getCheckSquares();
233 this.score = this.vr.getCurrentScore();
234 if (this.score != '*') {
235 // Show score on screen
236 const message = getScoreMessage(this.score);
237 this.showEndgameMsg(this.score + " . " + this.st.tr[message]);
238 }
239 }
240 else {
241 this.moves.forEach((move,idx) => {
242 // Strategy working also for multi-moves:
243 if (!Array.isArray(move)) move = [move];
244 const Lm = move.length;
245 move.forEach((m,idxM) => {
246 m.notation = this.vr.getNotation(m);
247 m.unambiguous = V.GetUnambiguousNotation(m);
248 this.vr.play(m);
249 const checkSquares = this.vr.getCheckSquares();
250 if (checkSquares.length > 0) m.notation += "+";
251 if (idxM == Lm - 1) m.fen = this.vr.getFen();
252 if (idx == L - 1 && idxM == Lm - 1) {
253 this.incheck = checkSquares;
254 this.score = this.vr.getCurrentScore();
255 if (["1-0", "0-1"].includes(this.score)) m.notation += "#";
256 }
257 });
258 });
259 }
260 if (firstMoveColor == "b") {
261 // 'start' & 'end' is required for Board component
262 this.moves.unshift({
263 notation: "...",
264 unambiguous: "...",
265 start: { x: -1, y: -1 },
266 end: { x: -1, y: -1 },
267 fen: game.fenStart
268 });
269 L++;
270 }
271 this.positionCursorTo(L - 1);
272 },
273 positionCursorTo: function(index) {
274 this.cursor = index;
275 // Note: last move in moves array might be a multi-move
276 if (index >= 0) this.lastMove = this.moves[index];
277 else this.lastMove = null;
278 },
279 toggleAnalyze: function() {
280 // Freeze while choices are shown (and autoplay has priority)
281 if (this.$refs["board"].choices.length > 0 || this.autoplay) return;
282 if (this.mode != "analyze") {
283 // Enter analyze mode:
284 if (this.inMultimove) this.cancelCurrentMultimove();
285 this.gameMode = this.mode; //was not 'analyze'
286 this.mode = "analyze";
287 this.gameCursor = this.cursor;
288 this.gameMoves = JSON.parse(JSON.stringify(this.moves));
289 document.getElementById("analyzeBtn").classList.add("active");
290 }
291 else {
292 // Exit analyze mode:
293 this.mode = this.gameMode ;
294 this.cursor = this.gameCursor;
295 this.moves = this.gameMoves;
296 let fen = this.game.fenStart;
297 if (this.cursor >= 0) {
298 let mv = this.moves[this.cursor];
299 if (!Array.isArray(mv)) mv = [mv];
300 fen = mv[mv.length-1].fen;
301 }
302 this.vr = new V(fen);
303 this.inMultimove = false; //in case of
304 this.$refs["board"].resetCurrentAttempt(); //also in case of
305 this.incheck = this.vr.getCheckSquares();
306 if (this.cursor >= 0) this.lastMove = this.moves[this.cursor];
307 else this.lastMove = null;
308 document.getElementById("analyzeBtn").classList.remove("active");
309 }
310 },
311 download: function() {
312 const content = this.getPgn();
313 // Prepare and trigger download link
314 let downloadAnchor = document.getElementById("download");
315 downloadAnchor.setAttribute("download", "game.pgn");
316 downloadAnchor.href =
317 "data:text/plain;charset=utf-8," + encodeURIComponent(content);
318 downloadAnchor.click();
319 },
320 getPgn: function() {
321 let pgn = "";
322 pgn += '[Site "vchess.club"]\n';
323 pgn += '[Variant "' + this.game.vname + '"]\n';
324 const gdt = getDate(new Date(this.game.created || Date.now()));
325 pgn += '[Date "' + gdt + '"]\n';
326 pgn += '[White "' + this.game.players[0].name + '"]\n';
327 pgn += '[Black "' + this.game.players[1].name + '"]\n';
328 pgn += '[Fen "' + this.game.fenStart + '"]\n';
329 pgn += '[Result "' + this.game.score + '"]\n';
330 if (!!this.game.id)
331 pgn += '[Url "' + params.serverUrl + '/game/' + this.game.id + '"]\n';
332 if (!!this.game.cadence)
333 pgn += '[Cadence "' + this.game.cadence + '"]\n';
334 pgn += '\n';
335 for (let i = 0; i < this.moves.length; i += 2) {
336 if (i > 0) pgn += " ";
337 // Adjust dots notation for a better display:
338 let fullNotation = getFullNotation(this.moves[i]);
339 if (fullNotation == "...") fullNotation = "..";
340 pgn += (i / 2 + this.firstMoveNumber) + "." + fullNotation;
341 if (i+1 < this.moves.length)
342 pgn += " " + getFullNotation(this.moves[i+1]);
343 }
344 pgn += "\n\n";
345 for (let i = 0; i < this.moves.length; i += 2) {
346 const moveNumber = i / 2 + this.firstMoveNumber;
347 // Skip "dots move", useless for machine reading:
348 if (this.moves[i].notation != "...") {
349 pgn += moveNumber + ".w " +
350 getFullNotation(this.moves[i], "unambiguous") + "\n";
351 }
352 if (i+1 < this.moves.length) {
353 pgn += moveNumber + ".b " +
354 getFullNotation(this.moves[i+1], "unambiguous") + "\n";
355 }
356 }
357 return pgn;
358 },
359 showEndgameMsg: function(message) {
360 this.endgameMessage = message;
361 document.getElementById("modalEog").checked = true;
362 },
363 runAutoplay: function() {
364 if (this.autoplay) {
365 this.autoplay = false;
366 if (this.stackToPlay.length > 0)
367 // Move(s) arrived in-between
368 this.play(this.stackToPlay.pop(), "received");
369 }
370 else if (this.cursor < this.moves.length - 1) {
371 this.autoplay = true;
372 this.play(null, null, null, "autoplay");
373 }
374 },
375 // Animate an elementary move
376 animateMove: function(move, callback) {
377 let startSquare = document.getElementById(getSquareId(move.start));
378 if (!startSquare) return; //shouldn't happen but...
379 let endSquare = document.getElementById(getSquareId(move.end));
380 let rectStart = startSquare.getBoundingClientRect();
381 let rectEnd = endSquare.getBoundingClientRect();
382 let translation = {
383 x: rectEnd.x - rectStart.x,
384 y: rectEnd.y - rectStart.y
385 };
386 let movingPiece = document.querySelector(
387 "#" + getSquareId(move.start) + " > img.piece"
388 );
389 // For some unknown reasons Opera get "movingPiece == null" error
390 // TODO: is it calling 'animate()' twice ? One extra time ?
391 if (!movingPiece) return;
392 const squares = document.getElementsByClassName("board");
393 for (let i = 0; i < squares.length; i++) {
394 let square = squares.item(i);
395 if (square.id != getSquareId(move.start))
396 // HACK for animation:
397 // (with positive translate, image slides "under background")
398 square.style.zIndex = "-1";
399 }
400 movingPiece.style.transform =
401 "translate(" + translation.x + "px," + translation.y + "px)";
402 movingPiece.style.transitionDuration = "0.25s";
403 movingPiece.style.zIndex = "3000";
404 setTimeout(() => {
405 for (let i = 0; i < squares.length; i++)
406 squares.item(i).style.zIndex = "auto";
407 movingPiece.style = {}; //required e.g. for 0-0 with KR swap
408 callback();
409 }, 250);
410 },
411 // For Analyse mode:
412 emitFenIfAnalyze: function() {
413 if (this.game.mode == "analyze") {
414 let fen = this.game.fenStart;
415 if (!!this.lastMove) {
416 if (Array.isArray(this.lastMove)) {
417 const L = this.lastMove.length;
418 fen = this.lastMove[L-1].fen;
419 }
420 else fen = this.lastMove.fen;
421 }
422 this.$emit("fenchange", fen);
423 }
424 },
425 clickSquare: function(square) {
426 // Some variants make use of a single click at specific times:
427 const move = this.vr.doClick(square);
428 if (!!move) this.play(move);
429 },
430 // "light": if gotoMove() or gotoEnd()
431 play: function(move, received, light, autoplay) {
432 // Freeze while choices are shown:
433 if (
434 !!this.$refs["board"].selectedPiece ||
435 this.$refs["board"].choices.length > 0
436 ) {
437 return;
438 }
439 const navigate = !move;
440 // Forbid navigation during autoplay:
441 if (navigate && this.autoplay && !autoplay) return;
442 // Forbid playing outside analyze mode, except if move is received.
443 // Sufficient condition because Board already knows which turn it is.
444 if (
445 this.mode != "analyze" &&
446 !navigate &&
447 !received &&
448 (this.game.score != "*" || this.cursor < this.moves.length - 1)
449 ) {
450 return;
451 }
452 if (!!received) {
453 if (this.autoplay || this.inPlay) {
454 // Received moves while autoplaying are stacked,
455 // and in observed games they could arrive too fast:
456 this.stackToPlay.unshift(move);
457 return;
458 }
459 this.inPlay = true;
460 if (this.mode == "analyze") this.toggleAnalyze();
461 if (this.cursor < this.moves.length - 1)
462 // To play a received move, cursor must be at the end of the game:
463 this.gotoEnd();
464 }
465 // The board may show some the possible moves: (TODO: bad solution)
466 this.$refs["board"].resetCurrentAttempt();
467 const playSubmove = (smove) => {
468 smove.notation = this.vr.getNotation(smove);
469 smove.unambiguous = V.GetUnambiguousNotation(smove);
470 this.vr.play(smove);
471 if (this.inMultimove && !!this.lastMove) {
472 if (!Array.isArray(this.lastMove))
473 this.lastMove = [this.lastMove, smove];
474 else this.lastMove.push(smove);
475 }
476 // Is opponent (or me) in check?
477 this.incheck = this.vr.getCheckSquares();
478 if (this.incheck.length > 0) smove.notation += "+";
479 if (!this.inMultimove) {
480 // First sub-move:
481 this.lastMove = smove;
482 // Condition is "!navigate" but we mean "!this.autoplay"
483 if (!navigate) {
484 if (this.cursor < this.moves.length - 1)
485 this.moves = this.moves.slice(0, this.cursor + 1);
486 this.moves.push(smove);
487 }
488 this.inMultimove = true; //potentially
489 this.cursor++;
490 } else if (!navigate) {
491 // Already in the middle of a multi-move
492 const L = this.moves.length;
493 if (!Array.isArray(this.moves[L-1]))
494 this.$set(this.moves, L-1, [this.moves[L-1], smove]);
495 else this.moves[L-1].push(smove);
496 }
497 };
498 const playMove = () => {
499 const animate = (
500 ["all", "highlight"].includes(V.ShowMoves) &&
501 (this.autoplay || !!received)
502 );
503 if (!Array.isArray(move)) move = [move];
504 let moveIdx = 0;
505 let self = this;
506 const initurn = this.vr.turn;
507 (function executeMove() {
508 const smove = move[moveIdx++];
509 // NOTE: condition "smove.start.x >= 0" required for Dynamo,
510 // because second move may be empty.
511 if (animate && smove.start.x >= 0) {
512 self.animateMove(smove, () => {
513 playSubmove(smove);
514 if (moveIdx < move.length) setTimeout(executeMove, 500);
515 else afterMove(smove, initurn);
516 });
517 } else {
518 playSubmove(smove);
519 if (moveIdx < move.length) executeMove();
520 else afterMove(smove, initurn);
521 }
522 })();
523 };
524 const computeScore = () => {
525 const score = this.vr.getCurrentScore();
526 if (!navigate) {
527 if (["1-0", "0-1"].includes(score)) {
528 if (Array.isArray(this.lastMove)) {
529 const L = this.lastMove.length;
530 this.lastMove[L - 1].notation += "#";
531 }
532 else this.lastMove.notation += "#";
533 }
534 }
535 if (score != "*" && ["analyze", "versus"].includes(this.mode)) {
536 const message = getScoreMessage(score);
537 // Show score on screen
538 this.showEndgameMsg(score + " . " + this.st.tr[message]);
539 }
540 return score;
541 };
542 const afterMove = (smove, initurn) => {
543 if (this.vr.turn != initurn) {
544 // Turn has changed: move is complete
545 if (!smove.fen)
546 // NOTE: only FEN of last sub-move is required (=> setting it here)
547 smove.fen = this.vr.getFen();
548 this.emitFenIfAnalyze();
549 this.inMultimove = false;
550 this.score = computeScore();
551 if (this.autoplay) {
552 if (this.cursor < this.moves.length - 1)
553 setTimeout(() => this.play(null, null, null, "autoplay"), 1000);
554 else {
555 this.autoplay = false;
556 if (this.stackToPlay.length > 0)
557 // Move(s) arrived in-between
558 this.play(this.stackToPlay.pop(), "received");
559 }
560 }
561 if (this.mode != "analyze" && !navigate) {
562 if (!received) {
563 // Post-processing (e.g. computer play).
564 const L = this.moves.length;
565 // NOTE: always emit the score, even in unfinished
566 this.$emit("newmove", this.moves[L-1], { score: this.score });
567 } else {
568 this.inPlay = false;
569 if (this.stackToPlay.length > 0)
570 // Move(s) arrived in-between
571 this.play(this.stackToPlay.pop(), "received");
572 }
573 }
574 }
575 };
576 // NOTE: navigate and received are mutually exclusive
577 if (navigate) {
578 // The move to navigate to is necessarily full:
579 if (this.cursor == this.moves.length - 1) return; //no more moves
580 move = this.moves[this.cursor + 1];
581 if (!this.autoplay) {
582 // Just play the move:
583 if (!Array.isArray(move)) move = [move];
584 for (let i=0; i < move.length; i++) this.vr.play(move[i]);
585 if (!light) {
586 this.lastMove = move;
587 this.incheck = this.vr.getCheckSquares();
588 this.score = computeScore();
589 this.emitFenIfAnalyze();
590 }
591 this.cursor++;
592 return;
593 }
594 }
595 playMove();
596 },
597 cancelCurrentMultimove: function() {
598 const L = this.moves.length;
599 let move = this.moves[L-1];
600 if (!Array.isArray(move)) move = [move];
601 for (let i = move.length - 1; i >= 0; i--) this.vr.undo(move[i]);
602 this.moves.pop();
603 this.cursor--;
604 this.inMultimove = false;
605 },
606 cancelLastMove: function() {
607 // The last played move was canceled (corr game)
608 this.undo();
609 this.moves.pop();
610 },
611 // "light": if gotoMove() or gotoBegin()
612 undo: function(move, light) {
613 if (
614 this.autoplay ||
615 !!this.$refs["board"].selectedPiece ||
616 this.$refs["board"].choices.length > 0
617 ) {
618 return;
619 }
620 this.$refs["board"].resetCurrentAttempt();
621 if (this.inMultimove) {
622 this.cancelCurrentMultimove();
623 this.incheck = this.vr.getCheckSquares();
624 if (this.cursor >= 0) this.lastMove = this.moves[this.cursor];
625 else this.lastMove = null;
626 } else {
627 if (!move) {
628 const minCursor =
629 this.moves.length > 0 && this.moves[0].notation == "..."
630 ? 1
631 : 0;
632 if (this.cursor < minCursor) return; //no more moves
633 move = this.moves[this.cursor];
634 }
635 this.$refs["board"].resetCurrentAttempt();
636 undoMove(move, this.vr);
637 if (light) this.cursor--;
638 else {
639 this.positionCursorTo(this.cursor - 1);
640 this.incheck = this.vr.getCheckSquares();
641 this.emitFenIfAnalyze();
642 }
643 }
644 },
645 gotoMove: function(index) {
646 if (
647 this.autoplay ||
648 !!this.$refs["board"].selectedPiece ||
649 this.$refs["board"].choices.length > 0
650 ) {
651 return;
652 }
653 this.$refs["board"].resetCurrentAttempt();
654 if (this.inMultimove) this.cancelCurrentMultimove();
655 if (index == this.cursor) return;
656 if (index < this.cursor) {
657 while (this.cursor > index)
658 this.undo(null, null, "light");
659 }
660 else {
661 // index > this.cursor)
662 while (this.cursor < index)
663 this.play(null, null, "light");
664 }
665 // NOTE: next line also re-assign cursor, but it's very light
666 this.positionCursorTo(index);
667 this.incheck = this.vr.getCheckSquares();
668 this.emitFenIfAnalyze();
669 },
670 gotoBegin: function() {
671 if (
672 this.autoplay ||
673 !!this.$refs["board"].selectedPiece ||
674 this.$refs["board"].choices.length > 0
675 ) {
676 return;
677 }
678 this.$refs["board"].resetCurrentAttempt();
679 if (this.inMultimove) this.cancelCurrentMultimove();
680 const minCursor =
681 this.moves.length > 0 && this.moves[0].notation == "..."
682 ? 1
683 : 0;
684 while (this.cursor >= minCursor) this.undo(null, null, "light");
685 this.lastMove = (minCursor == 1 ? this.moves[0] : null);
686 this.incheck = this.vr.getCheckSquares();
687 this.emitFenIfAnalyze();
688 },
689 gotoEnd: function() {
690 if (this.cursor == this.moves.length - 1) return;
691 this.gotoMove(this.moves.length - 1);
692 },
693 flip: function() {
694 if (this.$refs["board"].choices.length > 0) return;
695 this.orientation = V.GetOppCol(this.orientation);
696 }
697 }
698 };
699 </script>
700
701 <style lang="sass" scoped>
702 [type="checkbox"]#modalEog+div .card
703 min-height: 45px
704 max-width: 350px
705
706 #baseGame
707 width: 100%
708 &:focus
709 outline: none
710
711 #gameContainer
712 margin-left: auto
713 margin-right: auto
714
715 #downloadDiv
716 display: inline-block
717
718 #controls
719 user-select: none
720 button
721 border: none
722 margin: 0
723 padding-top: 5px
724 padding-bottom: 5px
725
726 p#fenAnalyze
727 margin: 5px
728
729 .in-autoplay
730 background-color: #FACF8C
731
732 img.inline
733 height: 22px
734 padding-top: 5px
735 @media screen and (max-width: 767px)
736 height: 18px
737
738 #turnIndicator
739 text-align: center
740 font-weight: bold
741
742 #boardContainer
743 float: left
744 // TODO: later, maybe, allow movesList of variable width
745 // or e.g. between 250 and 350px (but more complicated)
746
747 #movesList
748 width: 280px
749 float: left
750
751 @media screen and (max-width: 767px)
752 #movesList
753 width: 100%
754 float: none
755 clear: both
756 </style>