diff options
author | Jörn Friedrich Dreyer <jfd@butonic.de> | 2013-09-19 18:15:17 +0400 |
---|---|---|
committer | Jörn Friedrich Dreyer <jfd@butonic.de> | 2014-06-05 21:23:44 +0400 |
commit | 3510674d2445dab7fe5d58187d2275ab11a8de4b (patch) | |
tree | 67e8b176406c8ff40fca9cca25514fe374c7571f /search | |
parent | 9b63f945e3ecbbb372ac7ac4d9017f933fcee02b (diff) |
use path param to create scrollto url
Diffstat (limited to 'search')
-rw-r--r-- | search/js/result.js | 27 |
1 files changed, 16 insertions, 11 deletions
diff --git a/search/js/result.js b/search/js/result.js index 856330414a0..d2d68145304 100644 --- a/search/js/result.js +++ b/search/js/result.js @@ -57,22 +57,26 @@ OC.search.showResults=function(results){ var row=$('#searchresults tr.template').clone(); row.removeClass('template'); row.addClass('result'); + row.data('type', typeid); row.data('name', type[i].name); row.data('text', type[i].text); - row.data('container', type[i].container); + row.data('index',index); + if (i === 0){ row.children('td.type').text(typeid); } row.find('td.result div.name').text(type[i].name); row.find('td.result div.text').text(type[i].text); - if (type[i].container) { - var containerName = OC.basename(type[i].container); + + if (type[i].path) { + var parent = OC.dirname(type[i].path); + var containerName = OC.basename(parent); if (containerName === '') { containerName = '/'; } var containerLink = OC.linkTo('files', 'index.php') - +'?dir='+encodeURIComponent(type[i].container) + +'?dir='+encodeURIComponent(parent) +'&scrollto='+encodeURIComponent(type[i].name); row.find('td.result a') .attr('href', containerLink) @@ -80,10 +84,11 @@ OC.search.showResults=function(results){ } else { row.find('td.result a').attr('href', type[i].link); } - row.data('index',index); + index++; - if(OC.search.customResults[typeid]){//give plugins the ability to customize the entries in here - OC.search.customResults[typeid](row,type[i]); + //give plugins the ability to customize the entries in here + if(OC.search.customResults[typeid]){ + OC.search.customResults[typeid](row, type[i]); } $('#searchresults tbody').append(row); } @@ -114,19 +119,19 @@ OC.search.customResults.file = function (row, item) { if(row.children('td.type').text() === 'file') { row.children('td.type').text(t('lib','Files')); }; -} +}; OC.search.customResults.folder = function (row, item) { if(row.children('td.type').text() === 'folder') { row.children('td.type').text(t('lib','Folders')); }; -} +}; OC.search.customResults.image = function (row, item) { if(row.children('td.type').text() === 'image') { row.children('td.type').text(t('lib','Images')); }; -} +}; OC.search.customResults.audio = function (row, item) { if(row.children('td.type').text() === 'audio') { row.children('td.type').text(t('lib','Audio')); }; -} +}; |