Inspiration for refactor:
https://github.com/triestpa/Vue-Chess/blob/master/src/components/chessboard/chessboard.js
https://github.com/gustaYo/vue-chess
+
+Server:
+Later: use http2
+https://webapplog.com/http2-node/
+https://www.npmjs.com/package/spdy
+Express 5?
td.highlight-lm
background-color: plum
</style>
-
-<!-- Old render method:
- render(h) {
- if (this.moves.length == 0)
- return;
- let tableContent = [];
- let moveCounter = 0;
- let tableRow = undefined;
- let moveCells = undefined;
- let curCellContent = "";
- for (let i=0; i<this.moves.length; i++)
- {
- if (this.moves[i].color == "w")
- {
- if (i == 0 || i>0 && this.moves[i-1].color=="b")
- {
- if (!!tableRow)
- {
- tableRow.children = moveCells;
- tableContent.push(tableRow);
- }
- moveCells = [
- h(
- "td",
- { domProps: { innerHTML: (++moveCounter) + "." } }
- )
- ];
- tableRow = h(
- "tr",
- { }
- );
- curCellContent = "";
- }
- }
- curCellContent += this.moves[i].notation;
- if (i < this.moves.length-1 && this.moves[i+1].color == this.moves[i].color)
- curCellContent += ",";
- else //color change
- {
- moveCells.push(
- h(
- "td",
- {
- domProps: { innerHTML: curCellContent },
- on: { click: () => this.gotoMove(i) },
- "class": { "highlight-lm": this.cursor == i },
- }
- )
- );
- curCellContent = "";
- }
- }
- // Complete last row, which might not be full:
- if (moveCells.length-1 == 1)
- {
- moveCells.push(
- h(
- "td",
- { domProps: { innerHTML: "" } }
- )
- );
- }
- tableRow.children = moveCells;
- tableContent.push(tableRow);
- const scoreDiv = h("div",
- {
- id: "scoreInfo",
- style: {
- display: this.score!="*" ? "block" : "none",
- },
- },
- [
- h("p", this.score),
- h("p", this.message),
- ]
- );
- const movesTable = h(
- "div",
- { },
- [
- scoreDiv,
- h(
- "table",
- {
- "class": {
- "moves-list": true,
- },
- },
- tableContent
- )
- ]
- );
- return movesTable;
- },
--->