Fire PostsInserted event on common ancestor of inserted posts.

This commit is contained in:
ccd0 2018-10-20 12:40:52 -07:00
parent 8be6bd3898
commit 96cae8339a
5 changed files with 7 additions and 7 deletions

View File

@ -152,7 +152,7 @@ Index =
board = $ '.board'
$.replace board, Index.root
if Index.loaded
$.event 'PostsInserted'
$.event 'PostsInserted', null, Index.root
# Hacks:
# - When removing an element from the document during page load,
# its ancestors will still be correctly created inside of it.
@ -884,7 +884,7 @@ Index =
nodes.push thread.nodes.root, $.el('hr')
$.add Index.root, nodes
if Index.root.parentNode
$.event 'PostsInserted'
$.event 'PostsInserted', null, Index.root
Index.loaded = true
return
@ -901,7 +901,7 @@ Index =
$.queueTask fn
else
if Index.root.parentNode
$.event 'PostsInserted'
$.event 'PostsInserted', null, Index.root
Index.loaded = true
fn()
return

View File

@ -98,7 +98,7 @@ ExpandThread =
postsRoot.push root
Main.callbackNodes 'Post', posts
$.after a, postsRoot
$.event 'PostsInserted'
$.event 'PostsInserted', null, a.parentNode
postsCount = postsRoot.length
a.textContent = Build.summaryText '-', postsCount, filesCount

View File

@ -122,7 +122,7 @@ ReplyPruning =
ReplyPruning.hidden--
ReplyPruning.hiddenFiles-- if post.file
$.after ReplyPruning.summary, frag
$.event 'PostsInserted'
$.event 'PostsInserted', null, ReplyPruning.summary.parentNode
ReplyPruning.summary.textContent = if ReplyPruning.active
Build.summaryText '+', ReplyPruning.hidden, ReplyPruning.hiddenFiles

View File

@ -337,7 +337,7 @@ ThreadUpdater =
unless QuoteThreading.insert post
firstPost or= post.nodes.root
$.add ThreadUpdater.root, post.nodes.root
$.event 'PostsInserted'
$.event 'PostsInserted', null, ThreadUpdater.root
if scroll
if Conf['Bottom Scroll']

View File

@ -48,7 +48,7 @@ class Fetcher
$.rmAll @root
$.add @root, nodes.root
$.event 'PostsInserted'
$.event 'PostsInserted', null, @root
fetchedPost: (req, isCached) ->
# In case of multiple callbacks for the same request,