Move cooldown parsing into Boards class and use boards.json data rather than script on page.
This commit is contained in:
parent
95b12e3240
commit
39792ad2ca
@ -1,11 +1,5 @@
|
||||
QR.cooldown =
|
||||
seconds: 0
|
||||
delays:
|
||||
thread: 0
|
||||
reply: 0
|
||||
image: 0
|
||||
deletion: 60 # cooldown for deleting posts/files
|
||||
thread_global: 300 # inter-board thread cooldown
|
||||
|
||||
# Called from Main
|
||||
init: ->
|
||||
@ -16,13 +10,7 @@ QR.cooldown =
|
||||
# Called from QR
|
||||
setup: ->
|
||||
# Read cooldown times
|
||||
if m = Get.scriptData().match /\bcooldowns *= *({[^}]+})/
|
||||
$.extend QR.cooldown.delays, JSON.parse m[1]
|
||||
|
||||
# Pass users have reduced cooldowns.
|
||||
if d.cookie.indexOf('pass_enabled=1') >= 0
|
||||
for key in ['reply', 'image']
|
||||
QR.cooldown.delays[key] = Math.ceil(QR.cooldown.delays[key] / 2)
|
||||
QR.cooldown.delays = g.BOARD.cooldowns()
|
||||
|
||||
# The longest reply cooldown, for use in pruning old reply data
|
||||
QR.cooldown.maxDelay = 0
|
||||
|
||||
@ -7,3 +7,17 @@ class Board
|
||||
@config = BoardConfig.boards?[@ID] or {}
|
||||
|
||||
g.boards[@] = @
|
||||
|
||||
cooldowns: ->
|
||||
c2 = (@config or {}).cooldowns or {}
|
||||
c =
|
||||
thread: c2.threads or 0
|
||||
reply: c2.replies or 0
|
||||
image: c2.images or 0
|
||||
deletion: 60 # cooldown for deleting posts/files
|
||||
thread_global: 300 # inter-board thread cooldown
|
||||
# Pass users have reduced cooldowns.
|
||||
if d.cookie.indexOf('pass_enabled=1') >= 0
|
||||
for key in ['reply', 'image']
|
||||
c[key] = Math.ceil(c[key] / 2)
|
||||
c
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user