From 06e1d9d14fc802f370db2e6eeb4d6498a71c21e7 Mon Sep 17 00:00:00 2001 From: Zhora Shalyapin Date: Tue, 18 Mar 2025 09:55:23 +0000 Subject: [PATCH] fix toggle text --- main.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/main.js b/main.js index 9c68909..e61a6e1 100644 --- a/main.js +++ b/main.js @@ -745,6 +745,13 @@ } } + function toggleText(current, ...variants) { + let index = variants.indexOf(current) + if (index == -1) return null + + return variants[index + 1 < variants.length ? index + 1 : 0] + } + function makeSwiper(dialog, fileListContainer, src) { let files = [...fileListContainer.querySelectorAll(`:is(.preview, .preview-small)`)] @@ -1513,7 +1520,7 @@ collapseButton.addEventListener("click", () => { toggleStagePageRows(rows) - collapseButton.textContent = "Скрыть" + collapseButton.textContent = toggleText(collapseButton.textContent, "Показать", "Скрыть") }) document.querySelector(`table tr:first-child th`).append(collapseButton)