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
43 // NOTE: no watcher for $route change, because if fenStart doesn't change
44 // then it doesn't trigger BaseGame.re_init() and the result is weird.
45 "vr.movesCount": function() {
46 this.curFen = this.vr.getFen();
51 this.gameRef.vname = this.$route.params["vname"];
52 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;