Merge "Revert "Log the reason why revision->getContent() returns null""
[lhc/web/wiklou.git] / resources / src / mediawiki.action / mediawiki.action.delete.file.js
1 /*!
2 * JavaScript for Special:RevisionDelete
3 */
4 ( function ( mw, $ ) {
5 $( function () {
6 var colonSeparator = mw.message( 'colon-separator' ).text(),
7 summaryCodePointLimit = mw.config.get( 'wgCommentCodePointLimit' ),
8 summaryByteLimit = mw.config.get( 'wgCommentByteLimit' ),
9 $wpDeleteReasonList = $( '#wpDeleteReasonList' ),
10 $wpReason = $( '#wpReason' ),
11 filterFn = function ( input ) {
12 // Should be built the same as in SpecialRevisionDelete::submit()
13 var comment = $wpDeleteReasonList.val();
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 $wpReason.codePointLimit( summaryCodePointLimit, filterFn );
26 } else if ( summaryByteLimit ) {
27 $wpReason.bytePointLimit( summaryByteLimit, filterFn );
28 }
29 } );
30
31 }( mediaWiki, jQuery ) );