+ loadNewchallVariant: async function(cb) {
+ const vname = this.getVname(this.newchallenge.vid);
+ const vModule = await import("@/variants/" + vname + ".js");
+ this.newchallenge.V = vModule.VariantRules;
+ this.newchallenge.vname = vname;
+ if (cb)
+ cb();
+ },
+ trySetNewchallDiag: function() {
+ if (!this.newchallenge.fen) {
+ this.newchallenge.diag = "";
+ return;
+ }
+ // If vid > 0 then the variant is loaded (function above):
+ window.V = this.newchallenge.V;
+ if (
+ this.newchallenge.vid > 0 &&
+ this.newchallenge.fen &&
+ V.IsGoodFen(this.newchallenge.fen)
+ ) {
+ const parsedFen = V.ParseFen(this.newchallenge.fen);
+ this.newchallenge.diag = getDiagram({
+ position: parsedFen.position,
+ orientation: V.GetOppCol(parsedFen.turn)
+ });
+ }
+ },