Merge "Remove register_globals and magic_quotes_* checks"
[lhc/web/wiklou.git] / resources / src / mediawiki / mediawiki.checkboxtoggle.js
1 /*!
2 * Allows users to perform all / none / invert operations on a list of
3 * checkboxes on the page.
4 *
5 * @licence GNU GPL v2+
6 * @author Luke Faraone <luke at faraone dot cc>
7 *
8 * Based on ext.nuke.js from https://www.mediawiki.org/wiki/Extension:Nuke by
9 * Jeroen De Dauw <jeroendedauw at gmail dot com>
10 */
11
12 ( function ( mw, $ ) {
13 'use strict';
14
15 var $checkboxes = $( 'li input[type=checkbox]' );
16
17 function selectAll( check ) {
18 $checkboxes.prop( 'checked', check );
19 }
20
21 $( '.mw-checkbox-all' ).click( function ( e ) {
22 selectAll( true );
23 e.preventDefault();
24 } );
25 $( '.mw-checkbox-none' ).click( function ( e ) {
26 selectAll( false );
27 e.preventDefault();
28 } );
29 $( '.mw-checkbox-invert' ).click( function ( e ) {
30 $checkboxes.each( function () {
31 $( this ).prop( 'checked', !$( this ).is( ':checked' ) );
32 } );
33 e.preventDefault();
34 } );
35
36 }( mediaWiki, jQuery ) );
37