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