Fix captcha support in the report window.

Also shave a line.
This commit is contained in:
Mayhem 2013-06-11 17:34:55 +02:00
parent 0f742f0d0b
commit dc2ed6f6f3

View File

@ -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()