fix toggle text

This commit is contained in:
Zhora Shalyapin 2025-03-18 09:55:23 +00:00
parent 10a8c9bcb2
commit 06e1d9d14f

View File

@ -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) { function makeSwiper(dialog, fileListContainer, src) {
let files = [...fileListContainer.querySelectorAll(`:is(.preview, .preview-small)`)] let files = [...fileListContainer.querySelectorAll(`:is(.preview, .preview-small)`)]
@ -1513,7 +1520,7 @@
collapseButton.addEventListener("click", () => { collapseButton.addEventListener("click", () => {
toggleStagePageRows(rows) toggleStagePageRows(rows)
collapseButton.textContent = "Скрыть" collapseButton.textContent = toggleText(collapseButton.textContent, "Показать", "Скрыть")
}) })
document.querySelector(`table tr:first-child th`).append(collapseButton) document.querySelector(`table tr:first-child th`).append(collapseButton)