From: Benjamin Auder Date: Fri, 14 Dec 2018 23:58:04 +0000 (+0100) Subject: Fix '3 knights' bug + tiny advance on problems tab X-Git-Url: https://git.auder.net/variants/Dynamo/current/vendor/css/parser.js?a=commitdiff_plain;h=4ecf423bce243e8e10b5b777a95f67ecc9f8d8d3;p=vchess.git Fix '3 knights' bug + tiny advance on problems tab --- diff --git a/public/javascripts/components/game.js b/public/javascripts/components/game.js index 63bf675c..533bc0e2 100644 --- a/public/javascripts/components/game.js +++ b/public/javascripts/components/game.js @@ -1083,7 +1083,10 @@ Vue.component('my-game', { 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) { diff --git a/public/javascripts/components/problems.js b/public/javascripts/components/problems.js index 54b36ab7..dc320520 100644 --- a/public/javascripts/components/problems.js +++ b/public/javascripts/components/problems.js @@ -12,3 +12,12 @@ // // 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: ` +
+

Hello

+
+ `, +}) diff --git a/public/javascripts/variant.js b/public/javascripts/variant.js index f9d23d8b..2174c509 100644 --- a/public/javascripts/variant.js +++ b/public/javascripts/variant.js @@ -4,4 +4,12 @@ new Vue({ // 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 + }, + }, }); diff --git a/public/stylesheets/variant.sass b/public/stylesheets/variant.sass index 40bf2123..f5bffc3c 100644 --- a/public/stylesheets/variant.sass +++ b/public/stylesheets/variant.sass @@ -221,10 +221,10 @@ ul:not(.browser-default) 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 diff --git a/views/variant.pug b/views/variant.pug index e7449621..a613a0b0 100644 --- a/views/variant.pug +++ b/views/variant.pug @@ -8,17 +8,17 @@ block content .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") @@ -34,3 +34,4 @@ block javascripts script(src="/javascripts/components/rules.js") script(src="/javascripts/components/game.js") script(src="/javascripts/components/problems.js") + script(src="/javascripts/variant.js")