Add any prior block to BlockIpComplete hook
[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 $( function () {
16 var $checkboxes = $( 'li input[type=checkbox]' );
17
18 function selectAll( check ) {
19 $checkboxes.prop( 'checked', check );
20 }
21
22 $( '.mw-checkbox-all' ).click( function ( e ) {
23 selectAll( true );
24 e.preventDefault();
25 } );
26 $( '.mw-checkbox-none' ).click( function ( e ) {
27 selectAll( false );
28 e.preventDefault();
29 } );
30 $( '.mw-checkbox-invert' ).click( function ( e ) {
31 $checkboxes.each( function () {
32 $( this ).prop( 'checked', !$( this ).is( ':checked' ) );
33 } );
34 e.preventDefault();
35 } );
36
37 } );
38
39 }( mediaWiki, jQuery ) );
40