6 input#fen(v-model="curFen" @input="adjustFenSize")
7 button(@click="gotoFen") Go
9 .col-sm-12.col-md-10.col-md-offset-1
10 BaseGame(:game="game" :vr="vr" ref="basegame")
14 import BaseGame from "@/components/BaseGame.vue";
15 import { store } from "@/store";
16 import { ArrayFun } from "@/utils/array";
23 // gameRef: to find the game in (potentially remote) storage
27 gameRef: { //given in URL (rid = remote ID)
32 players:[{name:"Analyze"},{name:"Analyze"}],
35 vr: null, //"variant rules" object initialized from FEN
37 //people: [], //players + observers //TODO later: interactive analyze...
41 "$route": function(to, from) {
42 this.gameRef.fen = to.query["fen"].replace(/_/g, " ");
43 this.gameRef.vname = to.params["vname"];
46 "vr.movesCount": function(fen) {
47 this.curFen = this.vr.getFen();
52 this.gameRef.fen = this.$route.query["fen"].replace(/_/g, " ");
53 this.gameRef.vname = this.$route.params["vname"];
54 this.initialize(this.loadGame);
57 initialize: async function(callback) {
58 // Obtain VariantRules object
59 const vModule = await import("@/variants/" + this.gameRef.vname + ".js");
60 window.V = vModule.VariantRules;
63 loadGame: function() {
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.$set(this.game, "fenStart", this.gameRef.fen); //TODO: Vue3...
71 adjustFenSize: function() {
72 let fenInput = document.getElementById("fen");
73 fenInput.style.width = this.curFen.length + "ch";
76 this.gameRef.fen = this.curFen;
83 <style lang="sass" scoped>