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: http://svn.automattic.com/wordpress/trunk@9708 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
azaozz 2008-11-15 07:07:59 +00:00
parent 9050fd4a5a
commit e00cb4d429

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;
});
});