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:"Analyze"},{name:"Analyze"}],
33 vr: null, //"variant rules" object initialized from FEN
35 //people: [], //players + observers //TODO later: interactive analyze...
39 "$route": function(to, from) {
40 this.gameRef.fen = to.query["fen"].replace(/_/g, " ");
41 this.gameRef.vname = to.params["vname"];
44 "vr.movesCount": function(fen) {
45 this.curFen = this.vr.getFen();
50 this.gameRef.fen = this.$route.query["fen"].replace(/_/g, " ");
51 this.gameRef.vname = this.$route.params["vname"];
52 if (this.gameRef.vname != "Dark")
53 this.initialize(this.loadGame);
56 alert(this.st.tr["Analyze in Dark mode makes no sense!"]);
57 history.back(); //or this.$router.go(-1)
61 initialize: async function(callback) {
62 // Obtain VariantRules object
63 const vModule = await import("@/variants/" + this.gameRef.vname + ".js");
64 window.V = vModule.VariantRules;
67 loadGame: function() {
68 // NOTE: no need to set score (~unused)
69 this.game.vname = this.gameRef.vname;
70 this.game.fen = this.gameRef.fen;
71 this.curFen = this.game.fen;
73 this.vr = new V(this.game.fen);
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>