resources: Strip '$' and 'mw' from file closures
[lhc/web/wiklou.git] / resources / src / mediawiki.action / mediawiki.action.delete.js
1 /*!
2 * Scripts for action=delete at domready
3 */
4 ( function () {
5 $( function () {
6 var colonSeparator = mw.message( 'colon-separator' ).text(),
7 summaryCodePointLimit = mw.config.get( 'wgCommentCodePointLimit' ),
8 summaryByteLimit = mw.config.get( 'wgCommentByteLimit' ),
9 reasonList = OO.ui.infuse( $( '#wpDeleteReasonList' ).closest( '.oo-ui-widget' ) ),
10 reason = OO.ui.infuse( $( '#wpReason' ).closest( '.oo-ui-widget' ) ),
11 filterFn = function ( input ) {
12 // Should be built the same as in Article::delete()
13 var comment = reasonList.getValue();
14 if ( comment === 'other' ) {
15 comment = input;
16 } else if ( input !== '' ) {
17 // Entry from drop down menu + additional comment
18 comment += colonSeparator + input;
19 }
20 return comment;
21 };
22
23 // Limit to bytes or UTF-8 codepoints, depending on MediaWiki's configuration
24 if ( summaryCodePointLimit ) {
25 reason.$input.codePointLimit( summaryCodePointLimit, filterFn );
26 } else if ( summaryByteLimit ) {
27 reason.$input.byteLimit( summaryByteLimit, filterFn );
28 }
29 } );
30 }() );