From 59fa052cea21d1997d5971a16b360dbd17290b94 Mon Sep 17 00:00:00 2001 From: Hugo Gonzalez Labrador Date: Tue, 7 Jul 2015 08:53:58 +0200 Subject: [PATCH] Search on type enter and not on type any letter --- core/search/js/search.js | 27 +++++++++++++-------------- 1 file changed, 13 insertions(+), 14 deletions(-) diff --git a/core/search/js/search.js b/core/search/js/search.js index c7feeacf42e0..7defb0caea7a 100644 --- a/core/search/js/search.js +++ b/core/search/js/search.js @@ -294,6 +294,18 @@ }); $searchBox.keyup(function(event) { if (event.keyCode === 13) { //enter + var query = $searchBox.val(); + if (lastQuery !== query) { + currentResult = -1; + if (query.length > 2) { + self.search(query); + } else { + self.hideResults(); + } + if(self.hasFilter(getCurrentApp())) { + self.getFilter(getCurrentApp())(query); + } + } if(currentResult > -1) { var result = $searchResults.find('tr.result a')[currentResult]; window.location = $(result).attr('href'); @@ -308,19 +320,6 @@ currentResult++; renderCurrent(); } - } else { - var query = $searchBox.val(); - if (lastQuery !== query) { - currentResult = -1; - if (query.length > 2) { - self.search(query); - } else { - self.hideResults(); - } - if(self.hasFilter(getCurrentApp())) { - self.getFilter(getCurrentApp())(query); - } - } } }); $(document).keyup(function(event) { @@ -383,4 +382,4 @@ OC.search.customResults = {}; /** * @deprecated use get/setRenderer() instead */ -OC.search.resultTypes = {}; \ No newline at end of file +OC.search.resultTypes = {};