aboutsummaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorMorris Jobke <hey@morrisjobke.de>2015-01-06 16:44:58 +0100
committerMorris Jobke <hey@morrisjobke.de>2015-01-06 16:44:58 +0100
commitfe4592937a7139164eeb0b8131f6e8ba559eaa67 (patch)
tree664cbec226a0b3f563388c2c15c3260849eab002 /core
parent622c4cf77903470bc7ddc1df5b74d5e17a0e70c7 (diff)
parent04e2f59f5d3bc8d3e2a5e0756f1f2f47735e1ec3 (diff)
downloadnextcloud-server-fe4592937a7139164eeb0b8131f6e8ba559eaa67.tar.gz
nextcloud-server-fe4592937a7139164eeb0b8131f6e8ba559eaa67.zip
Merge pull request #12653 from owncloud/full_content_search_results
Full content width search results
Diffstat (limited to 'core')
-rw-r--r--core/ajax/preview.php2
-rw-r--r--core/js/core.json3
-rw-r--r--core/js/js.js71
3 files changed, 12 insertions, 64 deletions
diff --git a/core/ajax/preview.php b/core/ajax/preview.php
index 56ef5ea847b..03dfb483062 100644
--- a/core/ajax/preview.php
+++ b/core/ajax/preview.php
@@ -40,9 +40,9 @@ try {
$preview->setMaxY($maxY);
$preview->setScalingUp($scalingUp);
$preview->setKeepAspect($keepAspect);
+ $preview->showPreview();
}
- $preview->showPreview();
} catch (\Exception $e) {
\OC_Response::setStatus(500);
\OC_Log::write('core', $e->getmessage(), \OC_Log::DEBUG);
diff --git a/core/js/core.json b/core/js/core.json
index d3a9e2404e8..101a88cd4f0 100644
--- a/core/js/core.json
+++ b/core/js/core.json
@@ -22,6 +22,7 @@
"eventsource.js",
"config.js",
"multiselect.js",
- "oc-requesttoken.js"
+ "oc-requesttoken.js",
+ "../../search/js/search.js"
]
}
diff --git a/core/js/js.js b/core/js/js.js
index 57ce1ab6955..8bcd546b420 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, null, 0, 30);
+ },
/**
* Dialog helper for jquery dialogs.
*
@@ -608,10 +595,12 @@ OC.Plugins = {
/**
* @namespace OC.search
*/
-OC.search.customResults={};
-OC.search.currentResult=-1;
-OC.search.lastQuery='';
-OC.search.lastResults={};
+OC.search.customResults = {};
+/**
+ * @deprecated use get/setFormatter() instead
+ */
+OC.search.resultTypes = {};
+
OC.addStyle.loaded=[];
OC.addScript.loaded=[];
@@ -1038,48 +1027,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) {