+ const key = "rr_" + vname;
+ if (!localStorage.getItem(key))
+ // Mark rules as "read"
+ localStorage.setItem(key, '1');
+ await import("@/variants/" + vname + ".js")
+ .then((vModule) => {
+ this.V = window.V = vModule[vname + "Rules"];
+ this.gameInfo.vname = vname;
+ })
+ .catch((err) => {
+ // Soon after component creation, st.tr might be uninitialized.
+ // Set a timeout to let a chance for the message to show translated.
+ const text = "Mispelled variant name";
+ setTimeout(() => {
+ alert(this.st.tr[text] || text);
+ this.$router.replace("/variants");
+ }, 500);
+ });
+ },
+ 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);