diff --git a/web/html/home.php b/web/html/home.php index ddbb0fd..6589230 100644 --- a/web/html/home.php +++ b/web/html/home.php @@ -118,8 +118,25 @@ $(document).ready(function() { matcher: function(item) { return true; }, sorter: function(items) { return items; }, menu: '', - items: 20 + items: 20, + updater: function(item) { + // Jump to package page directly if the user selects a package from + // the list + document.location = '/packages/' + item; + return item; + } }).attr('autocomplete', 'off'); + + // If the user presses enter and did not explicitly select a package from + // the dropdown list, don't interfere and submit the search form + $('#pkgsearch-field').keydown( function(e) { + if (e.keyCode == 13) { + var selectedItem = $('ul.pkgsearch-typeahead li.active'); + if (selectedItem.length == 0) { + $('#pkgsearch-form').submit(); + } + } + }); });