Fix Shift-X toggling of comments on Edit Comments

git-svn-id: http://svn.automattic.com/wordpress/trunk@10063 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
markjaquith 2008-12-05 07:15:31 +00:00
parent bdb5cde322
commit 569a1ff339
3 changed files with 16 additions and 10 deletions

View File

@ -199,16 +199,21 @@ jQuery(document).ready( function($) {
lastClicked = this; lastClicked = this;
return true; return true;
} ); } );
$( 'thead :checkbox, tfoot :checkbox' ).click( function(e) { $( 'thead :checkbox, tfoot :checkbox' ).click( function(e) {
var c = $(this).attr('checked'); var c = $(this).attr('checked');
var toggle = e.shiftKey || toggleWithKeyboard;
$(this).parents( 'form:first' ).find( 'table tbody:visible, table thead:visible, table tfoot:visible').find( '.check-column :checkbox' ).attr( 'checked', function() { $(this).parents( 'form:first' ).find( 'table tbody:visible').find( '.check-column :checkbox' ).attr( 'checked', function() {
if ( e.shiftKey ) if ( toggle )
return $(this).attr( 'checked' ) ? '' : 'checked'; return $(this).attr( 'checked' ) ? '' : 'checked';
else if (c) else if (c)
return 'checked'; return 'checked';
return '';
});
$(this).parents( 'form:first' ).find( 'table thead:visible, table tfoot:visible').find( '.check-column :checkbox' ).attr( 'checked', function() {
if ( toggle )
return '';
else if (c)
return 'checked';
return ''; return '';
}); });
}); });

View File

@ -278,7 +278,7 @@ commentReply = {
} }
}; };
toggleWithKeyboard = false;
$(document).ready(function(){ $(document).ready(function(){
columns.init('edit-comments'); columns.init('edit-comments');
commentReply.init(); commentReply.init();
@ -299,9 +299,10 @@ $(document).ready(function(){
window.location = $('span.edit a', current_row).attr('href'); window.location = $('span.edit a', current_row).attr('href');
}; };
var toggle_all = function() { var toggle_all = function() {
toggleWithKeyboard = true;
var master_checkbox = $('form#comments-form .check-column :checkbox:first'); var master_checkbox = $('form#comments-form .check-column :checkbox:first');
master_checkbox.attr('checked', master_checkbox.attr('checked')? '' : 'checked'); master_checkbox.click().attr('checked', '');
checkAll('form#comments-form'); toggleWithKeyboard = false;
} }
var make_bulk = function(value) { var make_bulk = function(value) {
return function(event, _) { return function(event, _) {

View File

@ -41,7 +41,7 @@ function wp_default_scripts( &$scripts ) {
$scripts->base_url = $guessurl; $scripts->base_url = $guessurl;
$scripts->default_version = get_bloginfo( 'version' ); $scripts->default_version = get_bloginfo( 'version' );
$scripts->add( 'common', '/wp-admin/js/common.js', array('jquery', 'hoverIntent'), '20081203' ); $scripts->add( 'common', '/wp-admin/js/common.js', array('jquery', 'hoverIntent'), '20081205' );
$scripts->add( 'sack', '/wp-includes/js/tw-sack.js', false, '1.6.1' ); $scripts->add( 'sack', '/wp-includes/js/tw-sack.js', false, '1.6.1' );
$scripts->add( 'quicktags', '/wp-includes/js/quicktags.js', false, '20081103' ); $scripts->add( 'quicktags', '/wp-includes/js/quicktags.js', false, '20081103' );
@ -156,7 +156,7 @@ function wp_default_scripts( &$scripts ) {
'good' => _c('Medium|password strength'), 'good' => _c('Medium|password strength'),
'strong' => __('Strong') 'strong' => __('Strong')
) ); ) );
$scripts->add( 'admin-comments', '/wp-admin/js/edit-comments.js', array('wp-lists', 'jquery-ui-resizable', 'quicktags'), '20081124' ); $scripts->add( 'admin-comments', '/wp-admin/js/edit-comments.js', array('wp-lists', 'jquery-ui-resizable', 'quicktags'), '20081205' );
$scripts->localize( 'admin-comments', 'adminCommentsL10n', array( $scripts->localize( 'admin-comments', 'adminCommentsL10n', array(
'hotkeys_highlight_first' => isset($_GET['hotkeys_highlight_first']), 'hotkeys_highlight_first' => isset($_GET['hotkeys_highlight_first']),
'hotkeys_highlight_last' => isset($_GET['hotkeys_highlight_last']) 'hotkeys_highlight_last' => isset($_GET['hotkeys_highlight_last'])