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 if (this.gameRef.vname != "Dark")
55 this.initialize(this.loadGame);
58 alert("Please, analyze in Dark mode makes no sense ~_^");
59 history.back(); //or this.$router.go(-1)
63 initialize: async function(callback) {
64 // Obtain VariantRules object
65 const vModule = await import("@/variants/" + this.gameRef.vname + ".js");
66 window.V = vModule.VariantRules;
69 loadGame: function() {
70 // NOTE: no need to set score (~unused)
71 this.game.vname = this.gameRef.vname;
72 this.game.fen = this.gameRef.fen;
73 this.curFen = this.game.fen;
75 this.vr = new V(this.game.fen);
76 this.$set(this.game, "fenStart", this.gameRef.fen); //TODO: Vue3...
78 adjustFenSize: function() {
79 let fenInput = document.getElementById("fen");
80 fenInput.style.width = this.curFen.length + "ch";
83 this.gameRef.fen = this.curFen;
90 <style lang="sass" scoped>