summaryrefslogtreecommitdiffstats
path: root/web/html/home.php
diff options
context:
space:
mode:
authorJoris Steyn <jorissteyn@gmail.com>2014-01-11 12:03:01 +0100
committerLukas Fleischer <archlinux@cryptocrack.de>2014-01-11 12:04:33 +0100
commit72e4d5417836faa3bc23e21d1054bc6c298bf4ae (patch)
treed4105bd38dcd79135a1320abd2cbcc6f2e6d7c06 /web/html/home.php
parent0d68494de76b76861c47df9c56a66d5f07e6c08d (diff)
downloadaurweb-72e4d5417836faa3bc23e21d1054bc6c298bf4ae.tar.xz
Typeahead workaround for having to press enter twice
Currently, one has to press enter twice in order to submit the package search form with typeahead completion. Add a workaround to fix this. Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
Diffstat (limited to 'web/html/home.php')
-rw-r--r--web/html/home.php9
1 files changed, 9 insertions, 0 deletions
diff --git a/web/html/home.php b/web/html/home.php
index e80efaa..62c246a 100644
--- a/web/html/home.php
+++ b/web/html/home.php
@@ -124,6 +124,15 @@ $(document).ready(function() {
return item;
}
}).attr('autocomplete', 'off');
+
+ $('#pkgsearch-field').keydown(function(e) {
+ if (e.keyCode == 13) {
+ var selectedItem = $('ul.pkgsearch-typeahead li.active');
+ if (selectedItem.length == 0) {
+ $('#pkgsearch-form').submit();
+ }
+ }
+ });
});
</script>
<?php