const compMove = this.vr.getComputerMove();
// (first move) HACK: avoid selecting elements before they appear on page:
const delay = Math.max(500-(Date.now()-timeStart), 0);
- setTimeout(() => this.play(compMove, "animate"), delay);
+ setTimeout(() => {
+ if (this.mode == "computer") //Warning: mode could have changed!
+ this.play(compMove, "animate")
+ }, delay);
},
// Get the identifier of a HTML table cell from its numeric coordinates o.x,o.y.
getSquareId: function(o) {
//
// click on problem ==> masque problems, affiche game tab, launch new game Friend with
// FEN + turn + flags + rappel instructions / solution on click sous l'échiquier
+
+Vue.component('my-problems', {
+ //props: ['vobj'],
+ template: `
+ <div class="variant col-sm-12">
+ <p>Hello</p>
+ </div>
+ `,
+})
// TODO: listen event "show problem", avec le probleme stringifié en arg
// Alors: display=game, mode=friend, newGame(fen, turn, ...),
// et set Instructions+Soluce
+ methods: {
+ toggleDisplay: function(elt) {
+ if (this.display == elt)
+ this.display = ""; //hide
+ else
+ this.display = elt; //show
+ },
+ },
});
ul:not(.browser-default) > li
list-style-type: disc
-.rulesTitle
+.variantpage-title
font-weight: bold
cursor: pointer
- padding: 3px;
+ padding: 3px
background-color: lightgrey
#fen-string
.container#variantPage
.row
.col-sm-12.col-md-10.col-md-offset-1.col-lg-8.col-lg-offset-2
- h4.rulesTitle.text-center(v-on:click="display='rules'")
+ h4.variantpage-title.text-center(v-on:click="toggleDisplay('rules')")
| #{variant} Rules
my-rules(v-show="display=='rules'")
.col-sm-12.col-md-10.col-md-offset-1.col-lg-8.col-lg-offset-2
- h4.rulesTitle.text-center(v-on:click="display='game'")
+ h4.variantpage-title.text-center(v-on:click="toggleDisplay('game')")
| #{variant} Game
my-game(v-show="display=='game'")
.col-sm-12.col-md-10.col-md-offset-1.col-lg-8.col-lg-offset-2
- h4.rulesTitle.text-center(v-on:click="display='problems'")
+ h4.variantpage-title.text-center(v-on:click="toggleDisplay('problems')")
| #{variant} Problems
- my-game(v-show="display=='problems'")
+ my-problems(v-show="display=='problems'")
block javascripts
script(src="/javascripts/utils/misc.js")
script(src="/javascripts/components/rules.js")
script(src="/javascripts/components/game.js")
script(src="/javascripts/components/problems.js")
+ script(src="/javascripts/variant.js")