Add 'Post on Captcha Completion' option.

This commit is contained in:
ccd0 2014-12-09 15:14:25 -08:00
parent c709ddf26d
commit 898464cfab
2 changed files with 19 additions and 12 deletions

View File

@ -379,6 +379,10 @@ Config =
false false
'Automatically load the captcha in the QR even if your post is empty.' 'Automatically load the captcha in the QR even if your post is empty.'
] ]
'Post on Captcha Completion': [
false
'Submit the post immediately when the captcha is completed.'
]
'Bottom QR Link': [ 'Bottom QR Link': [
true true
'Places a link on the bottom of threads to open the QR.' 'Places a link on the bottom of threads to open the QR.'

View File

@ -122,21 +122,24 @@ QR.captcha =
null null
save: (pasted) -> save: (pasted) ->
response = $('textarea', @nodes.container).value reload = QR.cooldown.auto and @needed()
timeout = (if pasted then @setupTime else Date.now()) + 2 * $.MINUTE $.forceSync 'captchas'
if QR.cooldown.auto and @needed() @captchas.push
response: $('textarea', @nodes.container).value
timeout: (if pasted then @setupTime else Date.now()) + 2 * $.MINUTE
@count()
$.set 'captchas', @captchas
if reload
@shouldFocus = true @shouldFocus = true
@reload() return @reload()
else
QR.nodes.status.focus()
if pasted if pasted
@destroy() @destroy()
else else
@timeouts.destroy ?= setTimeout @destroy.bind(@), 3 * $.SECOND @timeouts.destroy ?= setTimeout @destroy.bind(@), 3 * $.SECOND
$.forceSync 'captchas' QR.nodes.status.focus()
@captchas.push {response, timeout} QR.submit() if Conf['Post on Captcha Completion']
@count()
$.set 'captchas', @captchas
clear: -> clear: ->
return unless @captchas.length return unless @captchas.length