fix captcha after latest changes

This commit is contained in:
ccd0 2014-05-02 16:05:31 -07:00
parent 1174430791
commit 4ca58ff430
2 changed files with 6 additions and 4 deletions

View File

@ -1,3 +1,6 @@
**ccd0**
- Update due to more Recaptcha changes.
### v1.7.26
*2014-05-02*

View File

@ -33,6 +33,8 @@ QR.captcha =
QR.captcha.clear()
$.sync 'captchas', @sync
new MutationObserver(@afterSetup).observe $.id('captchaContainer'), childList: true
@beforeSetup()
@afterSetup() # reCAPTCHA might have loaded before the QR.
beforeSetup: ->
@ -42,14 +44,11 @@ QR.captcha =
input.placeholder = 'Focus to load reCAPTCHA'
@count()
$.on input, 'focus', @setup
@setupObserver = new MutationObserver @afterSetup
@setupObserver.observe $.id('captchaContainer'), childList: true
setup: ->
$.globalEval 'loadRecaptcha()'
afterSetup: ->
return unless challenge = $.id 'recaptcha_challenge_field_holder'
QR.captcha.setupObserver.disconnect()
delete QR.captcha.setupObserver
return if challenge is QR.captcha.nodes.challenge
setLifetime = (e) -> QR.captcha.lifetime = e.detail
$.on window, 'captcha:timeout', setLifetime