Fix total not being updated when pruning checkbox was disabled. Also simplify.

This commit is contained in:
ccd0 2016-04-02 22:55:22 -07:00
parent 7337412c35
commit 1b6095ec26

View File

@ -33,16 +33,9 @@ ReplyPruning =
node: ->
ReplyPruning.thread = @
ReplyPruning.total = @posts.keys.length - 1
$.on ReplyPruning.inputs.enabled, 'change', ReplyPruning.setEnabled
$.on ReplyPruning.inputs.enabled, 'change', ReplyPruning.update
if Conf['Prune Replies']
ReplyPruning.setEnabled()
ReplyPruning.update()
setEnabled: ->
onOff = if Conf['Prune Replies'] then $.on else $.off
onOff ReplyPruning.inputs.replies, 'change', ReplyPruning.update
onOff d, 'ThreadUpdate', ReplyPruning.update
$.on ReplyPruning.inputs.replies, 'change', ReplyPruning.update
$.on d, 'ThreadUpdate', ReplyPruning.update
update: (e) ->
if e and e.type is 'ThreadUpdate' and not e.detail[404]