dépôts
/
lhc
/
web
/
wiklou.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
mediawiki.action.edit.editWarning: Reuse jQuery collections
[lhc/web/wiklou.git]
/
resources
/
src
/
mediawiki.action
/
mediawiki.action.edit.editWarning.js
diff --git
a/resources/src/mediawiki.action/mediawiki.action.edit.editWarning.js
b/resources/src/mediawiki.action/mediawiki.action.edit.editWarning.js
index
f8448e6
..
dcd2b0b
100644
(file)
--- a/
resources/src/mediawiki.action/mediawiki.action.edit.editWarning.js
+++ b/
resources/src/mediawiki.action/mediawiki.action.edit.editWarning.js
@@
-2,16
+2,20
@@
* Javascript for module editWarning
*/
( function ( mw, $ ) {
* Javascript for module editWarning
*/
( function ( mw, $ ) {
+ 'use strict';
+
$( function () {
$( function () {
+ var savedWindowOnBeforeUnload,
+ $wpTextbox1 = $( '#wpTextbox1' ),
+ $wpSummary = $( '#wpSummary' );
// Check if EditWarning is enabled and if we need it
// Check if EditWarning is enabled and if we need it
- if ( $
( '#wpTextbox1' )
.length === 0 ) {
+ if ( $
wpTextbox1
.length === 0 ) {
return true;
}
// Get the original values of some form elements
return true;
}
// Get the original values of some form elements
- $
( '#wpTextbox1, #wpSummary'
).each( function () {
+ $
wpTextbox1.add( $wpSummary
).each( function () {
$( this ).data( 'origtext', $( this ).val() );
} );
$( this ).data( 'origtext', $( this ).val() );
} );
- var savedWindowOnBeforeUnload;
$( window )
.on( 'beforeunload.editwarning', function () {
var retval;
$( window )
.on( 'beforeunload.editwarning', function () {
var retval;
@@
-20,8
+24,8
@@
// the original values
if (
mw.config.get( 'wgAction' ) === 'submit' ||
// the original values
if (
mw.config.get( 'wgAction' ) === 'submit' ||
- $
( '#wpTextbox1' ).data( 'origtext' ) !== $( '#wpTextbox1' )
.val() ||
- $
( '#wpSummary' ).data( 'origtext' ) !== $( '#wpSummary' )
.val()
+ $
wpTextbox1.data( 'origtext' ) !== $wpTextbox1
.val() ||
+ $
wpSummary.data( 'origtext' ) !== $wpSummary
.val()
) {
// Return our message
retval = mw.msg( 'editwarning-warning' );
) {
// Return our message
retval = mw.msg( 'editwarning-warning' );