/* * OrganonTweaks -- show the keyboard shortcuts Kanboard already binds, next to the task Actions * menu items. Display only: this adds NO key bindings, it just surfaces the existing ones (listed * in Kanboard's own "Keyboard shortcuts" help). Items are matched by their FontAwesome icon class, * so it is independent of the URL format (pretty vs query-string) and the interface language. */ (function () { "use strict"; var HINTS = [ { icon: "fa-edit", key: "e" }, // Edit the task { icon: "fa-plus", key: "s" }, // Add a sub-task { icon: "fa-comment-o", key: "c" }, // Add a comment { icon: "fa-code-fork", key: "l" } // Add internal link ]; function annotate() { var sidebar = document.querySelector(".sidebar"); if (!sidebar) { return; } HINTS.forEach(function (hint) { var icon = sidebar.querySelector("li a i." + hint.icon); if (!icon) { return; } var link = icon.closest("a"); if (!link || link.querySelector(".organon-kbd")) { return; } var kbd = document.createElement("span"); kbd.className = "organon-kbd"; kbd.textContent = hint.key; kbd.style.cssText = "margin-left:8px;padding:0 5px;border:1px solid #ccc;" + "border-radius:3px;font-family:monospace;font-size:0.85em;color:#777;background:#f7f7f7;"; link.appendChild(kbd); }); } if (document.readyState !== "loading") { annotate(); } else { document.addEventListener("DOMContentLoaded", annotate); } })();