diff --git a/FancyCaptcha/FancyCaptcha.class.php b/FancyCaptcha/FancyCaptcha.class.php index 1ae70f89b..24b910f4a 100644 --- a/FancyCaptcha/FancyCaptcha.class.php +++ b/FancyCaptcha/FancyCaptcha.class.php @@ -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' ) { diff --git a/FancyCaptcha/i18n/en.json b/FancyCaptcha/i18n/en.json index 4fd10cd6a..0cac618c8 100644 --- a/FancyCaptcha/i18n/en.json +++ b/FancyCaptcha/i18n/en.json @@ -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.", diff --git a/FancyCaptcha/i18n/qqq.json b/FancyCaptcha/i18n/qqq.json index 0d1651c3d..b2a00da49 100644 --- a/FancyCaptcha/i18n/qqq.json +++ b/FancyCaptcha/i18n/qqq.json @@ -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}}", diff --git a/FancyCaptcha/resources/ext.confirmEdit.fancyCaptcha.js b/FancyCaptcha/resources/ext.confirmEdit.fancyCaptcha.js index a8db72180..e2ded5b90 100644 --- a/FancyCaptcha/resources/ext.confirmEdit.fancyCaptcha.js +++ b/FancyCaptcha/resources/ext.confirmEdit.fancyCaptcha.js @@ -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 () {