Include /r9k/ mute time in cooldowns. #535
This commit is contained in:
parent
746e89bb06
commit
36da421396
@ -764,12 +764,13 @@ QR =
|
||||
# Too many frequent mistyped captchas will auto-ban you!
|
||||
# On connection error, the post most likely didn't go through.
|
||||
QR.cooldown.addDelay post, 2
|
||||
else if err.textContent and (m = err.textContent.match /wait\s+(\d+)\s+second/i) and !/duplicate/i.test err.textContent
|
||||
QR.cooldown.auto = if QR.captcha.isEnabled
|
||||
!!QR.captcha.captchas.length
|
||||
else if err.textContent and (m = err.textContent.match /(?:(\d+)\s+minutes?\s+)?(\d+)\s+second/i) and !/duplicate|hour/i.test(err.textContent)
|
||||
QR.cooldown.auto = (!QR.captcha.isEnabled or !!QR.captcha.captchas.length) and !/have\s+been\s+muted/i.test(err.textContent)
|
||||
seconds = 60 * (+(m[1]||0)) + (+m[2])
|
||||
if /muted/i.test err.textContent
|
||||
QR.cooldown.addMute seconds
|
||||
else
|
||||
true
|
||||
QR.cooldown.addDelay post, +m[1]
|
||||
QR.cooldown.addDelay post, seconds
|
||||
QR.captcha.setup (d.activeElement is QR.nodes.status)
|
||||
else # stop auto-posting
|
||||
QR.cooldown.auto = false
|
||||
|
||||
@ -60,6 +60,11 @@ QR.cooldown =
|
||||
QR.cooldown.set g.BOARD.ID, Date.now(), cooldown
|
||||
QR.cooldown.start()
|
||||
|
||||
addMute: (delay) ->
|
||||
return unless Conf['Cooldown']
|
||||
QR.cooldown.set g.BOARD.ID, Date.now(), {type: 'mute', delay}
|
||||
QR.cooldown.start()
|
||||
|
||||
delete: (post) ->
|
||||
return unless Conf['Cooldown']
|
||||
$.forceSync 'cooldowns'
|
||||
@ -121,7 +126,7 @@ QR.cooldown =
|
||||
if cooldown.delay <= elapsed
|
||||
delete cooldowns[start]
|
||||
save.push scope
|
||||
else if cooldown.type is type and cooldown.threadID is threadID
|
||||
else if (cooldown.type is type and cooldown.threadID is threadID) or cooldown.type is 'mute'
|
||||
# Delays only apply to the given post type and thread.
|
||||
seconds = Math.max seconds, cooldown.delay - elapsed
|
||||
continue
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user