4chan-x/src/Miscellaneous/Report.coffee
2013-07-24 22:06:08 -07:00

14 lines
531 B
CoffeeScript

Report =
init: ->
return unless /report/.test(location.search) and not d.cookie.contains 'pass_enabled=1'
$.asap (-> $.id 'recaptcha_response_field'), Report.ready
ready: ->
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) ->
e.preventDefault()
response = field.value.trim()
field.value = "#{response} #{response}" unless /\s/.test response
@submit()