From 07fa6e944eed80f5374e54fb8dfb36cfd28f39b2 Mon Sep 17 00:00:00 2001 From: ccd0 Date: Sat, 20 Jun 2015 20:01:54 -0700 Subject: [PATCH] Move form checking to named function. --- src/Posting/Captcha.fixes.coffee | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/Posting/Captcha.fixes.coffee b/src/Posting/Captcha.fixes.coffee index 896e722de..fac54a480 100644 --- a/src/Posting/Captcha.fixes.coffee +++ b/src/Posting/Captcha.fixes.coffee @@ -55,10 +55,7 @@ Captcha.fixes = $.addStyle @cssNoscript @addLabels() $.on d, 'keydown', @keybinds.bind(@) - $.on $('.fbc-imageselect-challenge > form'), 'submit', (e) => - n = 0 - n++ for checkbox in @images when checkbox.checked - e.preventDefault() if n is 0 + $.on $('.fbc-imageselect-challenge > form'), 'submit', @checkForm.bind(@) fixImages: -> @images = $$ '.rc-imageselect-target > div' @@ -77,6 +74,11 @@ Captcha.fixes = label $.add imageSelect, labels + checkForm: (e) -> + n = 0 + n++ for checkbox in @images when checkbox.checked + e.preventDefault() if n is 0 + keybinds: (e) -> return unless @images and doc.contains(@images[0]) and d.activeElement reload = $ '#recaptcha-reload-button, .fbc-button-reload'