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