diff options
author | Jörn Friedrich Dreyer <jfd@butonic.de> | 2014-12-19 16:37:44 +0100 |
---|---|---|
committer | Jörn Friedrich Dreyer <jfd@butonic.de> | 2015-01-02 10:28:41 +0100 |
commit | 8bf048376ce91f960c0df5d8807455f19a214a07 (patch) | |
tree | 2e54b6332a3cad472530ae80088cd20a62a28562 /apps/files/js/search.js | |
parent | 80ded08ec46d56476f20f3e71d5bb115e070f228 (diff) | |
download | nextcloud-server-8bf048376ce91f960c0df5d8807455f19a214a07.tar.gz nextcloud-server-8bf048376ce91f960c0df5d8807455f19a214a07.zip |
allow getting the last query
Diffstat (limited to 'apps/files/js/search.js')
-rw-r--r-- | apps/files/js/search.js | 46 |
1 files changed, 22 insertions, 24 deletions
diff --git a/apps/files/js/search.js b/apps/files/js/search.js index cd66bca4986..669def85d85 100644 --- a/apps/files/js/search.js +++ b/apps/files/js/search.js @@ -8,33 +8,30 @@ * */ (function() { - if (!OCA.Files) { - OCA.Files = {}; - } - OCA.Files.Search = { + OCA.Search.Files = { attach: function(search) { search.setFilter('files', function (query) { - if (OCA.Files.Search.fileAppLoaded()) { + if (OCA.Search.Files.fileAppLoaded()) { OCA.Files.App.fileList.setFilter(query); } }); - search.setRenderer('folder', OCA.Files.Search.renderFolderResult); - search.setRenderer('file', OCA.Files.Search.renderFileResult); - search.setRenderer('audio', OCA.Files.Search.renderAudioResult); - search.setRenderer('image', OCA.Files.Search.renderImageResult); + search.setRenderer('folder', OCA.Search.Files.renderFolderResult); + search.setRenderer('file', OCA.Search.Files.renderFileResult); + search.setRenderer('audio', OCA.Search.Files.renderAudioResult); + search.setRenderer('image', OCA.Search.Files.renderImageResult); - search.setHandler('folder', OCA.Files.Search.handleFolderClick); - search.setHandler(['file', 'audio', 'image'], OCA.Files.Search.handleFileClick); + search.setHandler('folder', OCA.Search.Files.handleFolderClick); + search.setHandler(['file', 'audio', 'image'], OCA.Search.Files.handleFileClick); }, renderFolderResult: function($row, result) { - if (OCA.Files.Search.inFileList($row, result)) { + if (OCA.Search.Files.inFileList($row, result)) { return null; } /*render folder icon, show path beneath filename, show size and last modified date on the right */ - OCA.Files.Search.updateLegacyMimetype(result); + OCA.Search.Files.updateLegacyMimetype(result); var $pathDiv = $('<div class="path"></div>').text(result.path); $row.find('td.info div.name').after($pathDiv).text(result.name); @@ -44,19 +41,19 @@ return $row; }, renderFileResult: function($row, result) { - if (OCA.Files.Search.inFileList($row, result)) { + if (OCA.Search.Files.inFileList($row, result)) { return null; } /*render preview icon, show path beneath filename, show size and last modified date on the right */ - OCA.Files.Search.updateLegacyMimetype(result); + OCA.Search.Files.updateLegacyMimetype(result); $pathDiv = $('<div class="path"></div>').text(result.path); $row.find('td.info div.name').after($pathDiv).text(result.name); $row.find('td.result a').attr('href', result.link); - if (OCA.Files.Search.fileAppLoaded()) { + if (OCA.Search.Files.fileAppLoaded()) { OCA.Files.App.fileList.lazyLoadPreview({ path: result.path, mime: result.mime, @@ -82,7 +79,7 @@ /*render preview icon, show path beneath filename, show size and last modified date on the right show Artist and Album */ - $row = OCA.Files.Search.renderFileResult($row, result); + $row = OCA.Search.Files.renderFileResult($row, result); if ($row) { $row.find('td.icon').css('background-image', 'url(' + OC.imagePath('core', 'filetypes/audio') + ')'); } @@ -92,14 +89,14 @@ /*render preview icon, show path beneath filename, show size and last modified date on the right show width and height */ - $row = OCA.Files.Search.renderFileResult($row, result); - if ($row && !OCA.Files.Search.fileAppLoaded()) { + $row = OCA.Search.Files.renderFileResult($row, result); + if ($row && !OCA.Search.Files.fileAppLoaded()) { $row.find('td.icon').css('background-image', 'url(' + OC.imagePath('core', 'filetypes/image') + ')'); } return $row; }, inFileList: function($row, result){ - if (OCA.Files.Search.fileAppLoaded() && OCA.Files.App.fileList.inList(result.name)) { + if (OCA.Search.Files.fileAppLoaded() && OCA.Files.App.fileList.inList(result.name)) { return true; } else { return false; @@ -113,7 +110,7 @@ }, handleFolderClick: function($row, result, event) { // open folder - if (OCA.Files.Search.fileAppLoaded()) { + if (OCA.Search.Files.fileAppLoaded()) { OCA.Files.App.fileList.changeDirectory(result.path); return false; } else { @@ -121,7 +118,7 @@ } }, handleFileClick: function($row, result, event) { - if (OCA.Files.Search.fileAppLoaded()) { + if (OCA.Search.Files.fileAppLoaded()) { OCA.Files.App.fileList.changeDirectory(OC.dirname(result.path)); OCA.Files.App.fileList.scrollTo(result.name); return false; @@ -130,8 +127,9 @@ } }, fileAppLoaded: function() { - return OCA.Files && OCA.Files.App; + return !!OCA.Files && !!OCA.Files.App; } }; })(); -OC.Plugins.register('OCA.Search', OCA.Files.Search); + +OC.Plugins.register('OCA.Search', OCA.Search.Files); |