8 @input="adjustFenSize()"
10 button(@click="gotoFen()") {{ st.tr["Go"] }}
18 import BaseGame from "@/components/BaseGame.vue";
19 import { store } from "@/store";
25 // gameRef: to find the game in (potentially remote) storage
30 //given in URL (rid = remote ID)
35 players: [{ name: "Analyse" }, { name: "Analyse" }],
38 vr: null, //"variant rules" object initialized from FEN
40 //people: [], //players + observers //TODO later: interactive analyze...
44 // NOTE: no watcher for $route change, because if fenStart doesn't change
45 // then it doesn't trigger BaseGame.re_init() and the result is weird.
46 "vr.movesCount": function() {
47 this.curFen = this.vr.getFen();
52 this.gameRef.vname = this.$route.params["vname"];
53 if (this.gameRef.vname == "Dark") {
54 alert(this.st.tr["Analyse in Dark mode makes no sense!"]);
55 history.back(); //or this.$router.go(-1)
57 this.gameRef.fen = this.$route.query["fen"].replace(/_/g, " ");
62 initialize: async function() {
63 // Obtain VariantRules object
64 const vModule = await import("@/variants/" + this.gameRef.vname + ".js");
65 window.V = vModule.VariantRules;
68 loadGame: function() {
69 // NOTE: no need to set score (~unused)
70 this.game.vname = this.gameRef.vname;
71 this.game.fen = this.gameRef.fen;
72 this.curFen = this.game.fen;
74 this.vr = new V(this.game.fen);
75 this.game.mycolor = this.vr.turn;
76 this.$set(this.game, "fenStart", this.gameRef.fen);
78 adjustFenSize: function() {
79 let fenInput = document.getElementById("fen");
80 fenInput.style.width = this.curFen.length + "ch";
83 this.gameRef.fen = this.curFen;