- this.loadVariant(
- p.vid,
- () => {
- // The FEN is already checked at this stage:
- this.vr = new V(p.fen);
- this.game.vname = p.vname;
- this.game.mycolor = this.vr.turn; //diagram orientation
- this.game.fen = p.fen;
- this.$set(this.game, "fenStart", p.fen);
- this.copyProblem(p, this.curproblem);
- this.showOne = true;
- }
- );
+ this.loadVariant(p.vid, () => {
+ // The FEN is already checked at this stage:
+ this.game.vname = p.vname;
+ this.game.mycolor = V.ParseFen(p.fen).turn; //diagram orientation
+ this.game.fen = p.fen;
+ this.$set(this.game, "fenStart", p.fen);
+ this.copyProblem(p, this.curproblem);
+ this.showOne = true;
+ });
+ },
+ gotoPrevNext: function(e, prob, dir) {
+ const startIdx = this.problems.findIndex(p => p.id == prob.id);
+ let nextIdx = startIdx + dir;
+ while (
+ nextIdx >= 0 &&
+ nextIdx < this.problems.length &&
+ ((this.onlyMines && this.problems[nextIdx].uid != this.st.user.id) ||
+ (!this.onlyMines && this.problems[nextIdx].uid == this.st.user.id))
+ )
+ nextIdx += dir;
+ if (nextIdx >= 0 && nextIdx < this.problems.length)
+ this.setHrefPid(this.problems[nextIdx]);
+ else
+ alert(this.st.tr["No more problems"]);
+ },
+ prepareNewProblem: function() {
+ this.resetCurProb();
+ window.doClick("modalNewprob");