Files
ShrinkVertically/Asset/js/shrink-vertically.js

35 lines
1.2 KiB
JavaScript
Raw Normal View History

2026-06-28 16:45:46 -03:00
/*
* 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();
}
})();