Fix typo: bytePointLimit -> byteLimit
[lhc/web/wiklou.git] / resources / src / mediawiki.special / mediawiki.special.userrights.js
index d3494f7..487e63a 100644 (file)
@@ -1,8 +1,12 @@
 /*!
  * JavaScript for Special:UserRights
  */
-( function ( $ ) {
-       var convertmessagebox = require( 'mediawiki.notification.convertmessagebox' );
+( function ( mw, $ ) {
+       var convertmessagebox = require( 'mediawiki.notification.convertmessagebox' ),
+               summaryCodePointLimit = mw.config.get( 'wgCommentCodePointLimit' ),
+               summaryByteLimit = mw.config.get( 'wgCommentByteLimit' ),
+               $wpReason = $( '#wpReason' );
+
        // Replace successbox with notifications
        convertmessagebox();
 
        $( '.mw-userrights-nested select' ).on( 'change', function ( e ) {
                $( e.target.parentNode ).find( 'input' ).toggle( $( e.target ).val() === 'other' );
        } );
-}( jQuery ) );
+
+       // Limit to bytes or UTF-8 codepoints, depending on MediaWiki's configuration
+       if ( summaryCodePointLimit ) {
+               $wpReason.codePointLimit( summaryCodePointLimit );
+       } else if ( summaryByteLimit ) {
+               $wpReason.byteLimit( summaryByteLimit );
+       }
+
+}( mediaWiki, jQuery ) );