From 480673521c1e4b6d4a8752a73652d058244cb484 Mon Sep 17 00:00:00 2001 From: marcos Date: Fri, 13 Dec 2019 14:08:44 +0100 Subject: [PATCH] Can select with keyboard list items --- pandora_console/general/header.php | 52 +++++++++++++++++-- .../include/class/OrderInterpreter.class.php | 12 +++-- .../include/styles/order_interpreter.css | 4 ++ 3 files changed, 58 insertions(+), 10 deletions(-) diff --git a/pandora_console/general/header.php b/pandora_console/general/header.php index 2b040c13d9..36fe9bea82 100644 --- a/pandora_console/general/header.php +++ b/pandora_console/general/header.php @@ -101,7 +101,8 @@ if ($config['menu_type'] == 'classic') { if ($acl_head_search) { // Search bar. - $search_bar = '
'; + $search_bar = ''; + ''; if (!isset($config['search_keywords'])) { $search_bar .= ''; } else { @@ -112,7 +113,7 @@ if ($config['menu_type'] == 'classic') { } } - $search_bar .= ''; + $search_bar .= 'type="search" onfocus="javascript: if (fieldKeyWordEmpty) $(\'#keywords\').val(\'\');" + onkeyup="showinterpreter()" class="search_input"/>'; $search_bar .= '
'; @@ -636,10 +637,52 @@ if ($config['menu_type'] == 'classic') { var new_chat = ; function showinterpreter(){ + + if(event.keyCode == 1 && $("#result_items li.active").length != 0 ) + { + window.location = $('#result_items').find("li.active a").attr('href'); + } + var code = event.key; + switch (code){ + case 'ArrowDown': + if($("#result_items li.active").length!=0) + { + var storeTarget = $('#result_items').find("li.active").next(); + $("#result_items li.active").removeClass("active"); + storeTarget.focus().addClass("active"); + + } + else + { + $('#result_items').find("li:first").focus().addClass("active"); + } + return; + + case 'ArrowUp': + if($("#result_items li.active")) + { + var storeTarget = $('#result_items').find("li.active").prev(); + $("#result_items li.active").removeClass("active"); + storeTarget.focus().addClass("active"); + } + else + { + $('#result_items').find("li:first").focus().addClass("active"); + } + return; + + case 'ArrowRight': + return; + case 'ArrowLeft': + return; + + } + if( $('#keywords').val() === ''){ $('#keywords').addClass('search_input'); $('#keywords').removeClass('results-found'); $('#result_order').hide(); + $('#keywords').attr('placeholder','Enter keywords to search'); }else { $.ajax({ type: "POST", @@ -651,7 +694,6 @@ if ($config['menu_type'] == 'classic') { text: $('#keywords').val(), }, success: function (data) { - console.log(data); $('#result_order').html(data); }, error: function (data) { diff --git a/pandora_console/include/class/OrderInterpreter.class.php b/pandora_console/include/class/OrderInterpreter.class.php index f0d0a62d13..93cb3f4d01 100644 --- a/pandora_console/include/class/OrderInterpreter.class.php +++ b/pandora_console/include/class/OrderInterpreter.class.php @@ -247,7 +247,7 @@ class OrderInterpreter extends Wizard if ($text !== '') { echo '
'; - echo '
    '; + echo '
      '; foreach ($this->pages_menu as $key => $value) { if (preg_match( @@ -256,7 +256,7 @@ class OrderInterpreter extends Wizard ) ) { if ($iterator <= 9) { - echo '
    • '; + echo '
    • '; echo ' Go to   '; @@ -274,11 +274,12 @@ class OrderInterpreter extends Wizard } if ($iterator > 9) { - echo '

    • '; - echo '+ '.$more_results.' results found'; + echo '
    • '; } - echo '
    loadJS(); + echo '
+ + '.$more_results.' results found