mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/ConfirmEdit
synced 2024-09-24 10:49:46 +00:00
Merge "Properly isolate reloading functionality, drop createacct name"
This commit is contained in:
commit
2ae5ddcc41
|
@ -118,10 +118,10 @@ class FancyCaptcha extends SimpleCaptcha {
|
|||
Html::element( 'label', array(
|
||||
'for' => 'wpCaptchaWord',
|
||||
),
|
||||
parent::getMessage( 'label' ) . ' ' . wfMessage( 'createacct-captcha' )->text()
|
||||
parent::getMessage( 'label' ) . ' ' . wfMessage( 'fancycaptcha-captcha' )->text()
|
||||
) .
|
||||
Html::openElement( 'div', array( 'class' => 'mw-createacct-captcha-container' ) ) .
|
||||
Html::openElement( 'div', array( 'class' => 'mw-createacct-captcha-and-reload' ) ) .
|
||||
Html::openElement( 'div', array( 'class' => 'fancycaptcha-captcha-container' ) ) .
|
||||
Html::openElement( 'div', array( 'class' => 'fancycaptcha-captcha-and-reload' ) ) .
|
||||
Html::openElement( 'div', array( 'class' => 'fancycaptcha-image-container' ) ) .
|
||||
Html::element( 'img', array(
|
||||
'class' => 'fancycaptcha-image',
|
||||
|
@ -140,7 +140,7 @@ class FancyCaptcha extends SimpleCaptcha {
|
|||
'autocapitalize' => 'off',
|
||||
'required' => 'required',
|
||||
'tabindex' => $tabIndex,
|
||||
'placeholder' => wfMessage( 'createacct-imgcaptcha-ph' )
|
||||
'placeholder' => wfMessage( 'fancycaptcha-imgcaptcha-ph' )
|
||||
)
|
||||
); // tab in before the edit textarea
|
||||
if ( $this->action == 'usercreate' ) {
|
||||
|
|
|
@ -5,9 +5,11 @@
|
|||
"fancycaptcha-desc": "Fancy CAPTCHA generator for Confirm Edit",
|
||||
"fancycaptcha-addurl": "Your edit includes new external links.\nTo protect the wiki against automated spam, we kindly ask you to enter the words that appear below in the box ([[Special:Captcha/help|more info]]):",
|
||||
"fancycaptcha-badlogin": "To protect the wiki against automated password cracking, we kindly ask you to enter the words that appear below in the box ([[Special:Captcha/help|more info]]):",
|
||||
"fancycaptcha-captcha": "Security check",
|
||||
"fancycaptcha-createaccount": "To protect the wiki against automated account creation, we kindly ask you to enter the words that appear below in the box ([[Special:Captcha/help|more info]]):",
|
||||
"fancycaptcha-create": "To create the page, please enter the words that appear below in the box ([[Special:Captcha/help|more info]]):",
|
||||
"fancycaptcha-edit": "To edit this page, please enter the words that appear below in the box ([[Special:Captcha/help|more info]]):",
|
||||
"fancycaptcha-imgcaptcha-ph": "Enter the text you see above",
|
||||
"fancycaptcha-sendemail": "To protect the wiki against automated spamming, we kindly ask you to enter the words that appear below in the box ([[Special:Captcha/help|more info]]):",
|
||||
"fancycaptcha-reload-text": "Refresh",
|
||||
"apihelp-fancycaptchareload-description": "Get a new FancyCaptcha.",
|
||||
|
|
|
@ -10,9 +10,11 @@
|
|||
"fancycaptcha-desc": "{{Optional}}\n{{desc}}",
|
||||
"fancycaptcha-addurl": "{{Related|ConfirmEdit-addurl}}",
|
||||
"fancycaptcha-badlogin": "{{Related|ConfirmEdit-badlogin}}",
|
||||
"fancycaptcha-captcha": "Brief label for image CAPTCHA input field",
|
||||
"fancycaptcha-createaccount": "{{Related|ConfirmEdit-createaccount}}",
|
||||
"fancycaptcha-create": "{{Related|ConfirmEdit-create}}",
|
||||
"fancycaptcha-edit": "{{Related|ConfirmEdit-edit}}",
|
||||
"fancycaptcha-imgcaptcha-ph": "Placeholder text for image CAPTCHA input field.",
|
||||
"fancycaptcha-sendemail": "{{Related|ConfirmEdit-sendemail}}",
|
||||
"fancycaptcha-reload-text": "Prompts a click to get a new FancyCaptcha image.\n{{Identical|Refresh}}",
|
||||
"apihelp-fancycaptchareload-description": "{{doc-apihelp-description|fancycaptchareload}}",
|
||||
|
|
|
@ -1,11 +1,13 @@
|
|||
( function ( $, mw ) {
|
||||
var api = new mw.Api();
|
||||
$( document ).on( 'click', '.fancycaptcha-reload', function () {
|
||||
var $this = $( this ), $captchaImage;
|
||||
var $this = $( this ), $root, $captchaImage;
|
||||
|
||||
$root = $this.closest( '.fancycaptcha-captcha-container' );
|
||||
|
||||
$this.addClass( 'fancycaptcha-reload-loading' );
|
||||
|
||||
$captchaImage = $( '.fancycaptcha-image' );
|
||||
$captchaImage = $root.find( '.fancycaptcha-image' );
|
||||
|
||||
// AJAX request to get captcha index key
|
||||
api.post( {
|
||||
|
@ -16,6 +18,7 @@
|
|||
} )
|
||||
.done( function ( xmldata ) {
|
||||
var imgSrc, captchaIndex;
|
||||
|
||||
captchaIndex = $( xmldata ).find( 'fancycaptchareload' ).attr( 'index' );
|
||||
if ( typeof captchaIndex === 'string' ) {
|
||||
// replace index key with a new one for captcha image
|
||||
|
@ -24,8 +27,8 @@
|
|||
$captchaImage.attr( 'src', imgSrc );
|
||||
|
||||
// replace index key with a new one for hidden tag
|
||||
$( '#wpCaptchaId' ).val( captchaIndex );
|
||||
$( '#wpCaptchaWord' ).val( '' ).focus();
|
||||
$root.find( '[name="wpCaptchaId"]' ).val( captchaIndex );
|
||||
$root.find( '[name="wpCaptchaWord"]' ).val( '' ).focus();
|
||||
}
|
||||
} )
|
||||
.always( function () {
|
||||
|
|
Loading…
Reference in a new issue