From f6010ca298b870684825fb13b3a48747dd38e939 Mon Sep 17 00:00:00 2001 From: ccd0 Date: Sun, 3 Apr 2016 00:07:31 -0700 Subject: [PATCH] Make 'Threading' and 'Show Last ' checkboxes turn each other off. --- src/General/Config.coffee | 2 +- src/Monitoring/ReplyPruning.coffee | 15 +++++++++++++-- src/Quotelinks/QuoteThreading.coffee | 9 ++++++++- 3 files changed, 22 insertions(+), 4 deletions(-) diff --git a/src/General/Config.coffee b/src/General/Config.coffee index a0071387a..69cedfd42 100644 --- a/src/General/Config.coffee +++ b/src/General/Config.coffee @@ -407,7 +407,7 @@ Config = ] 'Reply Pruning': [ 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': diff --git a/src/Monitoring/ReplyPruning.coffee b/src/Monitoring/ReplyPruning.coffee index 932aa4d88..6d1b2594e 100644 --- a/src/Monitoring/ReplyPruning.coffee +++ b/src/Monitoring/ReplyPruning.coffee @@ -1,6 +1,10 @@ ReplyPruning = 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() @@ -15,7 +19,7 @@ ReplyPruning = enabled: label.firstElementChild replies: el.lastElementChild - $.on @inputs.enabled, 'change', $.cb.checked + $.on @inputs.enabled, 'change', @setEnabled $.on @inputs.replies, 'change', $.cb.value Header.menu.addEntry @@ -30,6 +34,13 @@ ReplyPruning = hidden: 0 total: 0 + setEnabled: -> + other = QuoteThreading.input + if @checked and other?.checked + other.checked = false + $.event 'change', null, other + $.cb.checked.call @ + node: -> ReplyPruning.thread = @ ReplyPruning.total = @posts.keys.length - 1 diff --git a/src/Quotelinks/QuoteThreading.coffee b/src/Quotelinks/QuoteThreading.coffee index 869de08e1..775abde7c 100644 --- a/src/Quotelinks/QuoteThreading.coffee +++ b/src/Quotelinks/QuoteThreading.coffee @@ -17,7 +17,7 @@ QuoteThreading = @input = $('input', @controls) @input.checked = Conf['Thread Quotes'] - $.on @input, 'change', $.cb.checked + $.on @input, 'change', @setEnabled $.on @input, 'change', @rethread $.on @threadNewLink.firstElementChild, 'click', @rethread $.on d, '4chanXInitFinished', => @ready = true @@ -38,6 +38,13 @@ QuoteThreading = children: {} inserted: {} + setEnabled: -> + other = ReplyPruning.inputs?.enabled + if @checked and other?.checked + other.checked = false + $.event 'change', null, other + $.cb.checked.call @ + setThread: -> QuoteThreading.thread = @ $.asap (-> !Conf['Thread Updater'] or $ '.navLinksBot > .updatelink'), ->