Advance on Chakart
[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 @redraw-board="redrawBoard"
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 redrawBoard: function() {
204 this.$refs["board"].re_setDrawings();
205 },
206 showRules: function() {
207 // The button is here only on Game page:
208 document.getElementById("modalRules").checked = true;
209 },
210 re_setVariables: function(game) {
211 if (!game) game = this.game; //in case of...
212 this.endgameMessage = "";
213 // "w": default orientation for observed games
214 this.orientation = game.mycolor || "w";
215 this.mode = game.mode || game.type; //TODO: merge...
216 this.moves = JSON.parse(JSON.stringify(game.moves || []));
217 // Post-processing: decorate each move with notation and FEN
218 this.vr = new V(game.fenStart);
219 this.inMultimove = false; //in case of
220 if (!!this.$refs["board"])
221 // Also in case of:
222 this.$refs["board"].resetCurrentAttempt();
223 let analyseBtn = document.getElementById("analyzeBtn");
224 if (!!analyseBtn) analyseBtn.classList.remove("active");
225 const parsedFen = V.ParseFen(game.fenStart);
226 const firstMoveColor = parsedFen.turn;
227 this.firstMoveNumber = Math.floor(parsedFen.movesCount / 2) + 1;
228 let L = this.moves.length;
229 if (L == 0) {
230 // Could be started on a random position in analysis mode:
231 this.incheck = this.vr.getCheckSquares();
232 this.score = this.vr.getCurrentScore();
233 if (this.score != '*') {
234 // Show score on screen
235 const message = getScoreMessage(this.score);
236 this.showEndgameMsg(this.score + " . " + this.st.tr[message]);
237 }
238 }
239 else {
240 this.moves.forEach((move,idx) => {
241 // Strategy working also for multi-moves:
242 if (!Array.isArray(move)) move = [move];
243 const Lm = move.length;
244 move.forEach((m,idxM) => {
245 m.notation = this.vr.getNotation(m);
246 m.unambiguous = V.GetUnambiguousNotation(m);
247 this.vr.play(m);
248 const checkSquares = this.vr.getCheckSquares();
249 if (checkSquares.length > 0) m.notation += "+";
250 if (idxM == Lm - 1) m.fen = this.vr.getFen();
251 if (idx == L - 1 && idxM == Lm - 1) {
252 this.incheck = checkSquares;
253 this.score = this.vr.getCurrentScore();
254 if (["1-0", "0-1"].includes(this.score)) m.notation += "#";
255 }
256 });
257 });
258 }
259 if (firstMoveColor == "b") {
260 // 'start' & 'end' is required for Board component
261 this.moves.unshift({
262 notation: "...",
263 unambiguous: "...",
264 start: { x: -1, y: -1 },
265 end: { x: -1, y: -1 },
266 fen: game.fenStart
267 });
268 L++;
269 }
270 this.positionCursorTo(L - 1);
271 },
272 positionCursorTo: function(index) {
273 this.cursor = index;
274 // Note: last move in moves array might be a multi-move
275 if (index >= 0) this.lastMove = this.moves[index];
276 else this.lastMove = null;
277 },
278 toggleAnalyze: function() {
279 // Freeze while choices are shown (and autoplay has priority)
280 if (
281 this.inPlay ||
282 this.$refs["board"].choices.length > 0 ||
283 this.autoplay
284 ) {
285 return;
286 }
287 if (this.mode != "analyze") {
288 // Enter analyze mode:
289 this.mode = "analyze";
290 if (this.inMultimove) this.cancelCurrentMultimove();
291 this.gameMode = this.mode; //was not 'analyze'
292 this.gameCursor = this.cursor;
293 this.gameMoves = JSON.parse(JSON.stringify(this.moves));
294 document.getElementById("analyzeBtn").classList.add("active");
295 }
296 else {
297 // Exit analyze mode:
298 this.mode = this.gameMode ;
299 this.cursor = this.gameCursor;
300 this.moves = this.gameMoves;
301 let fen = this.game.fenStart;
302 if (this.cursor >= 0) {
303 let mv = this.moves[this.cursor];
304 if (!Array.isArray(mv)) mv = [mv];
305 fen = mv[mv.length-1].fen;
306 }
307 this.vr = new V(fen);
308 this.inMultimove = false; //in case of
309 this.$refs["board"].resetCurrentAttempt(); //also in case of
310 this.incheck = this.vr.getCheckSquares();
311 if (this.cursor >= 0) this.lastMove = this.moves[this.cursor];
312 else this.lastMove = null;
313 document.getElementById("analyzeBtn").classList.remove("active");
314 }
315 },
316 download: function() {
317 const content = this.getPgn();
318 // Prepare and trigger download link
319 let downloadAnchor = document.getElementById("download");
320 downloadAnchor.setAttribute("download", "game.pgn");
321 downloadAnchor.href =
322 "data:text/plain;charset=utf-8," + encodeURIComponent(content);
323 downloadAnchor.click();
324 },
325 getPgn: function() {
326 let pgn = "";
327 pgn += '[Site "vchess.club"]\n';
328 pgn += '[Variant "' + this.game.vname + '"]\n';
329 const gdt = getDate(new Date(this.game.created || Date.now()));
330 pgn += '[Date "' + gdt + '"]\n';
331 pgn += '[White "' + this.game.players[0].name + '"]\n';
332 pgn += '[Black "' + this.game.players[1].name + '"]\n';
333 pgn += '[Fen "' + this.game.fenStart + '"]\n';
334 pgn += '[Result "' + this.game.score + '"]\n';
335 if (!!this.game.id)
336 pgn += '[Url "' + params.serverUrl + '/game/' + this.game.id + '"]\n';
337 if (!!this.game.cadence)
338 pgn += '[Cadence "' + this.game.cadence + '"]\n';
339 pgn += '\n';
340 for (let i = 0; i < this.moves.length; i += 2) {
341 if (i > 0) pgn += " ";
342 // Adjust dots notation for a better display:
343 let fullNotation = getFullNotation(this.moves[i]);
344 if (fullNotation == "...") fullNotation = "..";
345 pgn += (i / 2 + this.firstMoveNumber) + "." + fullNotation;
346 if (i+1 < this.moves.length)
347 pgn += " " + getFullNotation(this.moves[i+1]);
348 }
349 pgn += "\n\n";
350 for (let i = 0; i < this.moves.length; i += 2) {
351 const moveNumber = i / 2 + this.firstMoveNumber;
352 // Skip "dots move", useless for machine reading:
353 if (this.moves[i].notation != "...") {
354 pgn += moveNumber + ".w " +
355 getFullNotation(this.moves[i], "unambiguous") + "\n";
356 }
357 if (i+1 < this.moves.length) {
358 pgn += moveNumber + ".b " +
359 getFullNotation(this.moves[i+1], "unambiguous") + "\n";
360 }
361 }
362 return pgn;
363 },
364 showEndgameMsg: function(message) {
365 this.endgameMessage = message;
366 document.getElementById("modalEog").checked = true;
367 },
368 runAutoplay: function() {
369 if (this.autoplay) {
370 this.autoplay = false;
371 if (this.stackToPlay.length > 0)
372 // Move(s) arrived in-between
373 this.play(this.stackToPlay.pop(), "received");
374 }
375 else if (this.cursor < this.moves.length - 1) {
376 this.autoplay = true;
377 this.play(null, null, null, "autoplay");
378 }
379 },
380 // Animate an elementary move
381 animateMove: function(move, callback) {
382 let startSquare = document.getElementById(getSquareId(move.start));
383 if (!startSquare) return; //shouldn't happen but...
384 let endSquare = document.getElementById(getSquareId(move.end));
385 let rectStart = startSquare.getBoundingClientRect();
386 let rectEnd = endSquare.getBoundingClientRect();
387 let translation = {
388 x: rectEnd.x - rectStart.x,
389 y: rectEnd.y - rectStart.y
390 };
391 let movingPiece = document.querySelector(
392 "#" + getSquareId(move.start) + " > img.piece"
393 );
394 // For some unknown reasons Opera get "movingPiece == null" error
395 // TODO: is it calling 'animate()' twice ? One extra time ?
396 if (!movingPiece) return;
397 const squares = document.getElementsByClassName("board");
398 for (let i = 0; i < squares.length; i++) {
399 let square = squares.item(i);
400 if (square.id != getSquareId(move.start))
401 // HACK for animation:
402 // (with positive translate, image slides "under background")
403 square.style.zIndex = "-1";
404 }
405 movingPiece.style.transform =
406 "translate(" + translation.x + "px," + translation.y + "px)";
407 movingPiece.style.transitionDuration = "0.25s";
408 movingPiece.style.zIndex = "3000";
409 setTimeout(() => {
410 for (let i = 0; i < squares.length; i++)
411 squares.item(i).style.zIndex = "auto";
412 movingPiece.style = {}; //required e.g. for 0-0 with KR swap
413 callback();
414 }, 250);
415 },
416 // For Analyse mode:
417 emitFenIfAnalyze: function() {
418 if (this.game.mode == "analyze") {
419 let fen = this.game.fenStart;
420 if (!!this.lastMove) {
421 if (Array.isArray(this.lastMove)) {
422 const L = this.lastMove.length;
423 fen = this.lastMove[L-1].fen;
424 }
425 else fen = this.lastMove.fen;
426 }
427 this.$emit("fenchange", fen);
428 }
429 },
430 clickSquare: function(square) {
431 // Some variants make use of a single click at specific times:
432 const move = this.vr.doClick(square);
433 if (!!move) this.play(move);
434 },
435 // "light": if gotoMove() or gotoEnd()
436 play: function(move, received, light, autoplay) {
437 // Freeze while choices are shown:
438 if (
439 !!this.$refs["board"].selectedPiece ||
440 this.$refs["board"].choices.length > 0
441 ) {
442 return;
443 }
444 const navigate = !move;
445 // Forbid navigation during autoplay:
446 if (navigate && this.autoplay && !autoplay) return;
447 // Forbid playing outside analyze mode, except if move is received.
448 // Sufficient condition because Board already knows which turn it is.
449 if (
450 this.mode != "analyze" &&
451 !navigate &&
452 !received &&
453 (this.game.score != "*" || this.cursor < this.moves.length - 1)
454 ) {
455 return;
456 }
457 if (!!received) {
458 if (this.autoplay || this.inPlay) {
459 // Received moves while autoplaying are stacked,
460 // and in observed games they could arrive too fast:
461 this.stackToPlay.unshift(move);
462 return;
463 }
464 this.inPlay = true;
465 if (this.mode == "analyze") this.toggleAnalyze();
466 if (this.cursor < this.moves.length - 1)
467 // To play a received move, cursor must be at the end of the game:
468 this.gotoEnd();
469 }
470 // The board may show some possible moves: (TODO: bad solution)
471 this.$refs["board"].resetCurrentAttempt();
472 const playSubmove = (smove) => {
473 smove.notation = this.vr.getNotation(smove);
474 smove.unambiguous = V.GetUnambiguousNotation(smove);
475 this.vr.play(smove);
476 if (this.inMultimove && !!this.lastMove) {
477 if (!Array.isArray(this.lastMove))
478 this.lastMove = [this.lastMove, smove];
479 else this.lastMove.push(smove);
480 }
481 // Is opponent (or me) in check?
482 this.incheck = this.vr.getCheckSquares();
483 if (this.incheck.length > 0) smove.notation += "+";
484 if (!this.inMultimove) {
485 // First sub-move:
486 this.lastMove = smove;
487 // Condition is "!navigate" but we mean "!this.autoplay"
488 if (!navigate) {
489 if (this.cursor < this.moves.length - 1)
490 this.moves = this.moves.slice(0, this.cursor + 1);
491 this.moves.push(smove);
492 }
493 this.inMultimove = true; //potentially
494 this.cursor++;
495 } else if (!navigate) {
496 // Already in the middle of a multi-move
497 const L = this.moves.length;
498 if (!Array.isArray(this.moves[L-1]))
499 this.$set(this.moves, L-1, [this.moves[L-1], smove]);
500 else this.moves[L-1].push(smove);
501 }
502 };
503 const playMove = () => {
504 const animate = (
505 ["all", "highlight"].includes(V.ShowMoves) &&
506 (this.autoplay || !!received)
507 );
508 if (!Array.isArray(move)) move = [move];
509 let moveIdx = 0;
510 let self = this;
511 const initurn = this.vr.turn;
512 (function executeMove() {
513 const smove = move[moveIdx++];
514 // NOTE: condition "smove.start.x >= 0" required for Dynamo,
515 // because second move may be empty.
516 if (animate && smove.start.x >= 0) {
517 self.animateMove(smove, () => {
518 playSubmove(smove);
519 if (moveIdx < move.length) setTimeout(executeMove, 500);
520 else afterMove(smove, initurn);
521 });
522 } else {
523 playSubmove(smove);
524 if (moveIdx < move.length) executeMove();
525 else afterMove(smove, initurn);
526 }
527 })();
528 };
529 const computeScore = () => {
530 const score = this.vr.getCurrentScore();
531 if (!navigate) {
532 if (["1-0", "0-1"].includes(score)) {
533 if (Array.isArray(this.lastMove)) {
534 const L = this.lastMove.length;
535 this.lastMove[L - 1].notation += "#";
536 }
537 else this.lastMove.notation += "#";
538 }
539 }
540 if (score != "*" && ["analyze", "versus"].includes(this.mode)) {
541 const message = getScoreMessage(score);
542 // Show score on screen
543 this.showEndgameMsg(score + " . " + this.st.tr[message]);
544 }
545 return score;
546 };
547 const afterMove = (smove, initurn) => {
548 if (this.vr.turn != initurn) {
549 // Turn has changed: move is complete
550 if (!smove.fen)
551 // NOTE: only FEN of last sub-move is required (=> setting it here)
552 smove.fen = this.vr.getFen();
553 this.emitFenIfAnalyze();
554 this.inMultimove = false;
555 this.score = computeScore();
556 if (this.autoplay) {
557 if (this.cursor < this.moves.length - 1)
558 setTimeout(() => this.play(null, null, null, "autoplay"), 1000);
559 else {
560 this.autoplay = false;
561 if (this.stackToPlay.length > 0)
562 // Move(s) arrived in-between
563 this.play(this.stackToPlay.pop(), "received");
564 }
565 }
566 if (this.mode != "analyze" && !navigate) {
567 if (!received) {
568 // Post-processing (e.g. computer play).
569 const L = this.moves.length;
570 // NOTE: always emit the score, even in unfinished
571 this.$emit("newmove", this.moves[L-1], { score: this.score });
572 } else {
573 this.inPlay = false;
574 if (this.stackToPlay.length > 0)
575 // Move(s) arrived in-between
576 this.play(this.stackToPlay.pop(), "received");
577 }
578 }
579 }
580 };
581 // NOTE: navigate and received are mutually exclusive
582 if (navigate) {
583 // The move to navigate to is necessarily full:
584 if (this.cursor == this.moves.length - 1) return; //no more moves
585 move = this.moves[this.cursor + 1];
586 if (!this.autoplay) {
587 // Just play the move:
588 if (!Array.isArray(move)) move = [move];
589 for (let i=0; i < move.length; i++) this.vr.play(move[i]);
590 if (!light) {
591 this.lastMove = move;
592 this.incheck = this.vr.getCheckSquares();
593 this.score = computeScore();
594 this.emitFenIfAnalyze();
595 }
596 this.cursor++;
597 return;
598 }
599 }
600 playMove();
601 },
602 cancelCurrentMultimove: function() {
603 const L = this.moves.length;
604 let move = this.moves[L-1];
605 if (!Array.isArray(move)) move = [move];
606 for (let i = move.length - 1; i >= 0; i--) this.vr.undo(move[i]);
607 this.moves.pop();
608 this.cursor--;
609 this.inMultimove = false;
610 },
611 cancelLastMove: function() {
612 // The last played move was canceled (corr game)
613 this.undo();
614 this.moves.pop();
615 },
616 // "light": if gotoMove() or gotoBegin()
617 undo: function(move, light) {
618 if (
619 this.autoplay ||
620 !!this.$refs["board"].selectedPiece ||
621 this.$refs["board"].choices.length > 0
622 ) {
623 return;
624 }
625 this.$refs["board"].resetCurrentAttempt();
626 if (this.inMultimove) {
627 this.cancelCurrentMultimove();
628 this.incheck = this.vr.getCheckSquares();
629 if (this.cursor >= 0) this.lastMove = this.moves[this.cursor];
630 else this.lastMove = null;
631 } else {
632 if (!move) {
633 const minCursor =
634 this.moves.length > 0 && this.moves[0].notation == "..."
635 ? 1
636 : 0;
637 if (this.cursor < minCursor) return; //no more moves
638 move = this.moves[this.cursor];
639 }
640 this.$refs["board"].resetCurrentAttempt();
641 undoMove(move, this.vr);
642 if (light) this.cursor--;
643 else {
644 this.positionCursorTo(this.cursor - 1);
645 this.incheck = this.vr.getCheckSquares();
646 this.emitFenIfAnalyze();
647 }
648 }
649 },
650 gotoMove: function(index) {
651 if (
652 this.autoplay ||
653 !!this.$refs["board"].selectedPiece ||
654 this.$refs["board"].choices.length > 0
655 ) {
656 return;
657 }
658 this.$refs["board"].resetCurrentAttempt();
659 if (this.inMultimove) this.cancelCurrentMultimove();
660 if (index == this.cursor) return;
661 if (index < this.cursor) {
662 while (this.cursor > index)
663 this.undo(null, null, "light");
664 }
665 else {
666 // index > this.cursor)
667 while (this.cursor < index)
668 this.play(null, null, "light");
669 }
670 // NOTE: next line also re-assign cursor, but it's very light
671 this.positionCursorTo(index);
672 this.incheck = this.vr.getCheckSquares();
673 this.emitFenIfAnalyze();
674 },
675 gotoBegin: function() {
676 if (
677 this.autoplay ||
678 !!this.$refs["board"].selectedPiece ||
679 this.$refs["board"].choices.length > 0
680 ) {
681 return;
682 }
683 this.$refs["board"].resetCurrentAttempt();
684 if (this.inMultimove) this.cancelCurrentMultimove();
685 const minCursor =
686 this.moves.length > 0 && this.moves[0].notation == "..."
687 ? 1
688 : 0;
689 while (this.cursor >= minCursor) this.undo(null, null, "light");
690 this.lastMove = (minCursor == 1 ? this.moves[0] : null);
691 this.incheck = this.vr.getCheckSquares();
692 this.emitFenIfAnalyze();
693 },
694 gotoEnd: function() {
695 if (this.cursor == this.moves.length - 1) return;
696 this.gotoMove(this.moves.length - 1);
697 },
698 flip: function() {
699 if (this.$refs["board"].choices.length > 0) return;
700 this.orientation = V.GetOppCol(this.orientation);
701 }
702 }
703 };
704 </script>
705
706 <style lang="sass" scoped>
707 [type="checkbox"]#modalEog+div .card
708 min-height: 45px
709 max-width: 350px
710
711 #baseGame
712 width: 100%
713 &:focus
714 outline: none
715
716 #gameContainer
717 margin-left: auto
718 margin-right: auto
719
720 #downloadDiv
721 display: inline-block
722
723 #controls
724 user-select: none
725 button
726 border: none
727 margin: 0
728 padding-top: 5px
729 padding-bottom: 5px
730
731 p#fenAnalyze
732 margin: 5px
733
734 .in-autoplay
735 background-color: #FACF8C
736
737 img.inline
738 height: 22px
739 padding-top: 5px
740 @media screen and (max-width: 767px)
741 height: 18px
742
743 #turnIndicator
744 text-align: center
745 font-weight: bold
746
747 #boardContainer
748 float: left
749 // TODO: later, maybe, allow movesList of variable width
750 // or e.g. between 250 and 350px (but more complicated)
751
752 #movesList
753 width: 280px
754 float: left
755
756 @media screen and (max-width: 767px)
757 #movesList
758 width: 100%
759 float: none
760 clear: both
761 </style>