Let UnreadIndex handle removing unread line on contraction using PostsRemoved event.

This commit is contained in:
ccd0 2018-12-07 13:02:45 -08:00
parent 87fe975ac6
commit 70bcd9dc1b
2 changed files with 2 additions and 4 deletions

View File

@ -77,8 +77,6 @@ ExpandThread =
postsCount = 0
filesCount = 0
for reply in replies
# rm elements above post such as unread line
$.rm node while (node = a.nextSibling) and node isnt reply
# rm clones
inlined.click() while inlined = $ '.inlined', reply if Conf['Quote Inlining']
postsCount++

View File

@ -14,7 +14,7 @@ UnreadIndex =
cb: @node
$.on d, 'IndexRefreshInternal', @onIndexRefresh
$.on d, 'PostsInserted', @onPostsInserted
$.on d, 'PostsInserted PostsRemoved', @onPostsInserted
node: ->
UnreadIndex.lastReadPost[@fullID] = UnreadIndex.db.get(
@ -36,7 +36,7 @@ UnreadIndex =
return if !thread or thread.nodes.root isnt e.target
wasVisible = !!UnreadIndex.hr[thread.fullID]?.parentNode
UnreadIndex.update thread
if Conf['Scroll to Last Read Post'] and !wasVisible and !!UnreadIndex.hr[thread.fullID]?.parentNode
if Conf['Scroll to Last Read Post'] and e.type is 'PostsInserted' and !wasVisible and !!UnreadIndex.hr[thread.fullID]?.parentNode
Header.scrollToIfNeeded UnreadIndex.hr[thread.fullID], true
sync: ->