WordPress.org

Make WordPress Core

Changeset 9708


Ignore:
Timestamp:
11/15/2008 07:07:59 AM (10 years ago)
Author:
azaozz
Message:

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

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/js/common.js

    r9633 r9708  
    201201    } );
    202202
    203     $( 'thead :checkbox, tfoot :checkbox' ).click( function() {
    204         $(this).parents( 'form:first' ).find( 'tbody:visible .check-column :checkbox' ).attr( 'checked', function() {
    205             return $(this).attr( 'checked' ) ? '' : 'checked';
    206         });
    207         return false;
     203    $( 'thead :checkbox, tfoot :checkbox' ).click( function(e) {
     204        var c = $(this).attr('checked');
     205
     206        $(this).parents( 'form:first' ).find( 'table .check-column :checkbox' ).attr( 'checked', function() {
     207            if ( e.shiftKey )
     208                return $(this).attr( 'checked' ) ? '' : 'checked';
     209            else if (c)
     210                return 'checked';
     211
     212            return '';
     213        });
    208214    });
    209215});
Note: See TracChangeset for help on using the changeset viewer.