Add thread.nodes.root property.

This commit is contained in:
ccd0 2016-09-25 13:08:09 -07:00
parent 3997cf354d
commit 8a6b6b5ec8
7 changed files with 12 additions and 8 deletions

View File

@ -175,7 +175,7 @@ ThreadHiding =
hide: (thread, makeStub=Conf['Stubs']) ->
return if thread.isHidden
threadRoot = thread.OP.nodes.root.parentNode
threadRoot = thread.nodes.root
thread.isHidden = true
Index.updateHideLabel() if Conf['JSON Index']
@ -187,6 +187,6 @@ ThreadHiding =
if thread.stub
$.rm thread.stub
delete thread.stub
threadRoot = thread.OP.nodes.root.parentNode
threadRoot = thread.nodes.root
threadRoot.hidden = thread.isHidden = false
Index.updateHideLabel() if Conf['JSON Index']

View File

@ -163,10 +163,10 @@ Build =
href: "/#{boardID}/thread/#{threadID}"
thread: (thread, data) ->
if (root = thread.OP.nodes.root.parentNode)
if (root = thread.nodes.root)
$.rmAll root
else
root = $.el 'div',
thread.nodes.root = root = $.el 'div',
className: 'thread'
id: "t#{data.no}"
$.add root, Build.hat.cloneNode(false) if Build.hat

View File

@ -10,7 +10,7 @@ ExpandThread =
cb: -> ExpandThread.setButton @
setButton: (thread) ->
return unless a = $.x 'following-sibling::*[contains(@class,"summary")][1]', thread.OP.nodes.root
return unless thread.nodes.root and (a = $ '.summary', thread.nodes.root)
a.textContent = Build.summaryText '+', a.textContent.match(/\d+/g)...
a.style.cursor = 'pointer'
$.on a, 'click', ExpandThread.cbToggle
@ -34,7 +34,7 @@ ExpandThread =
ExpandThread.toggle Get.threadFromNode @
toggle: (thread) ->
threadRoot = thread.OP.nodes.root.parentNode
threadRoot = thread.nodes.root
return unless a = $ '.summary', threadRoot
if thread.ID of ExpandThread.statuses
ExpandThread.contract thread, a, threadRoot

View File

@ -67,7 +67,7 @@ ThreadUpdater =
node: ->
ThreadUpdater.thread = @
ThreadUpdater.root = @OP.nodes.root.parentNode
ThreadUpdater.root = @nodes.root
ThreadUpdater.outdateCount = 0
# We must keep track of our own list of live posts/files

View File

@ -139,7 +139,7 @@ QuoteThreading =
$.rmClass post.nodes.root, 'threadOP'
$.rm post.nodes.threadContainer
delete post.nodes.threadContainer
$.add thread.OP.nodes.root.parentNode, nodes
$.add thread.nodes.root, nodes
Unread.position = Unread.order.first
Unread.updatePosition()

View File

@ -17,6 +17,9 @@ class Thread
@OP = null
@catalogView = null
@nodes =
root: null
@board.threads.push @ID, @
g.threads.push @fullID, @

View File

@ -274,6 +274,7 @@ Main =
for threadRoot in $$ '.board > .thread', board
thread = new Thread +threadRoot.id[1..], g.BOARD
thread.nodes.root = threadRoot
threads.push thread
for postRoot in $$('.thread > .postContainer', threadRoot) when $('.postMessage', postRoot)
try