6 input#fen(v-model="curFen" @input="adjustFenSize()")
7 button(@click="gotoFen()") {{ st.tr["Go"] }}
8 BaseGame(:game="game" :vr="vr")
12 import BaseGame from "@/components/BaseGame.vue";
13 import { store } from "@/store";
19 // gameRef: to find the game in (potentially remote) storage
24 //given in URL (rid = remote ID)
29 players: [{ name: "Analyse" }, { name: "Analyse" }],
32 vr: null, //"variant rules" object initialized from FEN
34 //people: [], //players + observers //TODO later: interactive analyze...
38 // NOTE: no watcher for $route change, because if fenStart doesn't change
39 // then it doesn't trigger BaseGame.re_init() and the result is weird.
40 "vr.movesCount": function() {
41 this.curFen = this.vr.getFen();
46 this.gameRef.vname = this.$route.params["vname"];
47 if (this.gameRef.vname == "Dark") {
48 alert(this.st.tr["Analyse in Dark mode makes no sense!"]);
49 history.back(); //or this.$router.go(-1)
51 this.gameRef.fen = this.$route.query["fen"].replace(/_/g, " ");
56 initialize: async function() {
57 // Obtain VariantRules object
58 const vModule = await import("@/variants/" + this.gameRef.vname + ".js");
59 window.V = vModule.VariantRules;
62 loadGame: function() {
63 // NOTE: no need to set score (~unused)
64 this.game.vname = this.gameRef.vname;
65 this.game.fen = this.gameRef.fen;
66 this.curFen = this.game.fen;
68 this.vr = new V(this.game.fen);
69 this.game.mycolor = this.vr.turn;
70 this.$set(this.game, "fenStart", this.gameRef.fen);
72 adjustFenSize: function() {
73 let fenInput = document.getElementById("fen");
74 fenInput.style.width = this.curFen.length + "ch";
77 this.gameRef.fen = this.curFen;