Fix QR.cooldown data not being set up when called from DeleteLink.
This commit is contained in:
parent
9a0447177f
commit
779aa10e9c
@ -51,6 +51,7 @@ Main =
|
|||||||
for db in DataBoard.keys
|
for db in DataBoard.keys
|
||||||
Conf[db] = boards: {}
|
Conf[db] = boards: {}
|
||||||
Conf['selectedArchives'] = {}
|
Conf['selectedArchives'] = {}
|
||||||
|
Conf['cooldowns'] = {}
|
||||||
|
|
||||||
$.get Conf, (items) ->
|
$.get Conf, (items) ->
|
||||||
$.extend Conf, items
|
$.extend Conf, items
|
||||||
@ -338,6 +339,7 @@ Main =
|
|||||||
['Recursive', Recursive]
|
['Recursive', Recursive]
|
||||||
['Strike-through Quotes', QuoteStrikeThrough]
|
['Strike-through Quotes', QuoteStrikeThrough]
|
||||||
['Quick Reply', QR]
|
['Quick Reply', QR]
|
||||||
|
['Cooldown', QR.cooldown]
|
||||||
['Menu', Menu]
|
['Menu', Menu]
|
||||||
['Index Generator (Menu)', Index.menu]
|
['Index Generator (Menu)', Index.menu]
|
||||||
['Report Link', ReportLink]
|
['Report Link', ReportLink]
|
||||||
|
|||||||
@ -524,7 +524,7 @@ $.clear = (cb) ->
|
|||||||
# XXX https://github.com/greasemonkey/greasemonkey/issues/2033
|
# XXX https://github.com/greasemonkey/greasemonkey/issues/2033
|
||||||
# Also support case where GM_listValues is not defined.
|
# Also support case where GM_listValues is not defined.
|
||||||
$.delete Object.keys(Conf)
|
$.delete Object.keys(Conf)
|
||||||
$.delete ['previousversion', 'AutoWatch', 'cooldowns', 'QR Size', 'captchas', 'QR.persona', 'hiddenPSA']
|
$.delete ['previousversion', 'AutoWatch', 'QR Size', 'captchas', 'QR.persona', 'hiddenPSA']
|
||||||
$.delete ("#{id}.position" for id in ['embedding', 'updater', 'thread-stats', 'thread-watcher', 'qr'])
|
$.delete ("#{id}.position" for id in ['embedding', 'updater', 'thread-stats', 'thread-watcher', 'qr'])
|
||||||
try
|
try
|
||||||
$.delete $.listValues().map (key) -> key.replace g.NAMESPACE, ''
|
$.delete $.listValues().map (key) -> key.replace g.NAMESPACE, ''
|
||||||
|
|||||||
@ -565,7 +565,7 @@ QR =
|
|||||||
QR.persona.init()
|
QR.persona.init()
|
||||||
new QR.post true
|
new QR.post true
|
||||||
QR.status()
|
QR.status()
|
||||||
QR.cooldown.init()
|
QR.cooldown.setup()
|
||||||
QR.captcha.init()
|
QR.captcha.init()
|
||||||
|
|
||||||
$.add d.body, dialog
|
$.add d.body, dialog
|
||||||
|
|||||||
@ -1,7 +1,14 @@
|
|||||||
QR.cooldown =
|
QR.cooldown =
|
||||||
seconds: 0
|
seconds: 0
|
||||||
|
|
||||||
|
# Called from Main
|
||||||
init: ->
|
init: ->
|
||||||
|
return unless Conf['Quick Reply'] and Conf['Cooldown']
|
||||||
|
@data = Conf['cooldowns']
|
||||||
|
$.sync 'cooldowns', @sync
|
||||||
|
|
||||||
|
# Called from QR
|
||||||
|
setup: ->
|
||||||
return unless Conf['Cooldown']
|
return unless Conf['Cooldown']
|
||||||
|
|
||||||
# Read cooldown times
|
# Read cooldown times
|
||||||
@ -18,17 +25,17 @@ QR.cooldown =
|
|||||||
# There is a 300 second inter-board thread cooldown.
|
# There is a 300 second inter-board thread cooldown.
|
||||||
QR.cooldown.delays['thread_global'] = 300
|
QR.cooldown.delays['thread_global'] = 300
|
||||||
|
|
||||||
# Retrieve recent posts and delays.
|
QR.cooldown.start()
|
||||||
$.get 'cooldowns', {}, ({cooldowns}) ->
|
|
||||||
QR.cooldown.data = cooldowns
|
|
||||||
QR.cooldown.start()
|
|
||||||
$.sync 'cooldowns', QR.cooldown.sync
|
|
||||||
|
|
||||||
start: ->
|
start: ->
|
||||||
{data} = QR.cooldown
|
{data} = QR.cooldown
|
||||||
unless QR.cooldown.isCounting or Object.keys(data[g.BOARD.ID] or {}).length + Object.keys(data.global or {}).length is 0
|
return unless (
|
||||||
QR.cooldown.isCounting = true
|
QR.cooldown.delays and
|
||||||
QR.cooldown.count()
|
!QR.cooldown.isCounting and
|
||||||
|
Object.keys(data[g.BOARD.ID] or {}).length + Object.keys(data.global or {}).length > 0
|
||||||
|
)
|
||||||
|
QR.cooldown.isCounting = true
|
||||||
|
QR.cooldown.count()
|
||||||
|
|
||||||
sync: (data) ->
|
sync: (data) ->
|
||||||
QR.cooldown.data = data or {}
|
QR.cooldown.data = data or {}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user