Skip to content

Commit

Permalink
Search on type enter and not on type any letter
Browse files Browse the repository at this point in the history
  • Loading branch information
Hugo Gonzalez Labrador committed Jul 7, 2015
1 parent 4f1f426 commit 59fa052
Showing 1 changed file with 13 additions and 14 deletions.
27 changes: 13 additions & 14 deletions core/search/js/search.js
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand All @@ -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) {
Expand Down Expand Up @@ -383,4 +382,4 @@ OC.search.customResults = {};
/**
* @deprecated use get/setRenderer() instead
*/
OC.search.resultTypes = {};
OC.search.resultTypes = {};

0 comments on commit 59fa052

Please sign in to comment.