X-Git-Url: https://git.auder.net/?a=blobdiff_plain;f=client%2Fsrc%2Fviews%2FGame.vue;h=fa5a86d63cb537af5e892c4f736d6698a0f95076;hb=98f149990956bca9ced09c22b29a37ab849b9896;hp=6d5a92abec55604c669f25b0fa0c8e078e17c56e;hpb=51336cd2180ca1a56eba7f773abe715d0eb5cddb;p=vchess.git diff --git a/client/src/views/Game.vue b/client/src/views/Game.vue index 6d5a92ab..fa5a86d6 100644 --- a/client/src/views/Game.vue +++ b/client/src/views/Game.vue @@ -89,7 +89,7 @@ main aria-label="Chat" ) img(src="/images/icons/chat.svg") - #actions(v-show="game.score=='*'") + #actions(v-if="game.score=='*'") button.tooltip( @click="clickDraw()" :class="{['draw-' + drawOffer]: true}" @@ -109,7 +109,7 @@ main ) img(src="/images/icons/resign.svg") button.tooltip( - v-show="game.score!='*'" + v-else @click="clickRematch()" :class="{['rematch-' + rematchOffer]: true}" :aria-label="st.tr['Rematch']" @@ -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(); @@ -1213,6 +1207,19 @@ export default { }, game ); + if ("ontouchstart" in window) { + // TODO: I don't like this timeout, but $nextTick() fails, + // and in mounted() hook that fails too. + setTimeout( + () => { + // Disable tooltips on smartphones: + document.querySelectorAll("#aboveBoard .tooltip").forEach(elt => { + elt.classList.remove("tooltip"); + }); + }, + 750 + ); + } this.$refs["basegame"].re_setVariables(this.game); if (!this.gameIsLoading) { // Initial loading: @@ -1565,6 +1572,15 @@ 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;