projects
/
vchess.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Improve style
[vchess.git]
/
client
/
src
/
views
/
Analyse.vue
diff --git
a/client/src/views/Analyse.vue
b/client/src/views/Analyse.vue
index
035cd08
..
23515c6
100644
(file)
--- a/
client/src/views/Analyse.vue
+++ b/
client/src/views/Analyse.vue
@@
-3,57
+3,53
@@
main
.row
.col-sm-12
.text-center
.row
.col-sm-12
.text-center
- input#fen(v-model="curFen" @input="adjustFenSize()")
- button(@click="gotoFen()") {{ st.tr["Go"] }}
- BaseGame(:game="game" :vr="vr")
+ input#fen(
+ v-model="curFen"
+ @input="adjustFenSize(); tryGotoFen()"
+ )
+ BaseGame(
+ :game="game"
+ :vr="vr"
+ )
</template>
<script>
import BaseGame from "@/components/BaseGame.vue";
import { store } from "@/store";
</template>
<script>
import BaseGame from "@/components/BaseGame.vue";
import { store } from "@/store";
-import { ArrayFun } from "@/utils/array";
export default {
export default {
- name:
'my-analyse'
,
+ name:
"my-analyse"
,
components: {
components: {
- BaseGame
,
+ BaseGame
},
// gameRef: to find the game in (potentially remote) storage
data: function() {
return {
st: store.state,
},
// gameRef: to find the game in (potentially remote) storage
data: function() {
return {
st: store.state,
- gameRef: { //given in URL (rid = remote ID)
+ gameRef: {
+ //given in URL (rid = remote ID)
vname: "",
fen: ""
},
game: {
vname: "",
fen: ""
},
game: {
- players:
[{name:"Analyse"},{name:"Analyse"
}],
- mode: "analyze"
,
+ players:
[{ name: "Analyse" }, { name: "Analyse"
}],
+ mode: "analyze"
},
vr: null, //"variant rules" object initialized from FEN
},
vr: null, //"variant rules" object initialized from FEN
- curFen: "",
- //people: [], //players + observers //TODO later: interactive analyze...
+ curFen: ""
};
},
watch: {
// NOTE: no watcher for $route change, because if fenStart doesn't change
// then it doesn't trigger BaseGame.re_init() and the result is weird.
};
},
watch: {
// NOTE: no watcher for $route change, because if fenStart doesn't change
// then it doesn't trigger BaseGame.re_init() and the result is weird.
- "vr.movesCount": function(
fen
) {
+ "vr.movesCount": function() {
this.curFen = this.vr.getFen();
this.adjustFenSize();
this.curFen = this.vr.getFen();
this.adjustFenSize();
- }
,
+ }
},
created: function() {
this.gameRef.vname = this.$route.params["vname"];
},
created: function() {
this.gameRef.vname = this.$route.params["vname"];
- if (this.gameRef.vname == "Dark")
- {
- alert(this.st.tr["Analyse in Dark mode makes no sense!"]);
- history.back(); //or this.$router.go(-1)
- }
- else
- {
- this.gameRef.fen = this.$route.query["fen"].replace(/_/g, " ");
- this.initialize();
- }
+ this.gameRef.fen = this.$route.query["fen"].replace(/_/g, " ");
+ this.initialize();
},
methods: {
initialize: async function() {
},
methods: {
initialize: async function() {
@@
-76,10
+72,13
@@
export default {
let fenInput = document.getElementById("fen");
fenInput.style.width = this.curFen.length + "ch";
},
let fenInput = document.getElementById("fen");
fenInput.style.width = this.curFen.length + "ch";
},
- gotoFen: function() {
- this.gameRef.fen = this.curFen;
- this.loadGame();
- },
- },
+ tryGotoFen: function() {
+ if (V.IsGoodFen(this.curFen))
+ {
+ this.gameRef.fen = this.curFen;
+ this.loadGame();
+ }
+ }
+ }
};
</script>
};
</script>