* @type {Number}
* @const
* @private */
-var SCRIPT_VERSION = 2016091401;
+var SCRIPT_VERSION = 2016113002;
/**
* The current backend URL.
headline += ' after ' + last_move;
}
} else if (data['position']['last_move'] !== 'none') {
+ // Find the previous move.
+ var previous_move_num, previous_toplay;
+ if (data['position']['toplay'] == 'B') {
+ previous_move_num = data['position']['move_num'];
+ previous_toplay = 'W';
+ } else {
+ previous_move_num = data['position']['move_num'] - 1;
+ previous_toplay = 'B';
+ }
+
last_move = format_move_with_number(
data['position']['last_move'],
- data['position']['move_num'],
- data['position']['toplay'] == 'B');
+ previous_move_num,
+ previous_toplay == 'W');
headline += ' after ' + last_move;
} else {
last_move = null;
for (var i = 1; i < alt_moves.length && i < 3; ++i) {
hiddenboard = new Chess(base_fen);
var move = hiddenboard.move(alt_moves[i]);
- create_arrow(move.from, move.to, '#f66', 1, 10);
+ if (move !== null) {
+ create_arrow(move.from, move.to, '#f66', 1, 10);
+ }
}
}
return format_tooltip(data, fields[0].offset + first_move_num - 1);
}
});
+ $('#scorespark').bind('sparklineClick', function(event) {
+ var sparkline = event.sparklines[0];
+ var region = sparkline.getCurrentRegionFields();
+ if (region[0].offset !== undefined) {
+ show_line(0, first_move_num + region[0].offset - 1);
+ }
+ });
} else {
$("#scorespark").text("");
}
return;
}
- // If either player has ten minutes or less left, add the second counters.
- var show_seconds = (white_clock_ms < 60 * 10 * 1000 || black_clock_ms < 60 * 10 * 1000);
+ // If either player has twenty minutes or less left, add the second counters.
+ // This matches what DGT clocks do.
+ var show_seconds = (white_clock_ms < 60 * 20 * 1000 || black_clock_ms < 60 * 20 * 1000);
if (color) {
// See when the clock will change next, and update right after that.