2 * Javascript for module editWarning
9 $textBox
= $( '#wpTextbox1' ),
10 $summary
= $( '#wpSummary' ),
11 $both
= $textBox
.add( $summary
);
13 // Check if EditWarning is enabled and if we need it
14 if ( !mw
.user
.options
.get( 'useeditwarning' ) ) {
18 // Save the original value of the text fields
19 $both
.each( function ( index
, element
) {
20 var $element
= $( element
);
21 $element
.data( 'origtext', $element
.textSelection( 'getContents' ) );
24 allowCloseWindow
= mw
.confirmCloseWindow( {
26 // We use .textSelection, because editors might not have updated the form yet.
27 return mw
.config
.get( 'wgAction' ) === 'submit' ||
28 $textBox
.data( 'origtext' ) !== $textBox
.textSelection( 'getContents' ) ||
29 $summary
.data( 'origtext' ) !== $summary
.textSelection( 'getContents' );
32 message
: mw
.msg( 'editwarning-warning' ),
33 namespace: 'editwarning'
36 // Add form submission handler
37 $( '#editform' ).submit( function () {
42 }( mediaWiki
, jQuery
) );