projects
/
vchess.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Fix promotion bug on smartphones
[vchess.git]
/
public
/
javascripts
/
components
/
game.js
diff --git
a/public/javascripts/components/game.js
b/public/javascripts/components/game.js
index
91e13e4
..
17f3b18
100644
(file)
--- 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 },
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=[]; },
+ },
})
]
);
})
]
);
@@
-1167,7
+1171,6
@@
Vue.component('my-game', {
setTimeout(() => { modalBox.checked = false; }, 2000);
},
endGame: function(score) {
setTimeout(() => { modalBox.checked = false; }, 2000);
},
endGame: function(score) {
- console.log("call " + score + " " + this.mode);
this.score = score;
if (["human","computer"].includes(this.mode))
{
this.score = score;
if (["human","computer"].includes(this.mode))
{
@@
-1317,7
+1320,8
@@
Vue.component('my-game', {
const storageVariant = localStorage.getItem("comp-variant");
if (!!storageVariant)
{
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"))
{
if (!confirm("Unfinished " + storageVariant +
" computer game will be erased"))
@@
-1325,12
+1329,8
@@
Vue.component('my-game', {
return;
}
}
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, []);
}
}
this.vr = new VariantRules(fen, []);