Make shift-click checkbox range selection work in both directions. props c3mdigital, SergeyBiryukov. fixes #23427.

git-svn-id: https://develop.svn.wordpress.org/trunk@25141 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Helen Hou-Sandi 2013-08-27 20:49:33 +00:00
parent 65465e9c88
commit 6ce20d366c
1 changed files with 3 additions and 2 deletions

View File

@ -160,7 +160,7 @@ $('.contextual-help-tabs').delegate('a', 'click focus', function(e) {
}); });
$(document).ready( function() { $(document).ready( function() {
var lastClicked = false, checks, first, last, checked, menu = $('#adminmenu'), mobileEvent, var lastClicked = false, checks, first, last, checked, sliced, menu = $('#adminmenu'), mobileEvent,
pageInput = $('input.current-page'), currentPage = pageInput.val(); pageInput = $('input.current-page'), currentPage = pageInput.val();
// when the menu is folded, make the fly-out submenu header clickable // when the menu is folded, make the fly-out submenu header clickable
@ -286,7 +286,8 @@ $(document).ready( function() {
last = checks.index( this ); last = checks.index( this );
checked = $(this).prop('checked'); checked = $(this).prop('checked');
if ( 0 < first && 0 < last && first != last ) { if ( 0 < first && 0 < last && first != last ) {
checks.slice( first, last ).prop( 'checked', function(){ sliced = ( last > first ) ? checks.slice( first, last ) : checks.slice( last, first );
sliced.prop( 'checked', function() {
if ( $(this).closest('tr').is(':visible') ) if ( $(this).closest('tr').is(':visible') )
return checked; return checked;