diff --git a/4chan_x.user.js b/4chan_x.user.js
index 6b569d06d..4b8387aec 100644
--- a/4chan_x.user.js
+++ b/4chan_x.user.js
@@ -1415,7 +1415,7 @@
QR = {
init: function() {
- if (!$.id('recaptcha_challenge_field_holder')) {
+ if (!$.id('postForm')) {
return;
}
Main.callbacks.push(this.node);
@@ -1870,9 +1870,37 @@
captcha: {
init: function() {
var _this = this;
- this.img = $('.captcha > img', QR.el);
- this.input = $('[autocomplete]', QR.el);
- this.challenge = $.id('recaptcha_challenge_field_holder');
+ if (!(QR.captchaIsEnabled = !!$.id('captchaFormPart'))) {
+ return;
+ }
+ if ($.id('recaptcha_challenge_field_holder')) {
+ return this.ready();
+ } else {
+ this.onready = function() {
+ return _this.ready();
+ };
+ return $.on($.id('recaptcha_widget_div'), 'DOMNodeInserted', this.onready);
+ }
+ },
+ ready: function() {
+ var _this = this;
+ if (this.challenge = $.id('recaptcha_challenge_field_holder')) {
+ $.off($.id('recaptcha_widget_div'), 'DOMNodeInserted', this.onready);
+ delete this.onready;
+ } else {
+ return;
+ }
+ $.after($('.textarea', QR.el), $.el('div', {
+ className: 'captchaimg',
+ title: 'Reload',
+ innerHTML: ''
+ }));
+ $.after($('.captchaimg', QR.el), $.el('div', {
+ className: 'captchainput',
+ innerHTML: ''
+ }));
+ this.img = $('.captchaimg > img', QR.el);
+ this.input = $('.captchainput > input', QR.el);
$.on(this.img.parentNode, 'click', this.reload);
$.on(this.input, 'keydown', this.keydown);
$.on(this.challenge, 'DOMNodeInserted', function() {
@@ -1952,9 +1980,7 @@