From dc2ed6f6f35c784fc3705b54281e22a52cddf559 Mon Sep 17 00:00:00 2001 From: Mayhem Date: Tue, 11 Jun 2013 17:34:55 +0200 Subject: [PATCH] Fix captcha support in the report window. Also shave a line. --- src/Miscellaneous/Report.coffee | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/Miscellaneous/Report.coffee b/src/Miscellaneous/Report.coffee index eea172ddc..af505998d 100644 --- a/src/Miscellaneous/Report.coffee +++ b/src/Miscellaneous/Report.coffee @@ -1,14 +1,13 @@ Report = init: -> - return unless /report/.test location.search - $.ready @ready + return unless /report/.test(location.search) and d.cookie.indexOf('pass_enabled=1') is -1 + $.asap (-> $.id 'recaptcha_response_field'), Report.ready ready: -> - form = $ 'form' field = $.id 'recaptcha_response_field' $.on field, 'keydown', (e) -> $.globalEval 'Recaptcha.reload("t")' if e.keyCode is 8 and not field.value - $.on form, 'submit', (e) -> + $.on $('form'), 'submit', (e) -> e.preventDefault() response = field.value.trim() field.value = "#{response} #{response}" unless /\s/.test response - form.submit() + @submit()