From: Benjamin Auder Date: Sat, 7 Mar 2020 20:00:52 +0000 (+0100) Subject: Fix clocks update + abort games from MyGames page X-Git-Url: https://git.auder.net/images/assets/js/img/DESCRIPTION?a=commitdiff_plain;h=3b0f26c1261db7ea06067762c0c28b6dbacf2d99;p=vchess.git Fix clocks update + abort games from MyGames page --- diff --git a/client/src/components/GameList.vue b/client/src/components/GameList.vue index 0a8bd8ce..098efd06 100644 --- a/client/src/components/GameList.vue +++ b/client/src/components/GameList.vue @@ -150,7 +150,7 @@ export default { : "Abort and remove game?"; if (confirm(this.st.tr[message])) { const afterDelete = () => { - if (game.score == "*") this.$emit("abort", game); + if (game.score == "*") this.$emit("abortgame", game); this.$set(this.deleted, game.id, true); }; if (game.type == "live") diff --git a/client/src/translations/rules/Suction/en.pug b/client/src/translations/rules/Suction/en.pug index 05144e11..b2b3b744 100644 --- a/client/src/translations/rules/Suction/en.pug +++ b/client/src/translations/rules/Suction/en.pug @@ -27,7 +27,7 @@ p. h3 End of the game -p The goal is to "suck" the opponent's king to your own first rank. +p The goal is to attract the opponent's king to your own first rank. figure.diagram-container .diagram diff --git a/client/src/translations/rules/Suction/es.pug b/client/src/translations/rules/Suction/es.pug index 51db2d1b..351c67df 100644 --- a/client/src/translations/rules/Suction/es.pug +++ b/client/src/translations/rules/Suction/es.pug @@ -28,7 +28,7 @@ p. h3 Fin de la partida -p El objetivo es "absorber" al rey contrario a tu primera fila. +p El objetivo es atraer al rey contrario a tu primera fila. figure.diagram-container .diagram diff --git a/client/src/translations/rules/Suction/fr.pug b/client/src/translations/rules/Suction/fr.pug index 265cd749..b3c54032 100644 --- a/client/src/translations/rules/Suction/fr.pug +++ b/client/src/translations/rules/Suction/fr.pug @@ -28,7 +28,7 @@ p. h3 Fin de la partie -p Le but est d'"aspirer" le roi adverse jusqu'à votre première rangée. +p Le but est d'attirer le roi adverse jusqu'à votre première rangée. figure.diagram-container .diagram diff --git a/client/src/utils/gameStorage.js b/client/src/utils/gameStorage.js index 5c094dc9..92db2991 100644 --- a/client/src/utils/gameStorage.js +++ b/client/src/utils/gameStorage.js @@ -122,7 +122,7 @@ export const GameStorage = { if (!err) { let transaction = db.transaction(["games"], "readwrite"); transaction.oncomplete = function() { - callback({}); //everything's fine + callback(); //everything's fine }; transaction.objectStore("games").delete(gameId); } diff --git a/client/src/views/Game.vue b/client/src/views/Game.vue index 55b36887..b941e378 100644 --- a/client/src/views/Game.vue +++ b/client/src/views/Game.vue @@ -895,6 +895,7 @@ export default { this.virtualClocks = this.game.clocks.map(s => ppt(s).split(':')); return; } + clearInterval(this.clockUpdate); const currentTurn = this.vr.turn; const currentMovesCount = this.game.moves.length; const colorIdx = ["w", "b"].indexOf(currentTurn); diff --git a/client/src/views/MyGames.vue b/client/src/views/MyGames.vue index 4b5e33c2..2701e9ef 100644 --- a/client/src/views/MyGames.vue +++ b/client/src/views/MyGames.vue @@ -11,12 +11,13 @@ main v-show="display=='live'" :games="liveGames" @show-game="showGame" + @abortgame="abortGame" ) GameList( v-show="display=='corr'" :games="corrGames" @show-game="showGame" - @abort="abortGame" + @abortgame="abortGame" ) diff --git a/server/sockets.js b/server/sockets.js index ea95dc5d..e420b8ce 100644 --- a/server/sockets.js +++ b/server/sockets.js @@ -241,7 +241,7 @@ module.exports = function(wss) { case "mabort": { const gamePg = "/game/" + obj.gid; if (!!clients[gamePg] && !!clients[gamePg][obj.target]) { - Object.keys(clients[gamePg][target]).forEach(x => { + Object.keys(clients[gamePg][obj.target]).forEach(x => { send( clients[gamePg][obj.target][x], { code: "abort" }