Turning off threading should hide the "Thread New Posts" link.

Also simplify a little.
This commit is contained in:
ccd0 2015-02-01 16:28:51 -08:00
parent 742184d2c0
commit 136be3763f

View File

@ -17,8 +17,8 @@ QuoteThreading =
@input = $('input', @controls) @input = $('input', @controls)
$.on @input, 'change', @cb.thread $.on @input, 'change', @rethread
$.on @threadNewLink.firstElementChild, 'click', @cb.click $.on @threadNewLink.firstElementChild, 'click', @rethread
Header.menu.addEntry @entry = Header.menu.addEntry @entry =
el: @controls el: @controls
@ -99,11 +99,13 @@ QuoteThreading =
return true return true
rethread: (enabled) -> rethread: ->
{thread} = QuoteThreading {thread} = QuoteThreading
{posts} = thread {posts} = thread
if QuoteThreading.enabled = enabled QuoteThreading.threadNewLink.hidden = true
if QuoteThreading.enabled = QuoteThreading.input.checked
posts.forEach QuoteThreading.insert posts.forEach QuoteThreading.insert
else else
nodes = [] nodes = []
@ -125,9 +127,3 @@ QuoteThreading =
Unread.setLine true Unread.setLine true
Unread.read() Unread.read()
Unread.update() Unread.update()
cb:
thread: -> QuoteThreading.rethread QuoteThreading.input.checked
click: ->
QuoteThreading.threadNewLink.hidden = true
QuoteThreading.rethread true