]> git.sesse.net Git - remoteglot-book/blobdiff - www/js/book.js
Add support for flipping the board.
[remoteglot-book] / www / js / book.js
index dce293b2a8e70392d083b271b68fac7b5fa63059..8785a3454cbb385079b99ee7b0577ee2c50c5d3a 100644 (file)
@@ -281,6 +281,11 @@ var set_includetransp = function(value) {
 }
 window['set_includetransp'] = set_includetransp;
 
+var set_flipboard = function(value) {
+       board.orientation(value ? 'black' : 'white');
+}
+window['set_flipboard'] = set_flipboard;
+
 var make_move = function(move, do_update) {
        var history = game.history({ verbose: true });
        if (move_override < history.length && history[move_override].san == move) {
@@ -534,8 +539,10 @@ var init = function() {
                        prev_move();
                }
        });
-}
 
+       // Seemingly the web worker is not started before we send it a message.
+       stockfish.postMessage("uci");
+}
 
 $(document).ready(init);