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 postsCount = 0
filesCount = 0 filesCount = 0
for reply in replies for reply in replies
# rm elements above post such as unread line
$.rm node while (node = a.nextSibling) and node isnt reply
# rm clones # rm clones
inlined.click() while inlined = $ '.inlined', reply if Conf['Quote Inlining'] inlined.click() while inlined = $ '.inlined', reply if Conf['Quote Inlining']
postsCount++ postsCount++

View File

@ -14,7 +14,7 @@ UnreadIndex =
cb: @node cb: @node
$.on d, 'IndexRefreshInternal', @onIndexRefresh $.on d, 'IndexRefreshInternal', @onIndexRefresh
$.on d, 'PostsInserted', @onPostsInserted $.on d, 'PostsInserted PostsRemoved', @onPostsInserted
node: -> node: ->
UnreadIndex.lastReadPost[@fullID] = UnreadIndex.db.get( UnreadIndex.lastReadPost[@fullID] = UnreadIndex.db.get(
@ -36,7 +36,7 @@ UnreadIndex =
return if !thread or thread.nodes.root isnt e.target return if !thread or thread.nodes.root isnt e.target
wasVisible = !!UnreadIndex.hr[thread.fullID]?.parentNode wasVisible = !!UnreadIndex.hr[thread.fullID]?.parentNode
UnreadIndex.update thread 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 Header.scrollToIfNeeded UnreadIndex.hr[thread.fullID], true
sync: -> sync: ->