3 #scoreInfo(v-if="score!='*'")
8 tr(v-for="moveIdx in evenNumbers")
9 td {{ firstNum + moveIdx / 2 + 1 }}
10 td(:class="{'highlight-lm': cursor == moveIdx}"
11 @click="() => gotoMove(moveIdx)")
12 | {{ moves[moveIdx].notation }}
13 td(v-if="moveIdx < moves.length-1"
14 :class="{'highlight-lm': cursor == moveIdx+1}"
15 @click="() => gotoMove(moveIdx+1)")
16 | {{ moves[moveIdx+1].notation }}
17 // Else: just add an empty cell
22 // Component for moves list on the right
25 props: ["moves","cursor","score","message","firstNum"],
27 cursor: function(newValue) {
28 if (window.innerWidth <= 767)
29 return; //moves list is below: scrolling would hide chessboard
31 newValue = 0; //avoid rows[-1] --> error
32 // $nextTick to wait for table > tr to be rendered
33 this.$nextTick( () => {
34 let rows = document.querySelectorAll('#movesList tr');
37 rows[Math.floor(newValue/2)].scrollIntoView({
46 evenNumbers: function() {
47 return [...Array(this.moves.length).keys()].filter(i => i%2==0);
51 gotoMove: function(index) {
52 this.$emit("goto-move", index);
58 <style lang="sass" scoped>
61 @media screen and (max-width: 767px)
70 background-color: plum