mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/ConfirmEdit
synced 2024-11-13 18:07:00 +00:00
Remove obsolete aliases from closures
Bug: T208951 Change-Id: I82abf50e680639f326d3a1ca639bc05fa0eeb7c5
This commit is contained in:
parent
f6d5d6c990
commit
5c5d4a5429
|
@ -1,10 +1,10 @@
|
||||||
{
|
{
|
||||||
"extends": "wikimedia",
|
"extends": "wikimedia",
|
||||||
"env": {
|
"env": {
|
||||||
"browser": true,
|
"browser": true
|
||||||
"jquery": true
|
|
||||||
},
|
},
|
||||||
"globals": {
|
"globals": {
|
||||||
"mediaWiki": false
|
"mw": false,
|
||||||
|
"$": false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,33 +1,31 @@
|
||||||
( function ( $, mw ) {
|
$( document ).on( 'click', '.fancycaptcha-reload', function () {
|
||||||
$( document ).on( 'click', '.fancycaptcha-reload', function () {
|
var $this = $( this ),
|
||||||
var $this = $( this ),
|
$root = $this.closest( '.fancycaptcha-captcha-container' ),
|
||||||
$root = $this.closest( '.fancycaptcha-captcha-container' ),
|
$captchaImage = $root.find( '.fancycaptcha-image' );
|
||||||
$captchaImage = $root.find( '.fancycaptcha-image' );
|
|
||||||
|
|
||||||
$this.addClass( 'fancycaptcha-reload-loading' );
|
$this.addClass( 'fancycaptcha-reload-loading' );
|
||||||
|
|
||||||
// AJAX request to get captcha index key
|
// AJAX request to get captcha index key
|
||||||
new mw.Api().post( { action: 'fancycaptchareload' } ).done( function ( data ) {
|
new mw.Api().post( { action: 'fancycaptchareload' } ).done( function ( data ) {
|
||||||
var captchaIndex = data.fancycaptchareload.index,
|
var captchaIndex = data.fancycaptchareload.index,
|
||||||
imgSrc;
|
imgSrc;
|
||||||
if ( typeof captchaIndex === 'string' ) {
|
if ( typeof captchaIndex === 'string' ) {
|
||||||
// replace index key with a new one for captcha image
|
// replace index key with a new one for captcha image
|
||||||
imgSrc = $captchaImage.attr( 'src' ).replace( /(wpCaptchaId=)\w+/, '$1' + captchaIndex );
|
imgSrc = $captchaImage.attr( 'src' ).replace( /(wpCaptchaId=)\w+/, '$1' + captchaIndex );
|
||||||
$captchaImage.attr( 'src', imgSrc );
|
$captchaImage.attr( 'src', imgSrc );
|
||||||
|
|
||||||
// replace index key with a new one for hidden tag
|
// replace index key with a new one for hidden tag
|
||||||
$( '#mw-input-captchaId' ).val( captchaIndex );
|
$( '#mw-input-captchaId' ).val( captchaIndex );
|
||||||
$( '#mw-input-captchaWord' ).val( '' ).focus();
|
$( '#mw-input-captchaWord' ).val( '' ).focus();
|
||||||
|
|
||||||
// now do the same with a selector that works for pre-1.27 login forms
|
// now do the same with a selector that works for pre-1.27 login forms
|
||||||
$root.find( '[name="wpCaptchaId"]' ).val( captchaIndex );
|
$root.find( '[name="wpCaptchaId"]' ).val( captchaIndex );
|
||||||
$root.find( '[name="wpCaptchaWord"]' ).val( '' ).focus();
|
$root.find( '[name="wpCaptchaWord"]' ).val( '' ).focus();
|
||||||
}
|
}
|
||||||
} )
|
} )
|
||||||
.always( function () {
|
.always( function () {
|
||||||
$this.removeClass( 'fancycaptcha-reload-loading' );
|
$this.removeClass( 'fancycaptcha-reload-loading' );
|
||||||
} );
|
} );
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
} );
|
} );
|
||||||
}( jQuery, mediaWiki ) );
|
|
||||||
|
|
Loading…
Reference in a new issue