+ tryChangeVariant: async function(vname) {
+ if (!vname || vname == "_unknown")
+ return;
+ this.gameInfo.vname = vname;
+ const vModule = await import("@/variants/" + vname + ".js");
+ window.V = vModule.VariantRules;
+ // Method to replace diagrams in loaded HTML
+ const replaceByDiag = (match, p1, p2) => {
+ const args = this.parseFen(p2);
+ return getDiagram(args);
+ };
+ // (AJAX) Request to get rules content (plain text, HTML)
+ this.content =
+ require("raw-loader!@/rules/" + vname + "/" + this.st.lang + ".pug")
+ // Next two lines fix a weird issue after last update (2019-11)
+ .replace(/\\[n"]/g, " ")
+ .replace('module.exports = "', '').replace(/"$/, "")
+ .replace(/(fen:)([^:]*):/g, replaceByDiag);
+ },
+ startGame: function(mode) {