Merge "resources: Strip '$' and 'mw' from file closures"
[lhc/web/wiklou.git] / resources / src / mediawiki.special.edittags.js
1 /*!
2 * JavaScript for Special:EditTags
3 */
4 ( function () {
5 $( function () {
6 var summaryCodePointLimit = mw.config.get( 'wgCommentCodePointLimit' ),
7 summaryByteLimit = mw.config.get( 'wgCommentByteLimit' ),
8 $wpReason = $( '#wpReason' ),
9 $tagList = $( '#mw-edittags-tag-list' );
10
11 if ( $tagList.length ) {
12 $tagList.chosen( {
13 /* eslint-disable camelcase */
14 placeholder_text_multiple: mw.msg( 'tags-edit-chosen-placeholder' ),
15 no_results_text: mw.msg( 'tags-edit-chosen-no-results' )
16 /* eslint-enable camelcase */
17 } );
18 }
19
20 $( '#mw-edittags-remove-all' ).on( 'change', function ( e ) {
21 $( '.mw-edittags-remove-checkbox' ).prop( 'checked', e.target.checked );
22 } );
23 $( '.mw-edittags-remove-checkbox' ).on( 'change', function ( e ) {
24 if ( !e.target.checked ) {
25 $( '#mw-edittags-remove-all' ).prop( 'checked', false );
26 }
27 } );
28
29 // Limit to bytes or UTF-8 codepoints, depending on MediaWiki's configuration
30 // use maxLength because it's leaving room for log entry text.
31 if ( summaryCodePointLimit ) {
32 $wpReason.codePointLimit();
33 } else if ( summaryByteLimit ) {
34 $wpReason.byteLimit();
35 }
36 } );
37
38 }() );