Merge "Revert "Log the reason why revision->getContent() returns null""
[lhc/web/wiklou.git] / resources / src / mediawiki.special / mediawiki.special.movePage.js
index bce512c..d828396 100644 (file)
@@ -1,13 +1,23 @@
 /*!
  * JavaScript for Special:MovePage
  */
-jQuery( function ( $ ) {
-       // Infuse for pretty dropdown
-       OO.ui.infuse( 'wpNewTitle' );
-       // Limit to 255 bytes, not characters
-       OO.ui.infuse( 'wpReason' ).$input.byteLimit();
-       // Infuse for nicer "help" popup
-       if ( $( '#wpMovetalk-field' ).length ) {
-               OO.ui.infuse( 'wpMovetalk-field' );
-       }
-} );
+( function ( mw, $ ) {
+       $( function () {
+               var summaryCodePointLimit = mw.config.get( 'wgCommentCodePointLimit' ),
+                       summaryByteLimit = mw.config.get( 'wgCommentByteLimit' ),
+                       wpReason = OO.ui.infuse( $( '#wpReason' ) );
+
+               // Infuse for pretty dropdown
+               OO.ui.infuse( $( '#wpNewTitle' ) );
+               // Limit to bytes or UTF-8 codepoints, depending on MediaWiki's configuration
+               if ( summaryCodePointLimit ) {
+                       mw.widgets.visibleCodePointLimit( wpReason, summaryCodePointLimit );
+               } else if ( summaryByteLimit ) {
+                       mw.widgets.visibleByteLimit( wpReason, summaryByteLimit );
+               }
+               // Infuse for nicer "help" popup
+               if ( $( '#wpMovetalk-field' ).length ) {
+                       OO.ui.infuse( $( '#wpMovetalk-field' ) );
+               }
+       } );
+}( mediaWiki, jQuery ) );