X-Git-Url: https://git.auder.net/?a=blobdiff_plain;f=client%2Fsrc%2Fviews%2FGame.vue;h=8667e9b7d3ff01dd2649a4f2b3b0d20f3a7ecaac;hb=f296c3d4d610e04f8c9b56dcee319b6d783a9290;hp=ae90255d2cd7931d8d99187f86065040c97df7dc;hpb=26d8a01a40dc198b633ae86f698b1ae82415e5e1;p=vchess.git diff --git a/client/src/views/Game.vue b/client/src/views/Game.vue index ae90255d..8667e9b7 100644 --- a/client/src/views/Game.vue +++ b/client/src/views/Game.vue @@ -97,13 +97,13 @@ main ) img(src="/images/icons/draw.svg") button.tooltip( - v-if="!!game.mycolor" + v-show="!!game.mycolor" @click="abortGame()" :aria-label="st.tr['Abort']" ) img(src="/images/icons/abort.svg") button.tooltip( - v-if="!!game.mycolor" + v-show="!!game.mycolor" @click="resign()" :aria-label="st.tr['Resign']" ) @@ -270,12 +270,6 @@ export default { .addEventListener("click", processModalClick); } ); - if ("ontouchstart" in window) { - // Disable tooltips on smartphones: - document.querySelectorAll("#aboveBoard .tooltip").forEach(elt => { - elt.classList.remove("tooltip"); - }); - } }, beforeDestroy: function() { this.cleanBeforeDestroy(); @@ -815,8 +809,7 @@ export default { GameStorage.update(this.gameRef, { drawOffer: "" }); } } - this.$refs["basegame"].play( - movePlus.move, "received", null, true); + this.$refs["basegame"].play(movePlus.move, "received"); this.game.clocks[moveColIdx] = movePlus.clock; this.processMove( movePlus.move, @@ -883,6 +876,8 @@ export default { this.$router.push("/game/" + gameInfo.id); } else { this.rematchId = gameInfo.id; + document.getElementById("modalRules").checked = false; + document.getElementById("modalScore").checked = false; document.getElementById("modalRematch").checked = true; } break; @@ -945,7 +940,7 @@ export default { this.game.clocks[oppIdx] = data.clock; if (data.movesCount > L) { // Just got last move from him - this.$refs["basegame"].play(data.lastMove, "received", null, true); + this.$refs["basegame"].play(data.lastMove, "received"); this.processMove(data.lastMove); } else { if (!!this.clockUpdate) clearInterval(this.clockUpdate); @@ -1212,6 +1207,14 @@ export default { }, game ); + if ("ontouchstart" in window) { + this.$nextTick(() => { + // Disable tooltips on smartphones: + document.querySelectorAll("#aboveBoard .tooltip").forEach(elt => { + elt.classList.remove("tooltip"); + }); + }); + } this.$refs["basegame"].re_setVariables(this.game); if (!this.gameIsLoading) { // Initial loading: @@ -1564,8 +1567,18 @@ export default { // In corr games, callback to change page only after score is set: gameOver: function(score, scoreMsg, callback) { this.game.score = score; + if ("ontouchstart" in window) { + this.$nextTick(() => { + // Disable tooltips on smartphones + // (might be required for rematch button at least): + document.querySelectorAll("#aboveBoard .tooltip").forEach(elt => { + elt.classList.remove("tooltip"); + }); + }); + } if (!scoreMsg) scoreMsg = getScoreMessage(score); this.game.scoreMsg = scoreMsg; + document.getElementById("modalRules").checked = false; // Display result in a un-missable way: document.getElementById("modalScore").checked = true; this.$set(this.game, "scoreMsg", scoreMsg); @@ -1610,7 +1623,7 @@ export default {