From 7cbb9defbbcd09abb5ffd0eab3d55b070701fe2c Mon Sep 17 00:00:00 2001
From: Jesse McDonald
Pawns are promoted when they reach the final row on the opposite side of the board, even if they were moved there by the other player as part of a joined pair.
+ diff --git a/js/chess.js b/js/chess.js index dec8dd5..601d837 100644 --- a/js/chess.js +++ b/js/chess.js @@ -919,6 +919,28 @@ $(function (){ }); }, 15000); + window.setInterval(function(){ + const peers = gun._.opt.peers; + var n_open = 0; + var n_total = 0; + for (const peerId in peers) { + ++n_total; + try { + const peer = peers[peerId]; + if (peer.constructor === RTCPeerConnection) { + if (peer.connectionState === 'connected') { + ++n_open; + } + } else if (peer.wire && peer.wire.constructor === WebSocket) { + if (peer.wire.readyState === peer.wire.OPEN) { + ++n_open; + } + } + } catch (err) {} + } + $('#cb_peers').text('Synchronizing with ' + n_open + (n_open === 1 ? ' peer' : ' peers') + ' (' + n_total + ' total).'); + }, 1000); + window.onpopstate = function(event){ var gameId = location.hash.replace(/^#\//, ''); if (gameId.length === 16) {