Merge pull request #9519 from owncloud/search-bounce

debounce the search function
This commit is contained in:
Vincent Petry 2014-07-10 14:00:43 +02:00
commit 7af1a05266

View file

@ -380,7 +380,7 @@ var OC={
* Do a search query and display the results * Do a search query and display the results
* @param {string} query the search query * @param {string} query the search query
*/ */
search:function(query){ search: _.debounce(function(query){
if(query){ if(query){
OC.addStyle('search','results'); OC.addStyle('search','results');
$.getJSON(OC.filePath('search','ajax','search.php')+'?query='+encodeURIComponent(query), function(results){ $.getJSON(OC.filePath('search','ajax','search.php')+'?query='+encodeURIComponent(query), function(results){
@ -388,7 +388,7 @@ var OC={
OC.search.showResults(results); OC.search.showResults(results);
}); });
} }
}, }, 500),
dialogs:OCdialogs, dialogs:OCdialogs,
mtime2date:function(mtime) { mtime2date:function(mtime) {
mtime = parseInt(mtime,10); mtime = parseInt(mtime,10);