Move form checking to named function.

This commit is contained in:
ccd0 2015-06-20 20:01:54 -07:00
parent cde281cdf6
commit 07fa6e944e

View File

@ -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'