X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;ds=sidebyside;f=www%2Fjs%2Fremoteglot.js;h=0cca9fa3dbc1e58ee15718dc87f5f4b80ac2ccf1;hb=a87944ae9bedc34049b01e584b0a8ab7fccdc767;hp=6819cb99eea1c64812ab258bbe9c97a1d5d48644;hpb=3cd5b7514f30340adfd106469b6de44237af5113;p=remoteglot diff --git a/www/js/remoteglot.js b/www/js/remoteglot.js index 6819cb9..0cca9fa 100644 --- a/www/js/remoteglot.js +++ b/www/js/remoteglot.js @@ -123,7 +123,13 @@ var fen = null; * }} DisplayLine */ -/** @type {Array.} +/** All PVs that we currently know of. + * + * Element 0 is history (or null if no history). + * Element 1 is current main PV. + * All remaining elements are refutation lines (multi-PV). + * + * @type {Array.} * @private */ var display_lines = []; @@ -649,11 +655,16 @@ var collapse_history = function(truncate_history) { } window['collapse_history'] = collapse_history; +/** Update the HTML display of multi-PV from the global "refutation_lines". + * + * Also recreates the global "display_lines". + */ var update_refutation_lines = function() { if (fen === null) { return; } if (display_lines.length > 2) { + // Truncate so that only the history and PV is left. display_lines = [ display_lines[0], display_lines[1] ]; } @@ -710,6 +721,9 @@ var update_refutation_lines = function() { } /** + * Create a Chess.js board object, containing the given position plus the given moves, + * up to the given limit. + * * @param {?string} fen * @param {Array.} moves * @param {number} last_move