summaryrefslogtreecommitdiffstats
path: root/apps
diff options
context:
space:
mode:
authorJörn Friedrich Dreyer <jfd@butonic.de>2013-07-31 22:24:52 +0200
committerJörn Friedrich Dreyer <jfd@butonic.de>2013-09-17 18:40:51 +0200
commitb40925ae1747ae44a52fb1f8dcf7645d022c6f13 (patch)
tree2f385e6b79de01305aa718c197fdc3c85e5ff4cd /apps
parent9d18e16c77e8c2690dd23dd19ca1f8e1968161c8 (diff)
downloadnextcloud-server-b40925ae1747ae44a52fb1f8dcf7645d022c6f13.tar.gz
nextcloud-server-b40925ae1747ae44a52fb1f8dcf7645d022c6f13.zip
initial scrollto implementation:
use places/folder icon, move link construction to JS, only show icon on hover, use 'searchresult' as css class name, add filter/unfilter methods, highlight searched files in current filelist only filter when correct FileList is present
Diffstat (limited to 'apps')
-rw-r--r--apps/files/css/files.css3
-rw-r--r--apps/files/js/filelist.js41
-rw-r--r--apps/files/js/files.js5
3 files changed, 44 insertions, 5 deletions
diff --git a/apps/files/css/files.css b/apps/files/css/files.css
index 41d9808c56b..0acb3c5d829 100644
--- a/apps/files/css/files.css
+++ b/apps/files/css/files.css
@@ -76,6 +76,9 @@
#filestable tbody tr.selected {
background-color: rgb(230,230,230);
}
+#filestable tbody tr.searchresult {
+ background-color: rgb(240,240,240);
+}
tbody a { color:#000; }
span.extension, span.uploading, td.date { color:#999; }
span.extension { text-transform:lowercase; -ms-filter:"progid:DXImageTransform.Microsoft.Alpha(Opacity=70)"; filter:alpha(opacity=70); opacity:.7; -webkit-transition:opacity 300ms; -moz-transition:opacity 300ms; -o-transition:opacity 300ms; transition:opacity 300ms; }
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){