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=[]; },
+ },
})
]
);
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"))
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, []);