X-Git-Url: https://git.auder.net/?a=blobdiff_plain;f=public%2Fjavascripts%2Fcomponents%2Fgame.js;h=17f3b18d6570a75ade64a3482d4a7842017f1c53;hb=2807f530f7d9d7675497974fa95aa7ecdd5d144c;hp=e229cdfbd06d5294faa7a8f70df41d384f9cc239;hpb=f1cb85f915a7734b6900527039f505c391b234e5;p=vchess.git diff --git a/public/javascripts/components/game.js b/public/javascripts/components/game.js index e229cdfb..17f3b18d 100644 --- a/public/javascripts/components/game.js +++ b/public/javascripts/components/game.js @@ -257,7 +257,11 @@ Vue.component('my-game', { attrs: { "src": '/images/pieces/' + VariantRules.getPpath(m.appear[0].c+m.appear[0].p) + '.svg' }, 'class': { 'choice-piece': true }, - on: { "click": e => { this.play(m); this.choices=[]; } }, + on: { + "click": e => { this.play(m); this.choices=[]; }, + // NOTE: add 'touchstart' event to fix a problem on smartphones + "touchstart": e => { this.play(m); this.choices=[]; }, + }, }) ] ); @@ -1316,7 +1320,8 @@ Vue.component('my-game', { const storageVariant = localStorage.getItem("comp-variant"); if (!!storageVariant) { - if (storageVariant !== variant) + const score = localStorage.getItem("comp-score"); + if (storageVariant !== variant && score == "*") { if (!confirm("Unfinished " + storageVariant + " computer game will be erased")) @@ -1324,12 +1329,8 @@ Vue.component('my-game', { return; } } - else - { - const score = localStorage.getItem("comp-score"); - if (score == "*") - return this.continueGame("computer"); - } + else if (score == "*") + return this.continueGame("computer"); } } this.vr = new VariantRules(fen, []);