summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDan McGee <dan@archlinux.org>2014-01-28 00:27:54 +0100
committerDan McGee <dan@archlinux.org>2014-01-28 00:27:54 +0100
commit7c70083ed5b7cf0fbd1f66551c088a3c963b258c (patch)
treeeb220cf9fd7ceae52d72212dbc46d943526dfc1f
parent8af4d27cd67157b4f53286913d886d8896f7010a (diff)
downloadarchweb-7c70083ed5b7cf0fbd1f66551c088a3c963b258c.tar.gz
archweb-7c70083ed5b7cf0fbd1f66551c088a3c963b258c.tar.xz
Cleanups and enhancments to JS package search typeahead
Remove the need to press enter twice when using this typeahead box. Submit the form on enter, regardless of whether an item is selected or not. Signed-off-by: Dan McGee <dan@archlinux.org>
-rw-r--r--templates/public/index.html12
1 files changed, 11 insertions, 1 deletions
diff --git a/templates/public/index.html b/templates/public/index.html
index 58dd372..515ce58 100644
--- a/templates/public/index.html
+++ b/templates/public/index.html
@@ -224,8 +224,18 @@ function setupTypeahead() {
matcher: function(item) { return true; },
sorter: function(items) { return items; },
menu: '<ul class="pkgsearch-typeahead"></ul>',
- items: 10
+ items: 10,
+ updater: function(item) {
+ $('#pkgsearch-form').submit();
+ return item;
+ }
}).attr('autocomplete', 'off');
+ $('#pkgsearch-field').keyup(function(e) {
+ if (e.keyCode === 13 &&
+ $('ul.pkgsearch-typeahead li.active').size() === 0) {
+ $('#pkgsearch-form').submit();
+ }
+ });
}
function setupKonami() {
var konami = new Konami(function() {