X-Git-Url: http://git.cyclocoop.org/?a=blobdiff_plain;f=resources%2Fsrc%2Fmediawiki.special%2Fmediawiki.special.userrights.js;h=487e63a67d0978af0aa5826355598218d98e8513;hb=8ad7cd92b559632ff8f49fa55e33771670ffcf07;hp=3f864dd53d7a36ca3dbe73bcdac2711fb1cb687c;hpb=a4b09439bde4ce968eebe0a5049d65be3d518471;p=lhc%2Fweb%2Fwiklou.git diff --git a/resources/src/mediawiki.special/mediawiki.special.userrights.js b/resources/src/mediawiki.special/mediawiki.special.userrights.js index 3f864dd53d..487e63a67d 100644 --- a/resources/src/mediawiki.special/mediawiki.special.userrights.js +++ b/resources/src/mediawiki.special/mediawiki.special.userrights.js @@ -1,18 +1,25 @@ /*! * 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(); - // Dynamically show/hide the expiry selection underneath each checkbox - $( '#mw-userrights-form2 input[type=checkbox]' ).on( 'change', function ( e ) { - $( '#mw-userrights-nested-' + e.target.id ).toggle( e.target.checked ); - } ).trigger( 'change' ); - - // Also dynamically show/hide the "other time" input under each dropdown + // Dynamically show/hide the "other time" input under each dropdown $( '.mw-userrights-nested select' ).on( 'change', function ( e ) { $( e.target.parentNode ).find( 'input' ).toggle( $( e.target ).val() === 'other' ); - } ).trigger( 'change' ); -}( 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 ) );