+var update_historic_analysis = function() {
+ if (!current_display_line_is_history) {
+ return;
+ }
+ if (current_display_move == current_display_line.pretty_pv.length - 1) {
+ displayed_analysis_data = null;
+ update_board(current_analysis_data, displayed_analysis_data);
+ }
+
+ // Fetch old analysis for this line if it exists.
+ var hiddenboard = new Chess();
+ for (var i = 0; i <= current_display_move; ++i) {
+ hiddenboard.move(ucimove_to_chessjs_move(current_display_line.uci_pv[i]));
+ }
+ var filename = "/history/move" + (current_display_move + 1) + "-" +
+ hiddenboard.fen().replace(/ /g, '_').replace(/\//g, '-') + ".json";
+
+ $.ajax({
+ url: filename
+ }).done(function(data, textstatus, xhr) {
+ displayed_analysis_data = data;
+ update_board(current_analysis_data, displayed_analysis_data);
+ }).fail(function() {
+ displayed_analysis_data = {'failed': true};
+ update_board(current_analysis_data, displayed_analysis_data);
+ });
+}
+