X-Git-Url: https://git.auder.net/?a=blobdiff_plain;f=public%2Fjavascripts%2Fcomponents%2Fgame.js;h=d8fbe47d1c61c77c3a81aae4f1c514805c26e250;hb=748eef1fe9eb666318e2a4c84c1627085666ab07;hp=54334e30f075e40e83fb6e72075198be4a50320b;hpb=247356cde3f4e36004942c5f57187d667f7ef27c;p=vchess.git diff --git a/public/javascripts/components/game.js b/public/javascripts/components/game.js index 54334e30..d8fbe47d 100644 --- a/public/javascripts/components/game.js +++ b/public/javascripts/components/game.js @@ -404,7 +404,7 @@ Vue.component('my-game', { h('button', { on: { click: this.undoInGame }, - attrs: { "aria-label": trnaslations['Undo'] }, + attrs: { "aria-label": translations['Undo'] }, "class": { "play": true, "spaceleft": true, @@ -1008,7 +1008,8 @@ Vue.component('my-game', { // We opened another tab on the same game this.mode = "idle"; this.vr = null; - alert("Already playing a game in this variant on another tab!"); + alert(translations[ + "Already playing a game in this variant on another tab!"]); break; case "newgame": //opponent found // oppid: opponent socket ID @@ -1278,7 +1279,10 @@ Vue.component('my-game', { { const storageVariant = localStorage.getItem("variant"); if (!!storageVariant && storageVariant !== variant) - return alert("Finish your " + storageVariant + " game first!"); + { + return alert(translations["Finish your "] + + storageVariant + translations[" game first!"]); + } // Send game request and wait.. try { this.conn.send(JSON.stringify({code:"newgame", fen:fen})); @@ -1304,8 +1308,8 @@ Vue.component('my-game', { const score = localStorage.getItem("comp-score"); if (storageVariant !== variant && score == "*") { - if (!confirm("Unfinished " + storageVariant + - " computer game will be erased")) + if (!confirm(storageVariant + + translations[": unfinished computer game will be erased"])) { return; } @@ -1352,6 +1356,7 @@ Vue.component('my-game', { const fen = localStorage.getItem(prefix+"fen"); const score = localStorage.getItem(prefix+"score"); //set in "endGame()" this.fenStart = localStorage.getItem(prefix+"fenStart"); + this.vr = new VariantRules(fen, moves); if (mode == "human") { this.gameId = localStorage.getItem("gameId"); @@ -1360,8 +1365,11 @@ Vue.component('my-game', { code:"ping",oppid:this.oppid,gameId:this.gameId})); } else + { this.compWorker.postMessage(["init",fen]); - this.vr = new VariantRules(fen, moves); + if (this.mycolor != this.vr.turn) + this.playComputerMove(); + } if (moves.length > 0) { const lastMove = moves[moves.length-1];