From 74d41c3d11cc99b553ee1db65b87d4c99401e5f4 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 9 Apr 2023 22:44:55 +0200 Subject: [PATCH] Add support for keyboard shortcut ALT + S to open search box --- htdocs/core/class/html.form.class.php | 2 +- htdocs/main.inc.php | 28 +++++++++++++++++++++++---- 2 files changed, 25 insertions(+), 5 deletions(-) diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index c45ab42fec0..eea1047bc51 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -8401,7 +8401,7 @@ class Form return ''; } - $out = ''; + $out = ''; $formattedarrayresult = array(); diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php index bfcb5dab7ce..ce7a7a9ec8d 100644 --- a/htdocs/main.inc.php +++ b/htdocs/main.inc.php @@ -2544,7 +2544,7 @@ function top_menu_user($hideloginname = 0, $urllogout = '') */ function top_menu_quickadd() { - global $langs; + global $conf, $langs; $html = ''; @@ -2846,7 +2846,6 @@ function top_menu_bookmark() } }); - var openBookMarkDropDown = function() { event.preventDefault(); jQuery("#topmenu-bookmark-dropdown").toggleClass("open"); @@ -2991,13 +2990,16 @@ function top_menu_search() // Key map shortcut jQuery(document).keydown(function(e){ - if( e.which === 70 && e.ctrlKey && e.shiftKey ){ + if ( e.which === 70 && e.ctrlKey && e.shiftKey ) { console.log(\'control + shift + f : trigger open global-search dropdown\'); openGlobalSearchDropDown(); } + if ( e.which === 70 && e.alKey ) { + console.log(\'alt + f : trigger open global-search dropdown\'); + openGlobalSearchDropDown(); + } }); - var openGlobalSearchDropDown = function() { jQuery("#topmenu-global-search-dropdown").toggleClass("open"); jQuery("#top-global-search-input").focus(); @@ -3091,6 +3093,24 @@ function left_menu($menu_array_before, $helppagename = '', $notused = '', $menu_ ' . "\n"; $searchform .= ''; } + + // Key map shortcut + $searchform .= ''; } // Left column