6 input#fen(v-model="curFen" @input="adjustFenSize")
7 button(@click="gotoFen") {{ st.tr["Go"] }}
8 BaseGame(:game="game" :vr="vr" ref="basegame")
12 import BaseGame from "@/components/BaseGame.vue";
13 import { store } from "@/store";
14 import { ArrayFun } from "@/utils/array";
21 // gameRef: to find the game in (potentially remote) storage
25 gameRef: { //given in URL (rid = remote ID)
30 players:[{name:"Analyse"},{name:"Analyse"}],
33 vr: null, //"variant rules" object initialized from FEN
35 //people: [], //players + observers //TODO later: interactive analyze...
39 // NOTE: no watcher for $route change, because if fenStart doesn't change
40 // then it doesn't trigger BaseGame.re_init() and the result is weird.
41 "vr.movesCount": function(fen) {
42 this.curFen = this.vr.getFen();
47 this.gameRef.vname = this.$route.params["vname"];
48 if (this.gameRef.vname == "Dark")
50 alert(this.st.tr["Analyse in Dark mode makes no sense!"]);
51 history.back(); //or this.$router.go(-1)
55 this.gameRef.fen = this.$route.query["fen"].replace(/_/g, " ");
60 initialize: async function() {
61 // Obtain VariantRules object
62 const vModule = await import("@/variants/" + this.gameRef.vname + ".js");
63 window.V = vModule.VariantRules;
66 loadGame: function() {
67 // NOTE: no need to set score (~unused)
68 this.game.vname = this.gameRef.vname;
69 this.game.fen = this.gameRef.fen;
70 this.curFen = this.game.fen;
72 this.vr = new V(this.game.fen);
73 this.game.mycolor = this.vr.turn;
74 this.$set(this.game, "fenStart", this.gameRef.fen);
76 adjustFenSize: function() {
77 let fenInput = document.getElementById("fen");
78 fenInput.style.width = this.curFen.length + "ch";
81 this.gameRef.fen = this.curFen;
88 <style lang="sass" scoped>