projects
/
vchess.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
f5d3e4f
)
Fix '3 knights' bug + tiny advance on problems tab
author
Benjamin Auder
<benjamin.auder@somewhere>
Fri, 14 Dec 2018 23:58:04 +0000
(
00:58
+0100)
committer
Benjamin Auder
<benjamin.auder@somewhere>
Fri, 14 Dec 2018 23:58:04 +0000
(
00:58
+0100)
public/javascripts/components/game.js
patch
|
blob
|
blame
|
history
public/javascripts/components/problems.js
patch
|
blob
|
blame
|
history
public/javascripts/variant.js
patch
|
blob
|
blame
|
history
public/stylesheets/variant.sass
patch
|
blob
|
blame
|
history
views/variant.pug
patch
|
blob
|
blame
|
history
diff --git
a/public/javascripts/components/game.js
b/public/javascripts/components/game.js
index
63bf675
..
533bc0e
100644
(file)
--- 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);
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) {
},
// 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
54b36ab
..
dc32052
100644
(file)
--- 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
//
// 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>
+ `,
+})
diff --git
a/public/javascripts/variant.js
b/public/javascripts/variant.js
index
f9d23d8
..
2174c50
100644
(file)
--- 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
// 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
40bf212
..
f5bffc3
100644
(file)
--- 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
ul:not(.browser-default) > li
list-style-type: disc
-.
rulesT
itle
+.
variantpage-t
itle
font-weight: bold
cursor: pointer
font-weight: bold
cursor: pointer
- padding: 3px
;
+ padding: 3px
background-color: lightgrey
#fen-string
background-color: lightgrey
#fen-string
diff --git
a/views/variant.pug
b/views/variant.pug
index
e744962
..
a613a0b
100644
(file)
--- 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
.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
| #{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
| #{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
| #{variant} Problems
- my-
game
(v-show="display=='problems'")
+ my-
problems
(v-show="display=='problems'")
block javascripts
script(src="/javascripts/utils/misc.js")
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/components/rules.js")
script(src="/javascripts/components/game.js")
script(src="/javascripts/components/problems.js")
+ script(src="/javascripts/variant.js")