diff options
author | Jörn Friedrich Dreyer <jfd@butonic.de> | 2014-12-02 17:31:04 +0100 |
---|---|---|
committer | Jörn Friedrich Dreyer <jfd@butonic.de> | 2014-12-10 15:51:59 +0100 |
commit | 1d490b559ce279f5c9f44b727fe9d71d3718a24b (patch) | |
tree | 5520065370f6874c80eb8a5be38e2b284d4e292f /core/js/js.js | |
parent | e9029f94cb6eb9b37623ea1a2faf8aac11675900 (diff) | |
download | nextcloud-server-1d490b559ce279f5c9f44b727fe9d71d3718a24b.tar.gz nextcloud-server-1d490b559ce279f5c9f44b727fe9d71d3718a24b.zip |
introduce inApps[] filter for search via ajax query, make file results show up in files app only
use more flexible return type
check array with !empty instead of count
Diffstat (limited to 'core/js/js.js')
-rw-r--r-- | core/js/js.js | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/core/js/js.js b/core/js/js.js index eb2f10b51f0..e62a5474426 100644 --- a/core/js/js.js +++ b/core/js/js.js @@ -292,7 +292,14 @@ var OC={ search: _.debounce(function(query){ if(query){ OC.addStyle('search','results'); - $.getJSON(OC.filePath('search','ajax','search.php')+'?query='+encodeURIComponent(query), function(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); }); |