diff options
author | Michael Gapczynski <GapczynskiM@gmail.com> | 2011-08-28 14:14:50 -0400 |
---|---|---|
committer | Michael Gapczynski <GapczynskiM@gmail.com> | 2011-08-28 14:15:07 -0400 |
commit | 5f0ab971f1b1e9ffcd35d8fb7489fae8106dcef5 (patch) | |
tree | d9df3eddcc8ee3e2ca62e40cbfd3424938341679 /files | |
parent | 5c9178f85161c90c4c58c6ab68b2828938908845 (diff) | |
download | nextcloud-server-5f0ab971f1b1e9ffcd35d8fb7489fae8106dcef5.tar.gz nextcloud-server-5f0ab971f1b1e9ffcd35d8fb7489fae8106dcef5.zip |
Ctrl+Click on td.filename a selects file instead of default file action
Diffstat (limited to 'files')
-rw-r--r-- | files/js/files.js | 35 |
1 files changed, 27 insertions, 8 deletions
diff --git a/files/js/files.js b/files/js/files.js index 5770285cfbd..e3b181262f9 100644 --- a/files/js/files.js +++ b/files/js/files.js @@ -28,16 +28,35 @@ $(document).ready(function() { // Sets the file link behaviour : $('td.filename a').live('click',function(event) { - event.preventDefault(); - var filename=$(this).parent().parent().data('file'); - if(!FileList.isLoading(filename)){ - var mime=$(this).parent().parent().data('mime'); - var type=$(this).parent().parent().data('type'); - var action=FileActions.getDefault(mime,type); - if(action){ - action(filename); + if (event.ctrlKey) { + event.preventDefault(); + var checkbox = $(this).parent().children('input:checkbox'); + if ($(checkbox).attr('checked')) { + $(checkbox).removeAttr('checked'); + $(checkbox).parent().parent().removeClass('selected'); + $('#select_all').removeAttr('checked'); + } else { + $(checkbox).attr('checked', 'checked'); + $(checkbox).parent().parent().toggleClass('selected'); + var selectedCount=$('td.filename input:checkbox:checked').length; + if (selectedCount == $('td.filename input:checkbox').length) { + $('#select_all').attr('checked', 'checked'); + } + } + procesSelection(); + } else { + event.preventDefault(); + var filename=$(this).parent().parent().data('file'); + if(!FileList.isLoading(filename)){ + var mime=$(this).parent().parent().data('mime'); + var type=$(this).parent().parent().data('type'); + var action=FileActions.getDefault(mime,type); + if(action){ + action(filename); + } } } + }); // Sets the select_all checkbox behaviour : |