CoreFiles by mySites.guru
forms.js26 lines, 851 bytes, from wordpress-2.6.zip
Raw History Compare with 2.5.1
md5
5248ccc0d3a9bcdd0dc8b2faf129db2d
sha1
50d1b25761a7ba9f8c00c018ac9a19d85fed54fc
sha256
4dc866e27601f593cf71debfc63dd5c399696430c8dec0f706d45e4d291de808
function checkAll(jQ) { // use attr( checked, fn )
	jQuery(jQ).find( 'tbody :checkbox' ).attr( 'checked', function() {
		return jQuery(this).attr( 'checked' ) ? '' : 'checked';
	} );
}

jQuery( function($) {
	var lastClicked = false;
	$( 'tbody :checkbox' ).click( function(e) {
		if ( 'undefined' == e.shiftKey ) { return true; }
		if ( e.shiftKey ) {
			if ( !lastClicked ) { return true; }
			var checks = $( lastClicked ).parents( 'form:first' ).find( ':checkbox' );
			var first = checks.index( lastClicked );
			var last = checks.index( this );
			if ( 0 < first && 0 < last && first != last ) {
				checks.slice( first, last ).attr( 'checked', $( this ).is( ':checked' ) ? 'checked' : '' );
			}
		}
		lastClicked = this;
		return true;
	} );
	$( 'thead :checkbox' ).click( function() {
		checkAll( $(this).parents( 'form:first' ) );
	} );
} );

The same content is in 5 releases, WordPress 2.6-beta1 to 2.6. See them all, or every version of this file.