/*! * Toggler for a list of checkboxes. * * @licence GNU GPL v2 or later * @author Luke Faraone * Based on `ext.nuke.js from https://www.mediawiki.org/wiki/Extension:Nuke by Jeroen De Dauw */ ( function ( mw, $ ) { 'use strict'; var $checkboxes = $( 'li input[type=checkbox]' ); var $toggleOptions = mw.message('log-checkbox-select', [ $( '' ) .text( mw.msg( 'log-checkbox-all' ) ) .click( function (e) { selectAll( true ); e.preventDefault(); } ), mw.msg( "comma-separator" ), $( '' ) .text( mw.msg( 'log-checkbox-none' ) ) .click( function (e) { selectAll( false ); e.preventDefault(); } ), mw.msg( "comma-separator" ), $( '' ) .text( mw.msg( 'log-checkbox-invert' ) ) .click( function (e) { $checkboxes.each( function () { $( this ).prop( 'checked', !$( this ).is( ':checked' ) ); } ); e.preventDefault(); } ) ]).parseDom() $ ( '.toggle-option-placeholder' ).append( $( '

' ).append($toggleOptions) ); function selectAll( check ) { $checkboxes.prop( 'checked', check ); } }( mediaWiki, jQuery ) );