diff --git a/src/Filtering/ThreadHiding.coffee b/src/Filtering/ThreadHiding.coffee index 395968c2a..430a11f08 100644 --- a/src/Filtering/ThreadHiding.coffee +++ b/src/Filtering/ThreadHiding.coffee @@ -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'] diff --git a/src/General/Build.coffee b/src/General/Build.coffee index 39b796a51..1a1bd7a8e 100644 --- a/src/General/Build.coffee +++ b/src/General/Build.coffee @@ -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 diff --git a/src/Miscellaneous/ExpandThread.coffee b/src/Miscellaneous/ExpandThread.coffee index 344544c7b..a1809fd52 100644 --- a/src/Miscellaneous/ExpandThread.coffee +++ b/src/Miscellaneous/ExpandThread.coffee @@ -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 diff --git a/src/Monitoring/ThreadUpdater.coffee b/src/Monitoring/ThreadUpdater.coffee index f0bdb10e4..e963fd98b 100644 --- a/src/Monitoring/ThreadUpdater.coffee +++ b/src/Monitoring/ThreadUpdater.coffee @@ -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 diff --git a/src/Quotelinks/QuoteThreading.coffee b/src/Quotelinks/QuoteThreading.coffee index 3f30297a4..600aeb636 100644 --- a/src/Quotelinks/QuoteThreading.coffee +++ b/src/Quotelinks/QuoteThreading.coffee @@ -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() diff --git a/src/classes/Thread.coffee b/src/classes/Thread.coffee index 1ae53e95a..fb3efe440 100644 --- a/src/classes/Thread.coffee +++ b/src/classes/Thread.coffee @@ -17,6 +17,9 @@ class Thread @OP = null @catalogView = null + @nodes = + root: null + @board.threads.push @ID, @ g.threads.push @fullID, @ diff --git a/src/main/Main.coffee b/src/main/Main.coffee index 8135a1710..d9bd1b024 100644 --- a/src/main/Main.coffee +++ b/src/main/Main.coffee @@ -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