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

View File

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

View File

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

View File

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

View File

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