Comment moderation shortcuts:
- Fix "toggle checkboxes" (shift+x). - Add noDisable selector and use it to stop disabling the shortcuts when a select-comment checkbox is focused. See #26755. Built from https://develop.svn.wordpress.org/trunk@26889 git-svn-id: http://core.svn.wordpress.org/trunk@26772 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
8a82e4c463
commit
2a68f85fa1
|
@ -1,4 +1,4 @@
|
|||
/* global setUserSetting, ajaxurl, commonL10n, alert, confirm, toggleWithKeyboard, pagenow */
|
||||
/* global setUserSetting, ajaxurl, commonL10n, alert, confirm, pagenow */
|
||||
var showNotice, adminMenu, columns, validateForm, screenMeta;
|
||||
( function( $, window, undefined ) {
|
||||
// Removed in 3.3.
|
||||
|
@ -346,32 +346,39 @@ $(document).ready( function() {
|
|||
return true;
|
||||
});
|
||||
|
||||
$('thead, tfoot').find('.check-column :checkbox').click( function(e) {
|
||||
var c = $(this).prop('checked'),
|
||||
kbtoggle = 'undefined' == typeof toggleWithKeyboard ? false : toggleWithKeyboard,
|
||||
toggle = e.shiftKey || kbtoggle;
|
||||
$('thead, tfoot').find('.check-column :checkbox').on( 'click.wp-toggle-checkboxes', function( event ) {
|
||||
var $this = $(this),
|
||||
$table = $this.closest( 'table' ),
|
||||
controlChecked = $this.prop('checked'),
|
||||
toggle = event.shiftKey || $this.data('wp-toggle');
|
||||
|
||||
$(this).closest( 'table' ).children( 'tbody' ).filter(':visible')
|
||||
.children().children('.check-column').find(':checkbox')
|
||||
.prop('checked', function() {
|
||||
if ( $(this).is(':hidden') )
|
||||
return false;
|
||||
if ( toggle )
|
||||
return $(this).prop( 'checked' );
|
||||
else if (c)
|
||||
return true;
|
||||
return false;
|
||||
});
|
||||
$table.children( 'tbody' ).filter(':visible')
|
||||
.children().children('.check-column').find(':checkbox')
|
||||
.prop('checked', function() {
|
||||
if ( $(this).is(':hidden') ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if ( toggle ) {
|
||||
return ! $(this).prop( 'checked' );
|
||||
} else if ( controlChecked ) {
|
||||
return true;
|
||||
}
|
||||
|
||||
$(this).closest('table').children('thead, tfoot').filter(':visible')
|
||||
.children().children('.check-column').find(':checkbox')
|
||||
.prop('checked', function() {
|
||||
if ( toggle )
|
||||
return false;
|
||||
else if (c)
|
||||
return true;
|
||||
return false;
|
||||
});
|
||||
});
|
||||
|
||||
$table.children('thead, tfoot').filter(':visible')
|
||||
.children().children('.check-column').find(':checkbox')
|
||||
.prop('checked', function() {
|
||||
if ( toggle ) {
|
||||
return false;
|
||||
} else if ( controlChecked ) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
});
|
||||
});
|
||||
|
||||
// Show row actions on keyboard focus of its parent container element or any other elements contained within
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -1,6 +1,5 @@
|
|||
/* global adminCommentsL10n, thousandsSeparator, list_args, QTags, ajaxurl, wpAjax */
|
||||
var setCommentsList, theList, theExtraList, commentReply,
|
||||
toggleWithKeyboard = false;
|
||||
var setCommentsList, theList, theExtraList, commentReply;
|
||||
|
||||
(function($) {
|
||||
var getCount, updateCount, updatePending, dashboardTotals;
|
||||
|
@ -594,9 +593,7 @@ $(document).ready(function(){
|
|||
};
|
||||
|
||||
toggle_all = function() {
|
||||
toggleWithKeyboard = true;
|
||||
$('input:checkbox', '#cb').click().prop('checked', false);
|
||||
toggleWithKeyboard = false;
|
||||
$('#cb-select-all-1').data( 'wp-toggle', 1 ).trigger( 'click' ).removeData( 'wp-toggle' );
|
||||
};
|
||||
|
||||
make_bulk = function(value) {
|
||||
|
@ -609,12 +606,28 @@ $(document).ready(function(){
|
|||
|
||||
$.table_hotkeys(
|
||||
$('table.widefat'),
|
||||
['a', 'u', 's', 'd', 'r', 'q', 'z', ['e', edit_comment], ['shift+x', toggle_all],
|
||||
['shift+a', make_bulk('approve')], ['shift+s', make_bulk('spam')],
|
||||
['shift+d', make_bulk('delete')], ['shift+t', make_bulk('trash')],
|
||||
['shift+z', make_bulk('untrash')], ['shift+u', make_bulk('unapprove')]],
|
||||
{ highlight_first: adminCommentsL10n.hotkeys_highlight_first, highlight_last: adminCommentsL10n.hotkeys_highlight_last,
|
||||
prev_page_link_cb: make_hotkeys_redirect('prev'), next_page_link_cb: make_hotkeys_redirect('next') }
|
||||
[
|
||||
'a', 'u', 's', 'd', 'r', 'q', 'z',
|
||||
['e', edit_comment],
|
||||
['shift+x', toggle_all],
|
||||
['shift+a', make_bulk('approve')],
|
||||
['shift+s', make_bulk('spam')],
|
||||
['shift+d', make_bulk('delete')],
|
||||
['shift+t', make_bulk('trash')],
|
||||
['shift+z', make_bulk('untrash')],
|
||||
['shift+u', make_bulk('unapprove')]
|
||||
],
|
||||
{
|
||||
highlight_first: adminCommentsL10n.hotkeys_highlight_first,
|
||||
highlight_last: adminCommentsL10n.hotkeys_highlight_last,
|
||||
prev_page_link_cb: make_hotkeys_redirect('prev'),
|
||||
next_page_link_cb: make_hotkeys_redirect('next'),
|
||||
hotkeys_opts: {
|
||||
disableInInput: true,
|
||||
type: 'keypress',
|
||||
noDisable: '.check-column input[type="checkbox"]'
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
});
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -58,10 +58,13 @@ USAGE:
|
|||
// WP: not needed with newer jQuery
|
||||
// element = (element.nodeType==3) ? element.parentNode : element;
|
||||
|
||||
if(opt['disableInInput']) { // Disable shortcut keys in Input, Textarea fields
|
||||
if ( opt['disableInInput'] ) { // Disable shortcut keys in Input, Textarea fields
|
||||
var target = jQuery(element);
|
||||
if( target.is("input") || target.is("textarea")){
|
||||
return;
|
||||
|
||||
if ( ( target.is('input') || target.is('textarea') ) &&
|
||||
( ! opt.noDisable || ! target.is( opt.noDisable ) ) ) {
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
var code = event.which,
|
||||
|
|
Loading…
Reference in New Issue