summaryrefslogtreecommitdiffstats
path: root/js/directive/NewsSearch.js
diff options
context:
space:
mode:
Diffstat (limited to 'js/directive/NewsSearch.js')
-rw-r--r--js/directive/NewsSearch.js16
1 files changed, 5 insertions, 11 deletions
diff --git a/js/directive/NewsSearch.js b/js/directive/NewsSearch.js
index 4005c2db7..cee956109 100644
--- a/js/directive/NewsSearch.js
+++ b/js/directive/NewsSearch.js
@@ -7,11 +7,9 @@
* @author Bernhard Posselt <dev@bernhard-posselt.com>
* @copyright Bernhard Posselt 2014
*/
-app.directive('newsSearch', function ($document, $timeout, $location) {
+app.directive('newsSearch', function ($document, $location) {
'use strict';
- var timer;
-
return {
restrict: 'E',
scope: {
@@ -21,17 +19,13 @@ app.directive('newsSearch', function ($document, $timeout, $location) {
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