- 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!@/translations/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);
+ setOptions: function() {
+ let options = {};
+ // Get/set options variables / TODO: v-model?!
+ for (const check of this.V.Options.check) {
+ const elt = document.getElementById(check.variable + "_opt");
+ if (elt.checked) options[check.variable] = true;
+ }
+ for (const select of this.V.Options.select) {
+ const elt = document.getElementById(select.variable + "_opt");
+ options[select.variable] = elt.value;
+ }
+ document.getElementById("modalOptions").checked = false;
+ if (this.whatNext == "analyze") this.gotoAnalyze(options);
+ else this.startGame(this.whatNext, options);