diff options
author | Bernhard Posselt <dev@bernhard-posselt.com> | 2015-03-21 12:24:39 +0100 |
---|---|---|
committer | Bernhard Posselt <dev@bernhard-posselt.com> | 2015-03-21 13:36:50 +0100 |
commit | 6c2ff7efef4b316358f6b22d742a2ada2339d45c (patch) | |
tree | 09263994e75da7ebc008ba780fc653fda63c92e6 /js/build/app.js | |
parent | 7b7b0fd5eefddf03a94274f99b8e117c9651166b (diff) |
only search on enter to counter focus issues
Diffstat (limited to 'js/build/app.js')
-rw-r--r-- | js/build/app.js | 16 |
1 files changed, 5 insertions, 11 deletions
diff --git a/js/build/app.js b/js/build/app.js index d383c012f..dea34087a 100644 --- a/js/build/app.js +++ b/js/build/app.js @@ -2845,11 +2845,9 @@ app.directive('newsScroll', ["$timeout", "ITEM_AUTO_PAGE_SIZE", "MARK_READ_TIMEO } }; }]); -app.directive('newsSearch', ["$document", "$timeout", "$location", function ($document, $timeout, $location) { +app.directive('newsSearch', ["$document", "$location", function ($document, $location) { 'use strict'; - var timer; - return { restrict: 'E', scope: { @@ -2859,17 +2857,13 @@ app.directive('newsSearch', ["$document", "$timeout", "$location", function ($do var box = $('#searchbox'); box.val($location.search().search); - box.on('search keyup', function () { - var value = $(this).val(); - if (timer) { - $timeout.cancel(timer); - } - - timer = $timeout(function () { + box.on('keyup', function (e) { + if (e.keyCode === 13) { + var value = $(this).val(); scope.$apply(function () { scope.onSearch(value); }); - }, 500); + } }); // carry over search on route change |