2 // Component for moves list on the right
5 props: ["moves","cursor"],
12 if (this.moves.length == 0)
14 if (this.moves[0].color == "b")
15 this.moves.unshift({color: "w", notation: "..."});
16 let tableContent = [];
18 let tableRow = undefined;
19 let moveCells = undefined;
20 let curCellContent = "";
21 for (let i=0; i<this.moves.length; i++)
23 if (this.moves[i].color == "w")
25 if (i == 0 || i>0 && this.moves[i-1].color=="b")
29 tableRow.children = moveCells;
30 tableContent.push(tableRow);
35 { domProps: { innerHTML: (++moveCounter) + "." } }
45 curCellContent += this.moves[i].notation;
46 if (i < this.moves.length-1 && this.moves[i+1].color == this.moves[i].color)
47 curCellContent += ",";
54 domProps: { innerHTML: curCellContent },
55 on: { click: () => this.gotoMove(i) },
56 "class": { "highlight-lm": this.cursor == i },
63 // Complete last row, which might not be full:
64 if (moveCells.length-1 == 1)
69 { domProps: { innerHTML: "" } }
73 tableRow.children = moveCells;
74 tableContent.push(tableRow);
83 gotoMove: function(index) {
84 this.$emit("goto-move", index);