summaryrefslogtreecommitdiff
path: root/www/wiki/resources/src/mediawiki.special/mediawiki.special.userrights.js
diff options
context:
space:
mode:
Diffstat (limited to 'www/wiki/resources/src/mediawiki.special/mediawiki.special.userrights.js')
-rw-r--r--www/wiki/resources/src/mediawiki.special/mediawiki.special.userrights.js25
1 files changed, 25 insertions, 0 deletions
diff --git a/www/wiki/resources/src/mediawiki.special/mediawiki.special.userrights.js b/www/wiki/resources/src/mediawiki.special/mediawiki.special.userrights.js
new file mode 100644
index 00000000..487e63a6
--- /dev/null
+++ b/www/wiki/resources/src/mediawiki.special/mediawiki.special.userrights.js
@@ -0,0 +1,25 @@
+/*!
+ * JavaScript for Special:UserRights
+ */
+( 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 "other time" input under each dropdown
+ $( '.mw-userrights-nested select' ).on( 'change', function ( e ) {
+ $( e.target.parentNode ).find( 'input' ).toggle( $( e.target ).val() === 'other' );
+ } );
+
+ // 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 ) );