X-Git-Url: https://git.auder.net/?p=vchess.git;a=blobdiff_plain;f=client%2Fsrc%2Fviews%2FGame.vue;h=bceb361cf5e10499bc7fc74dea6bb96662bdbfde;hp=0182352a494fe4f2d3085fd8eec5d04e8c0e2be7;hb=8be8238cbd8bd1eeeb4c101648d6902cae425f7b;hpb=c583ef1c1dfd19aee88b22c2175202fbdf4dc1c0 diff --git a/client/src/views/Game.vue b/client/src/views/Game.vue index 0182352a..bceb361c 100644 --- a/client/src/views/Game.vue +++ b/client/src/views/Game.vue @@ -14,7 +14,7 @@ main | {{ st.tr["Rematch in progress"] }} input#modalChat.modal( type="checkbox" - @click="resetChatColor()" + @click="toggleChat()" ) div#chatWrap( role="dialog" @@ -37,7 +37,6 @@ main ref="chatcomp" :players="game.players" :pastChats="game.chats" - :newChat="newChat" @mychat="processChat" @chatcleared="clearChat" ) @@ -172,7 +171,6 @@ export default { lastate: undefined, //used if opponent send lastate before game is ready repeat: {}, //detect position repetition curDiag: "", //for corr moves confirmation - newChat: "", conn: null, roomInitialized: false, // If newmove has wrong index: ask fullgame again: @@ -276,7 +274,6 @@ export default { this.lastateAsked = false; this.rematchOffer = ""; this.lastate = undefined; - this.newChat = ""; this.roomInitialized = false; this.askGameTime = 0; this.gameIsLoading = false; @@ -380,8 +377,12 @@ export default { if (!!oppsid && !!this.people[oppsid]) return oppsid; return null; }, - resetChatColor: function() { - // TODO: this is called twice, once on opening an once on closing + toggleChat: function() { + if (document.getElementById("modalChat").checked) + // Entering chat + document.getElementById("inputChat").focus(); + // TODO: next line is only required when exiting chat, + // but the event for now isn't well detected. document.getElementById("chatBtn").classList.remove("somethingnew"); }, processChat: function(chat) { @@ -711,7 +712,7 @@ export default { break; } case "newchat": - this.newChat = data.data; + this.$refs["chatcomp"].newChat(data.data); if (!document.getElementById("modalChat").checked) document.getElementById("chatBtn").classList.add("somethingnew"); break; @@ -1025,7 +1026,7 @@ export default { oppsid: myIdx < 0 ? undefined : game.players[1 - myIdx].sid, oppid: myIdx < 0 ? undefined : game.players[1 - myIdx].id }, - game, + game ); this.$refs["basegame"].re_setVariables(this.game); if (!this.gameIsLoading) { @@ -1160,9 +1161,8 @@ export default { if (this.game.type == "live") { if (!!data.clock) this.game.clocks[colorIdx] = data.clock; else this.game.clocks[colorIdx] += addTime; - } - // In corr games, just reset clock to mainTime: - else { + } else { + // In corr games, just reset clock to mainTime: this.game.clocks[colorIdx] = extractTime(this.game.cadence).mainTime; } // NOTE: opponent's initime is reset after "gotmove" is received @@ -1220,7 +1220,6 @@ export default { fen: this.game.fen, move: { squares: filtered_move, - played: Date.now(), idx: origMovescount }, // Code "n" for "None" to force reset (otherwise it's ignored)