Fix unwanted captcha loads.

This commit is contained in:
ccd0 2014-12-08 20:35:21 -08:00
parent 0baec018e9
commit f032a52407
2 changed files with 11 additions and 6 deletions

View File

@ -29,6 +29,7 @@ QR.captcha =
shouldFocus: false
timeouts: {}
postsCount: 0
occupied: ->
{container} = @nodes
@ -37,9 +38,12 @@ QR.captcha =
needed: ->
captchaCount = @captchas.length
captchaCount++ if @occupied()
postsCount = QR.posts.length
postsCount = 0 if postsCount is 1 and !Conf['Auto-load captcha'] and !QR.posts[0].com and !QR.posts[0].file
captchaCount < postsCount
@postsCount = QR.posts.length
@postsCount = 0 if @postsCount is 1 and !Conf['Auto-load captcha'] and !QR.posts[0].com and !QR.posts[0].file
captchaCount < @postsCount
onPostChange: ->
@setup() if @postsCount is 0
toggle: ->
if @occupied()

View File

@ -37,7 +37,6 @@ QR.post = class
prev = QR.posts[QR.posts.length - 1]
QR.posts.push @
QR.captcha.setup()
@nodes.spoiler.checked = @spoiler = if prev and Conf['Remember Spoiler']
prev.spoiler
else
@ -70,6 +69,8 @@ QR.post = class
@load() if QR.selected is @ # load persona
@select() if select
@unlock()
# Post count temporarily off by 1 when called from QR.post.rm
$.queueTask -> QR.captcha.setup()
rm: ->
@delete()
@ -132,7 +133,7 @@ QR.post = class
QR.status()
when 'com'
@nodes.span.textContent = @com
QR.captcha.setup()
QR.captcha.onPostChange()
QR.characterCount()
# Disable auto-posting if you're typing in the first post
# during the last 5 seconds of the cooldown.
@ -161,7 +162,7 @@ QR.post = class
@filename = file.name
@filesize = $.bytesToString file.size
@nodes.label.hidden = false if QR.spoiler
QR.captcha.setup()
QR.captcha.onPostChange()
URL.revokeObjectURL @URL
if @ is QR.selected
@showFileData()