summaryrefslogtreecommitdiffstats
path: root/apps/files/js
diff options
context:
space:
mode:
authorJörn Friedrich Dreyer <jfd@butonic.de>2013-09-19 05:49:45 -0700
committerJörn Friedrich Dreyer <jfd@butonic.de>2013-09-19 05:49:45 -0700
commit9f9eb1b08f7b677e1b64af4d101d974b6bb326f8 (patch)
treee3a82786971c884712e8cce142b8e11215e8eddf /apps/files/js
parentae4775a68315c2aaab3f15c8baf8dbd6ee8ccf7a (diff)
parentc2e413e8528835929e6ca60ade0f5a3ad7a210bd (diff)
downloadnextcloud-server-9f9eb1b08f7b677e1b64af4d101d974b6bb326f8.tar.gz
nextcloud-server-9f9eb1b08f7b677e1b64af4d101d974b6bb326f8.zip
Merge pull request #4263 from owncloud/search_scrollto
initial scrollto implementation
Diffstat (limited to 'apps/files/js')
-rw-r--r--apps/files/js/filelist.js41
-rw-r--r--apps/files/js/files.js5
2 files changed, 41 insertions, 5 deletions
diff --git a/apps/files/js/filelist.js b/apps/files/js/filelist.js
index b50d46c98d3..9a2d39c3652 100644
--- a/apps/files/js/filelist.js
+++ b/apps/files/js/filelist.js
@@ -643,6 +643,37 @@ var FileList={
if (FileList._maskTimeout){
window.clearTimeout(FileList._maskTimeout);
}
+ },
+ scrollTo:function(file) {
+ //scroll to and highlight preselected file
+ var scrolltorow = $('tr[data-file="'+file+'"]');
+ if (scrolltorow.length > 0) {
+ 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').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.length !== 0) {
+ $(window).scrollTop(first.position().top);
+ }
+ },
+ unfilter:function(){
+ $('#fileList tr.searchresult').each(function(i,e){
+ $(e).removeClass("searchresult");
+ });
}
};
@@ -818,16 +849,16 @@ $(document).ready(function(){
FileList.replaceIsNewFile = null;
}
FileList.lastAction = null;
- OC.Notification.hide();
+ OC.Notification.hide();
});
$('#notification:first-child').on('click', '.replace', function() {
- OC.Notification.hide(function() {
- FileList.replace($('#notification > span').attr('data-oldName'), $('#notification > span').attr('data-newName'), $('#notification > span').attr('data-isNewFile'));
- });
+ OC.Notification.hide(function() {
+ FileList.replace($('#notification > span').attr('data-oldName'), $('#notification > span').attr('data-newName'), $('#notification > span').attr('data-isNewFile'));
+ });
});
$('#notification:first-child').on('click', '.suggest', function() {
$('tr').filterAttr('data-file', $('#notification > span').attr('data-oldName')).show();
- OC.Notification.hide();
+ OC.Notification.hide();
});
$('#notification:first-child').on('click', '.cancel', function() {
if ($('#notification > span').attr('data-isNewFile')) {
diff --git a/apps/files/js/files.js b/apps/files/js/files.js
index c2418cfa751..a4fdf383339 100644
--- a/apps/files/js/files.js
+++ b/apps/files/js/files.js
@@ -384,6 +384,11 @@ $(document).ready(function() {
}
});
}
+
+ //scroll to and highlight preselected file
+ if (getURLParameter('scrollto')) {
+ FileList.scrollTo(getURLParameter('scrollto'));
+ }
});
function scanFiles(force, dir, users){