X-Git-Url: https://git.auder.net/?a=blobdiff_plain;f=client%2Fsrc%2Fviews%2FGame.vue;h=776b9eaf8525fd5d57c0d6ec6508fea195829100;hb=f4221ff17c58c277660865a11bf6358268fbda10;hp=171dc6c68674c42ba3e40a2b0d897bfb77b7ce45;hpb=80b38d463c0d5dacac93bc2aeb666bbb19781e1e;p=vchess.git diff --git a/client/src/views/Game.vue b/client/src/views/Game.vue index 171dc6c6..776b9eaf 100644 --- a/client/src/views/Game.vue +++ b/client/src/views/Game.vue @@ -46,7 +46,7 @@ main span {{ st.tr["Participant(s):"] }} span( v-for="p in Object.values(people)" - v-if="participateInChat(p)" + v-if="!!p.name" ) | {{ p.name }} span.anonymous(v-if="someAnonymousPresent()") + @nonymous @@ -213,6 +213,7 @@ export default { game: {}, //passed to BaseGame focus: !document.hidden, //will not always work... TODO // virtualClocks will be initialized from true game.clocks + // TODO: clock update triggers re-rendering. Should be out of Vue virtualClocks: [], vr: null, //"variant rules" object initialized from FEN rulesContent: "", @@ -256,7 +257,8 @@ export default { // In case of incomplete information variant: boardDiv.style.visibility = "hidden"; this.atCreation(); - } else + } + else // Same game ID this.nextIds = JSON.parse(this.$route.query["next"] || "[]"); } @@ -321,9 +323,6 @@ export default { ) ); }, - participateInChat: function(p) { - return Object.keys(p.tmpIds).some(x => p.tmpIds[x].focus) && !!p.name; - }, someAnonymousPresent: function() { return ( Object.values(this.people).some(p => @@ -523,7 +522,11 @@ export default { }, getGameType: function(game) { if (!!game.id.toString().match(/^i/)) return "import"; - return game.cadence.indexOf("d") >= 0 ? "corr" : "live"; + return ( + game.cadence.indexOf("d") >= 0 + ? "corr" + : (game.cadence.indexOf("/") >= 0 ? "simul" : "live") + ); }, // Notify something after a new move (to opponent and me on MyGames page) notifyMyGames: function(thing, data) { @@ -1286,7 +1289,10 @@ console.log(data.data); // - from server (one correspondance game I play[ed] or not) // - from remote peer (one live game I don't play, finished or not) fetchGame: function(callback) { - if (Number.isInteger(this.gameRef) || !isNaN(parseInt(this.gameRef))) { + if ( + Number.isInteger(this.gameRef) || + !isNaN(parseInt(this.gameRef, 10)) + ) { // corr games identifiers are integers ajax( "/games", @@ -1518,7 +1524,6 @@ console.log(data.data); }; if ( this.game.type == "corr" && - V.CorrConfirm && moveCol == this.game.mycolor && !data.receiveMyMove ) { @@ -1534,6 +1539,10 @@ console.log(data.data); if (data.score == "*") this.re_setClocks(); } }; + if (!V.CorrConfirm) { + afterSetScore(); + return; + } let el = document.querySelector("#buttonsConfirm > .acceptBtn"); // We may play several moves in a row: in case of, remove listener: let elClone = el.cloneNode(true);