From bccce721d35090871d88c9e62dc509e74da10d78 Mon Sep 17 00:00:00 2001 From: Laurent Mazet Date: Sat, 24 Apr 2021 13:50:13 +0200 Subject: [PATCH] fix issue --- public/trivabble.js | 32 +++++++++----------------------- 1 file changed, 9 insertions(+), 23 deletions(-) diff --git a/public/trivabble.js b/public/trivabble.js index 2aec370..ff0791b 100644 --- a/public/trivabble.js +++ b/public/trivabble.js @@ -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; } } -- 2.30.2