correct board design

This commit is contained in:
Laurent Mazet 2020-10-07 21:41:11 +02:00 committed by Raphaël Jakse
parent c5ccb93eef
commit 82b38df25d
1 changed files with 9 additions and 8 deletions

View File

@ -2223,6 +2223,7 @@
};
let cell;
let row
for (let i = 0; i < 7; i++) {
const span = document.createElement("span");
@ -2235,7 +2236,7 @@
board.rows[0].appendChild(document.createElement("th"));
board.rows[0].lastChild.textContent = i + 1;
const row = board.insertRow(-1);
row = board.insertRow(-1);
row.appendChild(document.createElement("th"));
row.lastChild.textContent = letters[i];
@ -2248,18 +2249,18 @@
cell.lastChild.className = "tile-placeholder";
if (i === j && i === 7) {
specialCell("doubleWord", board.lastChild.lastChild);
cell = board.lastChild.lastChild.getElementsByClassName("special-cell-label")[0];
specialCell("doubleWord", row.lastChild);
cell = row.lastChild.getElementsByClassName("special-cell-label")[0];
cell.textContent = "★";
row.lastChild.id = "center-cell";
} else if (i % 7 === 0 && j % 7 === 0) {
specialCell("tripleWord", board.lastChild.lastChild);
specialCell("tripleWord", row.lastChild);
} else if ((i === j || i + j === 14) && (i < 5 || i > 9)) {
specialCell("doubleWord", board.lastChild.lastChild);
specialCell("doubleWord", row.lastChild);
} else if ((i % 4 === 1) && (j % 4 === 1)) {
specialCell("tripleLetter", board.lastChild.lastChild);
specialCell("tripleLetter", row.lastChild);
} else if ((i < 8 && doubleLetter[i + "," + j]) || (i > 7 && doubleLetter[(14 - i) + "," + j]) || (i === 7 && (j === 3 || j === 11))) {
specialCell("doubleLetter", board.lastChild.lastChild);
specialCell("doubleLetter", row.lastChild);
}
}
@ -2269,7 +2270,7 @@
board.rows[0].appendChild(board.rows[0].cells[0].cloneNode(false));
const row = board.insertRow(-1);
row = board.insertRow(-1);
row.appendChild(board.rows[0].cells[0].cloneNode(false));
for (let i = 0; i < 15; i++) {