From 58d914e35db0320e76e6d26b1f1075a1f4867f93 Mon Sep 17 00:00:00 2001 From: "Steinar H. Gunderson" Date: Sat, 23 Nov 2013 21:22:40 +0100 Subject: [PATCH] Stop sending board around all the time. --- www/js/remoteglot.js | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/www/js/remoteglot.js b/www/js/remoteglot.js index 0b7a602..4c79edf 100644 --- a/www/js/remoteglot.js +++ b/www/js/remoteglot.js @@ -18,17 +18,17 @@ var display_lines = []; var current_display_line = null; var current_display_move = null; -var request_update = function(board) { +var request_update = function() { $.ajax({ url: "http://analysis.sesse.net/analysis.pl?ims=" + ims + "&unique=" + unique //url: "http://analysis.sesse.net:5000/analysis.pl?ims=" + ims + "&unique=" + unique }).done(function(data, textstatus, xhr) { ims = xhr.getResponseHeader('X-Remoteglot-Last-Modified'); var num_viewers = xhr.getResponseHeader('X-Remoteglot-Num-Viewers'); - update_board(board, data, num_viewers); + update_board(data, num_viewers); }).fail(function() { // Wait ten seconds, then try again. - setTimeout(function() { request_update(board); }, 10000); + setTimeout(function() { request_update(); }, 10000); }); } @@ -318,7 +318,7 @@ var update_highlight = function() { } } -var update_refutation_lines = function(board) { +var update_refutation_lines = function() { if (display_lines.length > 1) { display_lines = [ display_lines[0] ]; } @@ -375,7 +375,7 @@ var update_refutation_lines = function(board) { } } -var update_board = function(board, data, num_viewers) { +var update_board = function(data, num_viewers) { display_lines = []; // The headline. @@ -494,15 +494,15 @@ var update_board = function(board, data, num_viewers) { move_num = data['position']['move_num']; toplay = data['position']['toplay']; refutation_lines = data['refutation_lines']; - update_refutation_lines(board); + update_refutation_lines(); // Next update. - setTimeout(function() { request_update(board); }, 100); + setTimeout(function() { request_update(); }, 100); } var resort_refutation_lines = function(sort_by_score) { sort_refutation_lines_by_score = sort_by_score; - update_refutation_lines(board); + update_refutation_lines(); } window['resort_refutation_lines'] = resort_refutation_lines; @@ -568,7 +568,7 @@ var init = function() { board = new window.ChessBoard('board', 'start'); hiddenboard = new window.ChessBoard('hiddenboard', 'start'); - request_update(board); + request_update(); $(window).resize(function() { board.resize(); update_highlight(); -- 2.39.2