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
'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': [
true
'Places a link on the bottom of threads to open the QR.'

View File

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