diff options
author | Jörn Friedrich Dreyer <jfd@butonic.de> | 2014-12-10 17:11:02 +0100 |
---|---|---|
committer | Jörn Friedrich Dreyer <jfd@butonic.de> | 2015-01-02 10:28:41 +0100 |
commit | 088323aad5de7b2fadd3c26a10cf4bdf51b5ae73 (patch) | |
tree | e2d531409d9514b61319d1fae0b8e741813b4b0b /core/js | |
parent | d3662722f66eb5b97593922a11e5357eff0fb042 (diff) | |
download | nextcloud-server-088323aad5de7b2fadd3c26a10cf4bdf51b5ae73.tar.gz nextcloud-server-088323aad5de7b2fadd3c26a10cf4bdf51b5ae73.zip |
move code from js.js to search.js in the search app
Diffstat (limited to 'core/js')
-rw-r--r-- | core/js/js.js | 61 |
1 files changed, 3 insertions, 58 deletions
diff --git a/core/js/js.js b/core/js/js.js index 9d62b7cac1e..60237a7fe83 100644 --- a/core/js/js.js +++ b/core/js/js.js @@ -308,22 +308,9 @@ var OC={ * Do a search query and display the results * @param {string} query the search query */ - search: _.debounce(function(query){ - if(query){ - OC.addStyle('search','results'); - var classList = document.getElementById('content').className.split(/\s+/); - var inApps = []; - for (var i = 0; i < classList.length; i++) { - if (classList[i].indexOf('app-') === 0) { - var inApps = [classList[i].substr(4)]; - } - } - $.getJSON(OC.generateUrl('search/ajax/search.php'), {inApps:inApps, query:query}, function(results){ - OC.Search.lastResults=results; - OC.Search.showResults(results); - }); - } - }, 500), + search: function (query) { + OC.Search.search(query) + }, /** * Dialog helper for jquery dialogs. * @@ -1075,48 +1062,6 @@ function initCore() { }else{ SVGSupport.checkMimeType(); } - $('form.searchbox').submit(function(event){ - event.preventDefault(); - }); - $('#searchbox').keyup(function(event){ - if(event.keyCode===13){//enter - if(OC.Search.currentResult>-1){ - var result=$('#searchresults tr.result a')[OC.Search.currentResult]; - window.location = $(result).attr('href'); - } - }else if(event.keyCode===38){//up - if(OC.Search.currentResult>0){ - OC.Search.currentResult--; - OC.Search.renderCurrent(); - } - }else if(event.keyCode===40){//down - if(OC.Search.lastResults.length>OC.Search.currentResult+1){ - OC.Search.currentResult++; - OC.Search.renderCurrent(); - } - }else if(event.keyCode===27){//esc - OC.Search.hide(); - if (FileList && typeof FileList.unfilter === 'function') { //TODO add hook system - FileList.unfilter(); - } - }else{ - var query=$('#searchbox').val(); - if(OC.Search.lastQuery!==query){ - OC.Search.lastQuery=query; - OC.Search.currentResult=-1; - if (FileList && typeof FileList.filter === 'function') { //TODO add hook system - FileList.filter(query); - } - if(query.length>2){ - OC.search(query); - }else{ - if(OC.Search.hide){ - OC.Search.hide(); - } - } - } - } - }); // user menu $('#settings #expand').keydown(function(event) { |