diff options
Diffstat (limited to 'files/js/files.js')
-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 : |