resourceloader: Make various CSSMin performance optimizations and cleanups
[lhc/web/wiklou.git] / resources / src / mediawiki.special / mediawiki.special.edittags.js
index 69a2a67..45c3cf9 100644 (file)
@@ -3,12 +3,17 @@
  */
 ( function ( mw, $ ) {
        $( function () {
-               var $tagList = $( '#mw-edittags-tag-list' );
+               var summaryCodePointLimit = mw.config.get( 'wgCommentCodePointLimit' ),
+                       summaryByteLimit = mw.config.get( 'wgCommentByteLimit' ),
+                       $wpReason = $( '#wpReason' ),
+                       $tagList = $( '#mw-edittags-tag-list' );
+
                if ( $tagList.length ) {
                        $tagList.chosen( {
-                               /*jscs:disable requireCamelCaseOrUpperCaseIdentifiers */
+                               /* eslint-disable camelcase */
                                placeholder_text_multiple: mw.msg( 'tags-edit-chosen-placeholder' ),
                                no_results_text: mw.msg( 'tags-edit-chosen-no-results' )
+                               /* eslint-enable camelcase */
                        } );
                }
 
                                $( '#mw-edittags-remove-all' ).prop( 'checked', false );
                        }
                } );
+
+               // Limit to bytes or UTF-8 codepoints, depending on MediaWiki's configuration
+               // use maxLength because it's leaving room for log entry text.
+               if ( summaryCodePointLimit ) {
+                       $wpReason.codePointLimit();
+               } else if ( summaryByteLimit ) {
+                       $wpReason.bytePointLimit();
+               }
        } );
+
 }( mediaWiki, jQuery ) );