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,22 +122,25 @@ 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
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
$.forceSync 'captchas' $.forceSync 'captchas'
@captchas.push {response, timeout} @captchas.push
response: $('textarea', @nodes.container).value
timeout: (if pasted then @setupTime else Date.now()) + 2 * $.MINUTE
@count() @count()
$.set 'captchas', @captchas $.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: -> clear: ->
return unless @captchas.length return unless @captchas.length
now = Date.now() now = Date.now()