]> git.sesse.net Git - remoteglot-book/commitdiff
Show game history under the board.
authorSteinar H. Gunderson <sgunderson@bigfoot.com>
Sat, 13 Dec 2014 23:43:43 +0000 (00:43 +0100)
committerSteinar H. Gunderson <sgunderson@bigfoot.com>
Sat, 13 Dec 2014 23:43:43 +0000 (00:43 +0100)
www/book.html
www/js/book.js

index 9a760b300e8f7b27817f9c937fbaa0ae18534584..cb5a07fe62444ccbcb980a68304641903eafe95e 100644 (file)
@@ -18,6 +18,7 @@
     <p id="blackclock"><a href="javascript:next_move()">&gt;&gt;&gt;</a></p>
     <p id="numviewers"></p>
     <p id="gamesummary"></p>
+    <p id="gamehistory"></p>
   </div>
 </div>
 <div id="analysis">
index fff27fc1f0a7a4756481a0725fcb55040ccc7ff0..2c5af12dc09f22530f67d0479329584e0fc66ed4 100644 (file)
@@ -27,6 +27,20 @@ var get_game = function() {
 }
 
 var update = function() {
+       var text = "";
+       for (var i = 0; i < history.length; ++i) {
+               if (i % 2 == 0) {
+                       text += (i/2 + 1) + ". ";
+               }
+               if (i == move_override) {
+                       text += '<strong>' + history[i] + '</strong>';
+               } else {
+                       text += history[i];
+               }
+               text += " ";
+       }
+       $('#gamehistory').html(text);
+
        var game = get_game();
        board.position(game.fen());
        fetch_analysis();