From 96cae8339a580e2c838c7eb1c9e3e63e008a1a2f Mon Sep 17 00:00:00 2001 From: ccd0 Date: Sat, 20 Oct 2018 12:40:52 -0700 Subject: [PATCH] Fire `PostsInserted` event on common ancestor of inserted posts. --- src/General/Index.coffee | 6 +++--- src/Miscellaneous/ExpandThread.coffee | 2 +- src/Monitoring/ReplyPruning.coffee | 2 +- src/Monitoring/ThreadUpdater.coffee | 2 +- src/classes/Fetcher.coffee | 2 +- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/General/Index.coffee b/src/General/Index.coffee index 82c444fe9..b2a505dee 100644 --- a/src/General/Index.coffee +++ b/src/General/Index.coffee @@ -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 diff --git a/src/Miscellaneous/ExpandThread.coffee b/src/Miscellaneous/ExpandThread.coffee index 0fba9b288..3a2580fff 100644 --- a/src/Miscellaneous/ExpandThread.coffee +++ b/src/Miscellaneous/ExpandThread.coffee @@ -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 diff --git a/src/Monitoring/ReplyPruning.coffee b/src/Monitoring/ReplyPruning.coffee index 0334342ad..e4c9f798f 100644 --- a/src/Monitoring/ReplyPruning.coffee +++ b/src/Monitoring/ReplyPruning.coffee @@ -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 diff --git a/src/Monitoring/ThreadUpdater.coffee b/src/Monitoring/ThreadUpdater.coffee index d23988e62..2e940d838 100644 --- a/src/Monitoring/ThreadUpdater.coffee +++ b/src/Monitoring/ThreadUpdater.coffee @@ -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'] diff --git a/src/classes/Fetcher.coffee b/src/classes/Fetcher.coffee index af98fb141..1e144c68b 100644 --- a/src/classes/Fetcher.coffee +++ b/src/classes/Fetcher.coffee @@ -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,