Make 'Threading' and 'Show Last <n>' checkboxes turn each other off.

This commit is contained in:
ccd0 2016-04-03 00:07:31 -07:00
parent a567752ba1
commit f6010ca298
3 changed files with 22 additions and 4 deletions

View File

@ -407,7 +407,7 @@ Config =
] ]
'Reply Pruning': [ 'Reply Pruning': [
true true
'Hide old replies in long threads. Number of replies shown can be set from header menu. Not compatible with Quote Threading.' 'Hide old replies in long threads. Number of replies shown can be set from header menu.'
] ]
'Posting and Captchas': 'Posting and Captchas':

View File

@ -1,6 +1,10 @@
ReplyPruning = ReplyPruning =
init: -> init: ->
return unless g.VIEW is 'thread' and Conf['Reply Pruning'] and not Conf['Quote Threading'] return unless g.VIEW is 'thread' and Conf['Reply Pruning']
if Conf['Quote Threading'] and Conf['Thread Quotes'] and Conf['Prune Replies']
Conf['Prune Replies'] = false
$.set 'Prune Replies', false
@container = $.frag() @container = $.frag()
@ -15,7 +19,7 @@ ReplyPruning =
enabled: label.firstElementChild enabled: label.firstElementChild
replies: el.lastElementChild replies: el.lastElementChild
$.on @inputs.enabled, 'change', $.cb.checked $.on @inputs.enabled, 'change', @setEnabled
$.on @inputs.replies, 'change', $.cb.value $.on @inputs.replies, 'change', $.cb.value
Header.menu.addEntry Header.menu.addEntry
@ -30,6 +34,13 @@ ReplyPruning =
hidden: 0 hidden: 0
total: 0 total: 0
setEnabled: ->
other = QuoteThreading.input
if @checked and other?.checked
other.checked = false
$.event 'change', null, other
$.cb.checked.call @
node: -> node: ->
ReplyPruning.thread = @ ReplyPruning.thread = @
ReplyPruning.total = @posts.keys.length - 1 ReplyPruning.total = @posts.keys.length - 1

View File

@ -17,7 +17,7 @@ QuoteThreading =
@input = $('input', @controls) @input = $('input', @controls)
@input.checked = Conf['Thread Quotes'] @input.checked = Conf['Thread Quotes']
$.on @input, 'change', $.cb.checked $.on @input, 'change', @setEnabled
$.on @input, 'change', @rethread $.on @input, 'change', @rethread
$.on @threadNewLink.firstElementChild, 'click', @rethread $.on @threadNewLink.firstElementChild, 'click', @rethread
$.on d, '4chanXInitFinished', => @ready = true $.on d, '4chanXInitFinished', => @ready = true
@ -38,6 +38,13 @@ QuoteThreading =
children: {} children: {}
inserted: {} inserted: {}
setEnabled: ->
other = ReplyPruning.inputs?.enabled
if @checked and other?.checked
other.checked = false
$.event 'change', null, other
$.cb.checked.call @
setThread: -> setThread: ->
QuoteThreading.thread = @ QuoteThreading.thread = @
$.asap (-> !Conf['Thread Updater'] or $ '.navLinksBot > .updatelink'), -> $.asap (-> !Conf['Thread Updater'] or $ '.navLinksBot > .updatelink'), ->