mediawiki.checkboxtoggle: Run after document ready
Bug: T131318 Change-Id: I74d7de03e7338affbf7f0013937ec38a30cded27
This commit is contained in:
parent
d2f540f7c3
commit
870c5e28e6
1 changed files with 19 additions and 16 deletions
|
|
@ -12,25 +12,28 @@
|
||||||
( function ( mw, $ ) {
|
( function ( mw, $ ) {
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
var $checkboxes = $( 'li input[type=checkbox]' );
|
$( function () {
|
||||||
|
var $checkboxes = $( 'li input[type=checkbox]' );
|
||||||
|
|
||||||
function selectAll( check ) {
|
function selectAll( check ) {
|
||||||
$checkboxes.prop( 'checked', check );
|
$checkboxes.prop( 'checked', check );
|
||||||
}
|
}
|
||||||
|
|
||||||
$( '.mw-checkbox-all' ).click( function ( e ) {
|
$( '.mw-checkbox-all' ).click( function ( e ) {
|
||||||
selectAll( true );
|
selectAll( true );
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
} );
|
|
||||||
$( '.mw-checkbox-none' ).click( function ( e ) {
|
|
||||||
selectAll( false );
|
|
||||||
e.preventDefault();
|
|
||||||
} );
|
|
||||||
$( '.mw-checkbox-invert' ).click( function ( e ) {
|
|
||||||
$checkboxes.each( function () {
|
|
||||||
$( this ).prop( 'checked', !$( this ).is( ':checked' ) );
|
|
||||||
} );
|
} );
|
||||||
e.preventDefault();
|
$( '.mw-checkbox-none' ).click( function ( e ) {
|
||||||
|
selectAll( false );
|
||||||
|
e.preventDefault();
|
||||||
|
} );
|
||||||
|
$( '.mw-checkbox-invert' ).click( function ( e ) {
|
||||||
|
$checkboxes.each( function () {
|
||||||
|
$( this ).prop( 'checked', !$( this ).is( ':checked' ) );
|
||||||
|
} );
|
||||||
|
e.preventDefault();
|
||||||
|
} );
|
||||||
|
|
||||||
} );
|
} );
|
||||||
|
|
||||||
}( mediaWiki, jQuery ) );
|
}( mediaWiki, jQuery ) );
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue