From ef20c7b10b72bf9dbad4e2507e994b19229701ea Mon Sep 17 00:00:00 2001 From: "Steinar H. Gunderson" Date: Sun, 14 Dec 2014 00:08:50 +0100 Subject: [PATCH] Rename the moves variable so it doesn't clash anymore. --- www/js/book.js | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/www/js/book.js b/www/js/book.js index 0b1e437..d95b6e8 100644 --- a/www/js/book.js +++ b/www/js/book.js @@ -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 -- 2.39.2