From ea2b28f9b17036295abf323b801fc933e6975b85 Mon Sep 17 00:00:00 2001 From: ccd0 Date: Sat, 2 Apr 2016 22:17:42 -0700 Subject: [PATCH] Make 'Threading' checkbox persistent. #340 --- src/General/Config.coffee | 6 ++++-- src/General/Settings.coffee | 3 +++ src/Quotelinks/QuoteThreading.coffee | 11 +++++++---- 3 files changed, 14 insertions(+), 6 deletions(-) diff --git a/src/General/Config.coffee b/src/General/Config.coffee index 11e5d350c..3252d90ff 100644 --- a/src/General/Config.coffee +++ b/src/General/Config.coffee @@ -573,8 +573,8 @@ Config = 'Add \'(Cross-thread)\' to cross-threads quotes.' ] 'Quote Threading': [ - false - 'Thread conversations.' + true + 'Add option in header menu to thread conversations.' ] imageExpansion: @@ -1013,6 +1013,8 @@ Config = customCooldown: 0 customCooldownEnabled: true + 'Thread Quotes': false + replyPruning: 'Prune Replies': false 'Max Replies': 1000 diff --git a/src/General/Settings.coffee b/src/General/Settings.coffee index 2a279ebf9..566783cc5 100644 --- a/src/General/Settings.coffee +++ b/src/General/Settings.coffee @@ -354,6 +354,9 @@ Settings = if data['Oekaki Links']? and not data['Edit Link']? set 'Edit Link', data['Oekaki Links'] set 'Inline Cross-thread Quotes Only', true unless data['Inline Cross-thread Quotes Only']? + if compareString < '00001.00011.00030.00000' + if data['Quote Threading'] + set 'Thread Quotes', true changes loadSettings: (data, cb) -> diff --git a/src/Quotelinks/QuoteThreading.coffee b/src/Quotelinks/QuoteThreading.coffee index eb549715a..f8472aba2 100644 --- a/src/Quotelinks/QuoteThreading.coffee +++ b/src/Quotelinks/QuoteThreading.coffee @@ -6,9 +6,8 @@ QuoteThreading = init: -> return unless Conf['Quote Threading'] and g.VIEW is 'thread' - @enabled = true @controls = $.el 'span', - <%= html('') %> + <%= html('') %> @threadNewLink = $.el 'span', className: 'brackets-wrap threadnewlink' @@ -16,6 +15,7 @@ QuoteThreading = $.extend @threadNewLink, <%= html('Thread New Posts') %> @input = $('input', @controls) + @input.checked = Conf['Thread Quotes'] $.on @input, 'change', @rethread $.on @threadNewLink.firstElementChild, 'click', @rethread @@ -68,7 +68,7 @@ QuoteThreading = posts insert: (post) -> - return false unless QuoteThreading.enabled and + return false unless Conf['Thread Quotes'] and (parent = QuoteThreading.parent[post.fullID]) and !QuoteThreading.inserted[post.fullID] @@ -114,7 +114,10 @@ QuoteThreading = QuoteThreading.threadNewLink.hidden = true - if QuoteThreading.enabled = QuoteThreading.input.checked + Conf['Thread Quotes'] = QuoteThreading.input.checked + $.set 'Thread Quotes', Conf['Thread Quotes'] + + if Conf['Thread Quotes'] posts.forEach QuoteThreading.insert else nodes = []