X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;ds=sidebyside;f=www%2Fjs%2Fremoteglot.js;h=1e899298cef2997c7392376d1fc8126c78ed1cd0;hb=a3baa02379ebf758b5a5a937ecee335c0e780e4c;hp=4ff9d6429756fb325dd93c194392b6dc6bf46f99;hpb=3a8a3682f658b1fd5f1ae8420230a356f57fc0ad;p=remoteglot diff --git a/www/js/remoteglot.js b/www/js/remoteglot.js index 4ff9d64..1e89929 100644 --- a/www/js/remoteglot.js +++ b/www/js/remoteglot.js @@ -298,7 +298,9 @@ var request_update = function() { } // Next update. - current_analysis_request_timer = setTimeout(function() { request_update(); }, timeout); + if (!backend_url.match(/history/)) { + current_analysis_request_timer = setTimeout(function() { request_update(); }, timeout); + } }).fail(function(jqXHR, textStatus, errorThrown) { if (textStatus === "abort") { // Aborted because we are switching backends. Abandon and don't retry, @@ -794,7 +796,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) }); @@ -938,6 +940,18 @@ var update_game_list = function(games) { * and switch to it if we're not already displaying it. */ var possibly_switch_game_from_hash = function() { + var history_match = window.location.hash.match(/^#history=([a-zA-Z0-9_-]+)/); + if (history_match !== null) { + var game_id = history_match[1]; + var fake_game = { + url: '/history/' + game_id + '.json', + hashurl: '', + id: 'history=' + game_id + }; + switch_backend(fake_game); + return; + } + if (current_games === null) { return; } @@ -2241,6 +2255,7 @@ var init = function() { } }); window.addEventListener('hashchange', possibly_switch_game_from_hash, false); + possibly_switch_game_from_hash(); }; $(document).ready(init);