]> git.sesse.net Git - remoteglot-book/commitdiff
Fix history display with dropped pieces.
authorSteinar H. Gunderson <sgunderson@bigfoot.com>
Sat, 13 Dec 2014 23:52:00 +0000 (00:52 +0100)
committerSteinar H. Gunderson <sgunderson@bigfoot.com>
Sat, 13 Dec 2014 23:52:00 +0000 (00:52 +0100)
www/js/book.js

index 9a2456ee6c081ca911681a2bb40f8c3b3555a2ec..611678f8f99c52a3e73ea53241e31b88766dd24c 100644 (file)
@@ -280,8 +280,13 @@ var onDrop = function(source, target) {
        // illegal move
        if (move === null) return 'snapback';
 
-       history = game.history({ verbose: true });
+       var new_history = game.history({ verbose: true });
+       history = [];
+       for (var i = 0; i < new_history.length; ++i) {
+               history.push(new_history[i].san);
+       }
        move_override = history.length;
+       update();
 };
 
 // update the board position after the piece snap