Merge "Add support for 'hu-formal'"
[lhc/web/wiklou.git] / resources / src / mediawiki.special / mediawiki.special.userrights.js
1 /*!
2 * JavaScript for Special:UserRights
3 */
4 ( function ( mw, $ ) {
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 $( e.target.parentNode ).find( 'input' ).toggle( $( e.target ).val() === 'other' );
16 } );
17
18 // Limit to bytes or UTF-8 codepoints, depending on MediaWiki's configuration
19 if ( summaryCodePointLimit ) {
20 $wpReason.codePointLimit( summaryCodePointLimit );
21 } else if ( summaryByteLimit ) {
22 $wpReason.bytePointLimit( summaryByteLimit );
23 }
24
25 }( mediaWiki, jQuery ) );