+ var text = "";
+ var history = game.history({ verbose: true });
+ for (var i = 0; i < history.length; ++i) {
+ if (i % 2 == 0) {
+ text += (i/2 + 1) + ". ";
+ }
+ if (i + 1 == move_override) {
+ text += '<strong>' + history[i].san + '</strong>';
+ } else {
+ text += '<a href="javascript:set_move(' + (i + 1) + ')">' + history[i].san + '</a>';
+ }
+ text += " ";
+ }
+ $('#gamehistory').html(text);
+
+ if (board.fen() != current_display_fen()) {
+ board.position(current_display_fen());
+ }
+
+ if (move_override > 0) {
+ var last_move = history[move_override - 1];
+ var highlight_from = last_move.from;
+ var highlight_to = last_move.to;
+ $("#board").find('.square-55d63').removeClass('nonuglyhighlight');
+ $("#board").find('.square-' + highlight_from).addClass('nonuglyhighlight');
+ $("#board").find('.square-' + highlight_to).addClass('nonuglyhighlight');
+ }
+