From 244d41bb1ef215ab08b666a22fd40b51d6bb148a Mon Sep 17 00:00:00 2001 From: ccd0 Date: Sat, 10 Nov 2018 18:53:56 -0800 Subject: [PATCH] Don't remove code paste field if the captcha is refusing to serve a challenge. --- src/Posting/Captcha.fixes.coffee | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/Posting/Captcha.fixes.coffee b/src/Posting/Captcha.fixes.coffee index bfc28f288..e5640e9be 100644 --- a/src/Posting/Captcha.fixes.coffee +++ b/src/Posting/Captcha.fixes.coffee @@ -73,8 +73,15 @@ Captcha.fixes = initNoscript: -> @noscript = true - data = if (token = $('.fbc-verification-token > textarea')?.value) then {token} else {working: true} - new Connection(window.parent, '*').send data + form = $ '.fbc-imageselect-challenge > form' + data = + if (token = $('.fbc-verification-token > textarea')?.value) + {token} + else if $('.fbc-imageselect-challenge > form') + {working: true} + else + null + new Connection(window.parent, '*').send data if data d.body.classList.toggle 'focus', d.hasFocus() $.on window, 'focus blur', -> d.body.classList.toggle 'focus', d.hasFocus() @@ -85,7 +92,7 @@ Captcha.fixes = $.addStyle @cssNoscript @addLabels() $.on d, 'keydown', @keybinds.bind(@) - $.on $('.fbc-imageselect-challenge > form'), 'submit', @checkForm.bind(@) + $.on form, 'submit', @checkForm.bind(@) fixImages: -> @images = $$ '.rc-image-tile-target'