Show a warning in edit preview when a template loop is detected
[lhc/web/wiklou.git] / resources / src / mediawiki.special / mediawiki.special.newFiles.js
1 /*!
2 * JavaScript for Special:NewFiles
3 */
4 ( function ( mw, $ ) {
5 $( function () {
6 var start = mw.widgets.datetime.DateTimeInputWidget.static.infuse( 'mw-input-start' ),
7 end = mw.widgets.datetime.DateTimeInputWidget.static.infuse( 'mw-input-end' ),
8 temp;
9
10 // If the start date comes after the end date, swap the two values.
11 // This swap is already done internally when the form is submitted with a start date that
12 // comes after the end date, but this swap makes the change visible in the HTMLForm.
13 if ( start.getValue() !== '' &&
14 end.getValue() !== '' &&
15 start.getValue() > end.getValue() ) {
16 temp = start.getValue();
17 start.setValue( end.getValue() );
18 end.setValue( temp );
19 }
20 } );
21 }( mediaWiki, jQuery ) );