]> git.sesse.net Git - remoteglot-book/blobdiff - www/js/book.js
Show game history under the board.
[remoteglot-book] / www / js / book.js
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();