X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=www%2Fjs%2Fremoteglot.js;h=d6a08a875b8642332f76f6bf60222797eec36f6e;hb=0300e89e239df1e8385eb3294c9853381a71b519;hp=d89da33b3d5339f5b581c356ba2fb68af78f3389;hpb=6b412ffcd5797613037e4d69c39f8b4a3f0254f9;p=remoteglot diff --git a/www/js/remoteglot.js b/www/js/remoteglot.js index d89da33..d6a08a8 100644 --- a/www/js/remoteglot.js +++ b/www/js/remoteglot.js @@ -7,7 +7,7 @@ * @type {Number} * @const * @private */ -var SCRIPT_VERSION = 2016113007; +var SCRIPT_VERSION = 2016113008; /** * The current backend URL. @@ -294,7 +294,7 @@ var request_update = function() { update_num_viewers(num_viewers); } else { console.log("Received invalid update, waiting five seconds and trying again."); - location.reload(true); + setTimeout(function() { location.reload(true); }, 5000); } // Next update. @@ -780,6 +780,10 @@ var update_refutation_lines = function() { var tbl = $("#refutationlines"); tbl.empty(); + if (display_lines.length < 2) { + return; + } + // Find out where the lines start from. var base_line = []; var base_scores = display_lines[1].scores; @@ -796,7 +800,7 @@ var update_refutation_lines = function() { } var invert = (toplay === 'B'); - if (current_display_line && current_display_move % 2 == 0) { + if (current_display_line && current_display_move % 2 == 0 && !current_display_line_is_history) { invert = !invert; } moves = moves.sort(function(a, b) { return compare_by_score(refutation_lines, invert, a, b) }); @@ -1260,7 +1264,7 @@ var update_board = function() { if (!data['refutation_lines'] || !data['refutation_lines'][nonstupid_moves[i]] || !data['refutation_lines'][nonstupid_moves[i]]['pv'] || - data['refutation_lines'][nonstupid_moves[i]]['pv'].length < 1) { + data['refutation_lines'][nonstupid_moves[i]]['pv'].length < 2) { // Incomplete PV, abort. response = undefined; break; @@ -1335,6 +1339,7 @@ var update_sparkline = function(data) { } // FIXME: at some widths, calling sparkline() seems to push // #scorecontainer under the board. + $('#scorespark').unbind('sparklineClick'); $("#scorespark").sparkline(scores, { type: 'bar', zeroColor: 'gray', @@ -1346,6 +1351,7 @@ var update_sparkline = function(data) { return format_tooltip(data, fields[0].offset + first_move_num - 1); } }); + $('#scorespark').unbind('sparklineClick'); $('#scorespark').bind('sparklineClick', function(event) { var sparkline = event.sparklines[0]; var region = sparkline.getCurrentRegionFields();