Let UnreadIndex handle removing unread line on contraction using PostsRemoved event.
This commit is contained in:
parent
87fe975ac6
commit
70bcd9dc1b
@ -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++
|
||||||
|
|||||||
@ -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: ->
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user