From 8b97480e2e90ce327f7452886e1581f34b1ad5ae Mon Sep 17 00:00:00 2001 From: Ruben Carlo Benante Date: Sun, 28 Jun 2026 16:45:46 -0300 Subject: [PATCH] more shrink, and a + t1 --- Asset/js/shrink-vertically.js | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 Asset/js/shrink-vertically.js diff --git a/Asset/js/shrink-vertically.js b/Asset/js/shrink-vertically.js new file mode 100644 index 0000000..0aa205b --- /dev/null +++ b/Asset/js/shrink-vertically.js @@ -0,0 +1,34 @@ +/* + * ShrinkVertically -- mark the two vertical-collapse menu items so it is obvious the + * behaviour comes from this plugin and not from Kanboard core. + * + * Core renders these labels in app/Template/project_header/dropdown.php: + * .filter-vert-collapse .filter-vert-toggle-collapse -> "Collapse vertically" + * .filter-vert-expand .filter-vert-toggle-collapse -> "Expand vertically" + * + * We append a "+" to each so they read "Collapse vertically+" / "Expand vertically+". + * This is locale-independent (it edits the rendered text, not the translation table). + */ +(function () { + "use strict"; + + function addPlus() { + var links = document.querySelectorAll( + ".filter-vert-collapse .filter-vert-toggle-collapse, " + + ".filter-vert-expand .filter-vert-toggle-collapse" + ); + + for (var i = 0; i < links.length; i++) { + var text = links[i].textContent; + if (text.charAt(text.length - 1) !== "+") { + links[i].textContent = text + "+"; + } + } + } + + if (document.readyState === "loading") { + document.addEventListener("DOMContentLoaded", addPlus); + } else { + addPlus(); + } +})();