Merge "Datatable: Unify `padding` with `.wikitable`"
[lhc/web/wiklou.git] / resources / src / mediawiki.special.userrights.js
1 /*!
2 * JavaScript for Special:UserRights
3 */
4 ( function () {
5 var convertmessagebox = require( 'mediawiki.notification.convertmessagebox' ),
6 summaryCodePointLimit = mw.config.get( 'wgCommentCodePointLimit' ),
7 summaryByteLimit = mw.config.get( 'wgCommentByteLimit' ),
8 $wpReason = $( '#wpReason' );
9
10 // Replace successbox with notifications
11 convertmessagebox();
12
13 // Dynamically show/hide the "other time" input under each dropdown
14 $( '.mw-userrights-nested select' ).on( 'change', function ( e ) {
15 // eslint-disable-next-line jquery/no-animate-toggle
16 $( e.target.parentNode ).find( 'input' ).toggle( $( e.target ).val() === 'other' );
17 } );
18
19 // Limit to bytes or UTF-8 codepoints, depending on MediaWiki's configuration
20 if ( summaryCodePointLimit ) {
21 $wpReason.codePointLimit( summaryCodePointLimit );
22 } else if ( summaryByteLimit ) {
23 $wpReason.byteLimit( summaryByteLimit );
24 }
25
26 }() );