/*!
* Scripts for pre-emptive edit preparing on action=edit
*/
-/* eslint-disable no-use-before-define */
-( function ( mw, $ ) {
+
+( function () {
if ( !mw.config.get( 'wgAjaxEditStash' ) ) {
return;
}
return;
}
+ // Whether the body text content changed since the last stashEdit()
+ function isTextChanged() {
+ return lastText !== $text.textSelection( 'getContents' );
+ }
+
+ // Whether the edit summary has changed since the last stashEdit()
+ function isSummaryChanged() {
+ return lastSummary !== $summary.textSelection( 'getContents' );
+ }
+
// Send a request to stash the edit to the API.
// If a request is in progress, abort it since its payload is stale and the API
// may limit concurrent stash parses.
if ( stashReq ) {
if ( lastPriority > priority ) {
// Stash request for summary change should wait on pending text change stash
+ // eslint-disable-next-line no-use-before-define
stashReq.then( checkStash );
return;
}
} );
}
- // Whether the body text content changed since the last stashEdit()
- function isTextChanged() {
- return lastText !== $text.textSelection( 'getContents' );
- }
-
- // Whether the edit summary has changed since the last stashEdit()
- function isSummaryChanged() {
- return lastSummary !== $summary.textSelection( 'getContents' );
- }
-
// Check whether text or summary have changed and call stashEdit()
function checkStash() {
if ( !isTextChanged() && !isSummaryChanged() ) {
checkStash();
}
} );
-}( mediaWiki, jQuery ) );
+}() );