From: Laurent Mazet Date: Sat, 24 Apr 2021 11:50:13 +0000 (+0200) Subject: fix issue X-Git-Url: https://secure.softndesign.org/git/?a=commitdiff_plain;h=bccce721d35090871d88c9e62dc509e74da10d78;p=trivabble.git fix issue --- 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; } }