diff --git a/js/quick-reply.js b/js/quick-reply.js
index 5c2a7b66..a00e9a7d 100644
--- a/js/quick-reply.js
+++ b/js/quick-reply.js
@@ -136,6 +136,50 @@
$dummyStuff = $('
').appendTo($postForm);
$postForm.find('table tr').each(function() {
+ function build_recaptcha() {
+ // Just show the image, and have it interact with the real form.
+ var $captchaimg = $td.find('#recaptcha_image img');
+
+ $captchaimg
+ .removeAttr('id')
+ .removeAttr('style')
+ .addClass('recaptcha_image')
+ .click(function() {
+ $('#recaptcha_reload').click();
+ });
+
+ // When we get a new captcha...
+ $('#recaptcha_response_field').focus(function() {
+ if ($captchaimg.attr('src') != $('#recaptcha_image img').attr('src')) {
+ $captchaimg.attr('src', $('#recaptcha_image img').attr('src'));
+ $postForm.find('input[name="recaptcha_challenge_field"]').val($('#recaptcha_challenge_field').val());
+ $postForm.find('input[name="recaptcha_response_field"]').val('').focus();
+ }
+ });
+
+ $postForm.submit(function() {
+ setTimeout(function() {
+ $('#recaptcha_reload').click();
+ }, 200);
+ });
+
+ // Make a new row for the response text
+ var $newRow = $(' |
');
+ $newRow.children().first().append(
+ $td.find('input').removeAttr('style')
+ );
+ $newRow.find('#recaptcha_response_field')
+ .removeAttr('id')
+ .addClass('recaptcha_response_field')
+ .attr('placeholder', $('#recaptcha_response_field').attr('placeholder'));
+
+ $('#recaptcha_response_field').addClass('recaptcha_response_field')
+
+ $td.replaceWith($(' | ').append($('').append($captchaimg)));
+
+ $newRow.insertAfter(this);
+ }
+
var $th = $(this).children('th:first');
var $td = $(this).children('td:first');
if ($th.length && $td.length) {
@@ -168,47 +212,7 @@
// reCAPTCHA
if ($td.find('#recaptcha_widget_div').length) {
- // Just show the image, and have it interact with the real form.
- var $captchaimg = $td.find('#recaptcha_image img');
-
- $captchaimg
- .removeAttr('id')
- .removeAttr('style')
- .addClass('recaptcha_image')
- .click(function() {
- $('#recaptcha_reload').click();
- });
-
- // When we get a new captcha...
- $('#recaptcha_response_field').focus(function() {
- if ($captchaimg.attr('src') != $('#recaptcha_image img').attr('src')) {
- $captchaimg.attr('src', $('#recaptcha_image img').attr('src'));
- $postForm.find('input[name="recaptcha_challenge_field"]').val($('#recaptcha_challenge_field').val());
- $postForm.find('input[name="recaptcha_response_field"]').val('').focus();
- }
- });
-
- $postForm.submit(function() {
- setTimeout(function() {
- $('#recaptcha_reload').click();
- }, 200);
- });
-
- // Make a new row for the response text
- var $newRow = $(' |
');
- $newRow.children().first().append(
- $td.find('input').removeAttr('style')
- );
- $newRow.find('#recaptcha_response_field')
- .removeAttr('id')
- .addClass('recaptcha_response_field')
- .attr('placeholder', $('#recaptcha_response_field').attr('placeholder'));
-
- $('#recaptcha_response_field').addClass('recaptcha_response_field')
-
- $td.replaceWith($(' | ').append($('').append($captchaimg)));
-
- $newRow.insertAfter(this);
+ build_recaptcha();
}
// Upload section