Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/server.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/files
diff options
context:
space:
mode:
authorMichael Gapczynski <GapczynskiM@gmail.com>2011-08-28 23:21:53 +0400
committerMichael Gapczynski <GapczynskiM@gmail.com>2011-08-28 23:21:53 +0400
commitaffc879cde972aca84688f47bca15e66ea5f7505 (patch)
tree4c4cd6119207c89f3ec491686029a04ef8a857e4 /files
parenta695aa307142505aa5c1519ed47bdf320d95b46e (diff)
Shift+Click multiselect for files
Diffstat (limited to 'files')
-rw-r--r--files/js/files.js42
1 files changed, 38 insertions, 4 deletions
diff --git a/files/js/files.js b/files/js/files.js
index f30f80aee85..7b37837d9cc 100644
--- a/files/js/files.js
+++ b/files/js/files.js
@@ -26,11 +26,30 @@ $(document).ready(function() {
FileActions.hide();
});
+ var lastChecked;
+
// Sets the file link behaviour :
$('td.filename a').live('click',function(event) {
- if (event.ctrlKey) {
- event.preventDefault();
+ event.preventDefault();
+ if (event.ctrlKey || event.shiftKey) {
+ if (event.shiftKey) {
+ var last = $(lastChecked).parent().parent().prevAll().length;
+ var first = $(this).parent().parent().prevAll().length;
+ var start = Math.min(first, last);
+ var end = Math.max(first, last);
+ var rows = $(this).parent().parent().parent().children('tr');
+ for (var i = start; i < end; i++) {
+ $(rows).each(function(index) {
+ if (index == i) {
+ var checkbox = $(this).children().children('input:checkbox');
+ $(checkbox).attr('checked', 'checked');
+ $(checkbox).parent().parent().addClass('selected');
+ }
+ });
+ }
+ }
var checkbox = $(this).parent().children('input:checkbox');
+ lastChecked = checkbox;
if ($(checkbox).attr('checked')) {
$(checkbox).removeAttr('checked');
$(checkbox).parent().parent().removeClass('selected');
@@ -45,7 +64,6 @@ $(document).ready(function() {
}
procesSelection();
} else {
- event.preventDefault();
var filename=$(this).parent().parent().data('file');
if(!FileList.isLoading(filename)){
var mime=$(this).parent().parent().data('mime');
@@ -73,7 +91,23 @@ $(document).ready(function() {
procesSelection();
});
- $('td.filename input:checkbox').live('click',function() {
+ $('td.filename input:checkbox').live('click',function(event) {
+ if (event.shiftKey) {
+ var last = $(lastChecked).parent().parent().prevAll().length;
+ var first = $(this).parent().parent().prevAll().length;
+ var start = Math.min(first, last);
+ var end = Math.max(first, last);
+ var rows = $(this).parent().parent().parent().children('tr');
+ for (var i = start; i < end; i++) {
+ $(rows).each(function(index) {
+ if (index == i) {
+ var checkbox = $(this).children().children('input:checkbox');
+ $(checkbox).attr('checked', 'checked');
+ $(checkbox).parent().parent().addClass('selected');
+ }
+ });
+ }
+ }
var selectedCount=$('td.filename input:checkbox:checked').length;
$(this).parent().parent().toggleClass('selected');
if(!$(this).attr('checked')){