From 2b0d958c653a18895f51856174222b19069f0176 Mon Sep 17 00:00:00 2001 From: paoloredis Date: Tue, 3 Dec 2024 11:50:15 +0100 Subject: [PATCH] Change commands input behaviour with single result --- static/js/commands-filters.js | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/static/js/commands-filters.js b/static/js/commands-filters.js index 0c76387a8..3a1b20099 100644 --- a/static/js/commands-filters.js +++ b/static/js/commands-filters.js @@ -43,6 +43,21 @@ const FILTERS = { } }; +nameFilter = FILTERS.name.element +nameFilter.addEventListener('keydown', function (event) { + switch (event.key) { + case "Enter": + visibleCommands = document.querySelectorAll("article.flex.flex-col.gap-2.transition.relative:not([style='display: none;'])") + if (visibleCommands.length == 1) { + event.preventDefault(); + commandHref = visibleCommands[0].getElementsByTagName("a")[0].href + window.location.assign(commandHref) + }; + default: + return; + } +}); + const hiddenCards = []; function setDisabledVersions(value) {