Update more forms to limit comments by codepoints rather than bytes
[lhc/web/wiklou.git] / resources / src / mediawiki.special / mediawiki.special.undelete.js
index 0dea3ef..e3cf598 100644 (file)
@@ -1,11 +1,23 @@
-/**
+/*!
  * JavaScript for Special:Undelete
  */
-jQuery( function ( $ ) {
-       $( '#mw-undelete-invert' ).click( function ( e ) {
-               $( '#undelete input[type="checkbox"]' ).prop( 'checked', function ( i, val ) {
-                       return !val;
+( function ( mw, $ ) {
+       $( function () {
+               var summaryCodePointLimit = mw.config.get( 'wgCommentCodePointLimit' ),
+                       summaryByteLimit = mw.config.get( 'wgCommentByteLimit' ),
+                       wpComment = OO.ui.infuse( $( '#wpComment' ).closest( '.oo-ui-widget' ) );
+
+               $( '#mw-undelete-invert' ).click( function () {
+                       $( '.mw-undelete-revlist input[type="checkbox"]' ).prop( 'checked', function ( i, val ) {
+                               return !val;
+                       } );
                } );
-               e.preventDefault();
+
+               // Limit to bytes or UTF-8 codepoints, depending on MediaWiki's configuration
+               if ( summaryCodePointLimit ) {
+                       mw.widgets.visibleCodePointLimit( wpComment, summaryCodePointLimit );
+               } else if ( summaryByteLimit ) {
+                       mw.widgets.visibleByteLimit( wpComment, summaryByteLimit );
+               }
        } );
-} );
+}( mediaWiki, jQuery ) );