2 // Component for moves list on the right
5 props: ["moves","cursor"],
7 if (this.moves.length == 0)
9 if (this.moves[0].color == "b")
10 this.moves.unshift({color: "w", notation: "..."});
11 let tableContent = [];
13 let tableRow = undefined;
14 let moveCells = undefined;
15 let curCellContent = "";
16 for (let i=0; i<this.moves.length; i++)
18 if (this.moves[i].color == "w")
20 if (i == 0 || i>0 && this.moves[i-1].color=="b")
24 tableRow.children = moveCells;
25 tableContent.push(tableRow);
30 { domProps: { innerHTML: (++moveCounter) + "." } }
40 curCellContent += this.moves[i].notation;
41 if (i < this.moves.length-1 && this.moves[i+1].color == this.moves[i].color)
42 curCellContent += ",";
49 domProps: { innerHTML: curCellContent },
50 on: { click: () => this.gotoMove(i) },
51 "class": { "highlight-lm": this.cursor == i },
58 // Complete last row, which might not be full:
59 if (moveCells.length-1 == 1)
64 { domProps: { innerHTML: "" } }
68 tableRow.children = moveCells;
69 tableContent.push(tableRow);
82 gotoMove: function(index) {
83 this.$emit("goto-move", index);