Improve the check all: click to check all checkboxes, click again to uncheck all, Shift/click to toggle. Shift/clicking two consecutive boxes checks the range between them as before. Fixes #8217

git-svn-id: https://develop.svn.wordpress.org/trunk@9708 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Andrew Ozz 2008-11-15 07:07:59 +00:00
parent 3c71d6a1c1
commit b5b456f173
1 changed files with 10 additions and 4 deletions

View File

@ -200,11 +200,17 @@ jQuery(document).ready( function($) {
return true;
} );
$( 'thead :checkbox, tfoot :checkbox' ).click( function() {
$(this).parents( 'form:first' ).find( 'tbody:visible .check-column :checkbox' ).attr( 'checked', function() {
return $(this).attr( 'checked' ) ? '' : 'checked';
$( 'thead :checkbox, tfoot :checkbox' ).click( function(e) {
var c = $(this).attr('checked');
$(this).parents( 'form:first' ).find( 'table .check-column :checkbox' ).attr( 'checked', function() {
if ( e.shiftKey )
return $(this).attr( 'checked' ) ? '' : 'checked';
else if (c)
return 'checked';
return '';
});
return false;
});
});