]> git.sesse.net Git - remoteglot/blobdiff - www/js/remoteglot.js
Fix issue where the arrow keys could cause us to go out of bounds.
[remoteglot] / www / js / remoteglot.js
index fe5d266a672f71ee1aaccad7f8a34e4f906dabac..cb38ebe91e5ea6413a236277effd25475e1d30c4 100644 (file)
@@ -518,6 +518,11 @@ var update_board = function(data, num_viewers) {
                $("#numviewers").text(num_viewers + " current viewers");
        }
 
+       // The engine id.
+       if (data['id'] && data['id']['name'] !== null) {
+               $("#engineid").text(data['id']['name']);
+       }
+
        // The score.
        if (data['score'] !== null) {
                $("#score").text(data['score']);
@@ -646,13 +651,17 @@ var show_line = function(line_num, move_num) {
 window['show_line'] = show_line;
 
 var prev_move = function() {
-       --current_display_move;
+       if (current_display_move > 0) {
+               --current_display_move;
+       }
        update_displayed_line();
 }
 window['prev_move'] = prev_move;
 
 var next_move = function() {
-       ++current_display_move;
+       if (current_display_line && current_display_move < current_display_line.pretty_pv.length - 1) {
+               ++current_display_move;
+       }
        update_displayed_line();
 }
 window['next_move'] = next_move;