fix issue

This commit is contained in:
Laurent Mazet 2021-04-24 13:50:13 +02:00
parent 8c5c06e543
commit bccce721d3
1 changed files with 9 additions and 23 deletions

View File

@ -2312,39 +2312,25 @@
}
function initCellCaptions() {
setCellCaptions(getSetting("CELL_CAPTIONS"));
document.getElementById("cell-captions").onclick = function () {
setCellCaptions(document.getElementById("cell-captions").value);
};
setCellCaptions(getSetting("CELL_CAPTIONS"));
}
function setCellCaptions(mode) {
setSetting("CELL_CAPTIONS", mode);
document.getElementById("cell-captions").value = mode;
if (board.classList.contains("special-cell-label-short")) {
board.classList.remove("special-cell-label-short");
board.classList.remove("special-cell-label-short");
board.classList.remove("special-cell-label-clip");
board.classList.remove("special-cell-label-dots");
board.classList.remove("special-cell-label-none");
if (mode !== "short") {
for (const cell of [].slice.call(document.getElementsByClassName("special-cell-label"))) {
if (cell.textContent !== "★") {
cell.textContent = cell.longText;
}
}
}
} else {
board.classList.remove("special-cell-label-clip");
board.classList.remove("special-cell-label-dots");
board.classList.remove("special-cell-label-none");
if (mode === "short") {
for (const cell of [].slice.call(document.getElementsByClassName("special-cell-label"))) {
if (cell.textContent !== "★") {
cell.textContent = cell.shortText;
}
}
for (const cell of [].slice.call(document.getElementsByClassName("special-cell-label"))) {
if (cell.textContent !== "★") {
cell.textContent = (mode === "short") ? cell.shortText : cell.longText;
}
}