]> git.sesse.net Git - remoteglot-book/commitdiff
Rename the moves variable so it doesn't clash anymore.
authorSteinar H. Gunderson <sgunderson@bigfoot.com>
Sat, 13 Dec 2014 23:08:50 +0000 (00:08 +0100)
committerSteinar H. Gunderson <sgunderson@bigfoot.com>
Sat, 13 Dec 2014 23:08:50 +0000 (00:08 +0100)
www/js/book.js

index 0b1e4372264a7afa77d9cae8dbdf0c5bfbf464e2..d95b6e8acdd6e3f1040b76d78ac80b05ed55c274 100644 (file)
@@ -1,7 +1,7 @@
 (function() {
 
 var board = null;
-var moves = [];
+var history = [];
 var move_override = 0;
 
 var entity_map = {
@@ -21,7 +21,7 @@ function escape_html(string) {
 var get_game = function() {
        var game = new Chess();
        for (var i = 0; i < move_override; ++i) {
-               game.move(moves[i]);
+               game.move(history[i]);
        }
        return game;
 }
@@ -206,9 +206,9 @@ var show_lines = function(data, game) {
 }
 
 var make_move = function(move) {
-       moves.length = move_override;
-       moves.push(move);
-       move_override = moves.length;
+       history.length = move_override;
+       history.push(move);
+       move_override = history.length;
        update();
 }
 window['make_move'] = make_move;
@@ -222,7 +222,7 @@ var prev_move = function() {
 window['prev_move'] = prev_move;
 
 var next_move = function() {
-       if (move_override < moves.length) {
+       if (move_override < history.length) {
                ++move_override;
                update();
        }
@@ -251,8 +251,8 @@ var onDrop = function(source, target) {
        // illegal move
        if (move === null) return 'snapback';
 
-       moves = game.history({ verbose: true });
-       move_override = moves.length;
+       history = game.history({ verbose: true });
+       move_override = history.length;
 };
 
 // update the board position after the piece snap