Quick fix for issues on lainchan due to not accounting for post container.

This commit is contained in:
ccd0 2018-12-13 20:44:02 -08:00
parent 983432d261
commit 9fd5a88242
2 changed files with 7 additions and 3 deletions

View File

@ -56,7 +56,7 @@ UnreadIndex =
repliesRead = 0
firstUnread = null
thread.posts.forEach (post) ->
if post.isReply and post.nodes.root.parentNode is thread.nodes.root
if post.isReply and thread.nodes.root.contains(post.nodes.root)
repliesShown++
if post.ID <= lastReadPost
repliesRead++

View File

@ -379,7 +379,7 @@ Main =
addThreads: (records) ->
threadRoots = []
for record in records
for node in record.addedNodes when node.matches(Site.selectors.thread)
for node in record.addedNodes when node.nodeType is Node.ELEMENT_NODE and node.matches(Site.selectors.thread)
threadRoots.push node
return unless threadRoots.length
threads = []
@ -398,8 +398,12 @@ Main =
errors = []
for record in records
thread = Get.threadFromRoot record.target
postRoots = []
for node in record.addedNodes when node.nodeType is Node.ELEMENT_NODE
if node.matches(Site.selectors.postContainer) or (node = $(Site.selectors.postContainer, node))
postRoots.push node
n = posts.length
Main.parsePosts record.addedNodes, thread, posts, errors
Main.parsePosts postRoots, thread, posts, errors
if posts.length > n and thread not in threads
threads.push thread
anyRemoved = false