diff options
Diffstat (limited to 'apps/files/js/filelist.js')
-rw-r--r-- | apps/files/js/filelist.js | 35 |
1 files changed, 33 insertions, 2 deletions
diff --git a/apps/files/js/filelist.js b/apps/files/js/filelist.js index 40a4ae95c98..7863903fa19 100644 --- a/apps/files/js/filelist.js +++ b/apps/files/js/filelist.js @@ -130,7 +130,7 @@ var FileList={ if (hidden) { tr.hide(); } - FileActions.display(tr.find('td.filename')); + FileActions.display(tr.find('td.filename'), true); return tr; }, refresh:function(data) { @@ -367,6 +367,37 @@ var FileList={ }); } }); + }, + scrollTo:function(file) { + //scroll to and highlight preselected file + var $scrolltorow = $('tr[data-file="'+file+'"]'); + if ($scrolltorow.exists()) { + $scrolltorow.addClass('searchresult'); + $(window).scrollTop($scrolltorow.position().top); + //remove highlight when hovered over + $scrolltorow.one('hover', function() { + $scrolltorow.removeClass('searchresult'); + }); + } + }, + filter:function(query) { + $('#fileList tr:not(.summary)').each(function(i,e) { + if ($(e).data('file').toString().toLowerCase().indexOf(query.toLowerCase()) !== -1) { + $(e).addClass("searchresult"); + } else { + $(e).removeClass("searchresult"); + } + }); + //do not use scrollto to prevent removing searchresult css class + var first = $('#fileList tr.searchresult').first(); + if (first.exists()) { + $(window).scrollTop(first.position().top); + } + }, + unfilter:function() { + $('#fileList tr.searchresult').each(function(i,e) { + $(e).removeClass("searchresult"); + }); } }; @@ -473,7 +504,7 @@ $(document).ready(function(){ data.context.attr('data-permissions', file.permissions); data.context.data('permissions', file.permissions); } - FileActions.display(data.context.find('td.filename')); + FileActions.display(data.context.find('td.filename'), true); if (FileList.loadingDone) { FileList.loadingDone(file.name, file.id); } |