Implement PostsRemoved event.
This commit is contained in:
parent
0ca735c200
commit
87fe975ac6
@ -183,7 +183,9 @@ ThreadHiding =
|
||||
threadRoot = thread.nodes.root
|
||||
thread.isHidden = true
|
||||
Index.updateHideLabel()
|
||||
$.rm thread.catalogView.nodes.root if thread.catalogView and !Index.showHiddenThreads
|
||||
if thread.catalogView and !Index.showHiddenThreads
|
||||
$.rm thread.catalogView.nodes.root
|
||||
$.event 'PostsRemoved', null, Index.root
|
||||
|
||||
return threadRoot.hidden = true unless makeStub
|
||||
|
||||
@ -196,4 +198,6 @@ ThreadHiding =
|
||||
threadRoot = thread.nodes.root
|
||||
threadRoot.hidden = thread.isHidden = false
|
||||
Index.updateHideLabel()
|
||||
$.rm thread.catalogView.nodes.root if thread.catalogView and Index.showHiddenThreads
|
||||
if thread.catalogView and Index.showHiddenThreads
|
||||
$.rm thread.catalogView.nodes.root
|
||||
$.event 'PostsRemoved', null, Index.root
|
||||
|
||||
@ -869,6 +869,8 @@ Index =
|
||||
delete Index.pageNum
|
||||
$.rmAll Index.root
|
||||
$.rmAll Header.hover
|
||||
if Index.loaded and Index.root.parentNode
|
||||
$.event 'PostsRemoved', null, Index.root
|
||||
if Conf['Index Mode'] is 'catalog'
|
||||
Index.buildCatalog threadIDs
|
||||
else
|
||||
|
||||
@ -84,6 +84,8 @@ ExpandThread =
|
||||
postsCount++
|
||||
filesCount++ if 'file' of Get.postFromRoot reply
|
||||
$.rm reply
|
||||
if Index.enabled # otherwise handled by Main.addPosts
|
||||
$.event 'PostsRemoved', null, a.parentNode
|
||||
a.textContent = Build.summaryText '+', postsCount, filesCount
|
||||
$.rm $('.summary-bottom', threadRoot)
|
||||
|
||||
|
||||
@ -87,7 +87,9 @@ QuoteInline =
|
||||
root = QuoteInline.findRoot quotelink, isBacklink
|
||||
root = $.x "following-sibling::div[@data-full-i-d='#{boardID}.#{postID}'][1]", root
|
||||
qroot = $.x 'ancestor::*[contains(@class,"postContainer")][1]', root
|
||||
{parentNode} = root
|
||||
$.rm root
|
||||
$.event 'PostsRemoved', null, parentNode
|
||||
|
||||
unless $ '.inline', qroot
|
||||
$.rmClass qroot, 'hasInline'
|
||||
|
||||
@ -52,6 +52,8 @@ QuotePreview =
|
||||
# Stop if it only contains text.
|
||||
return if not (root = @el.firstElementChild)
|
||||
|
||||
$.event 'PostsRemoved', null, Header.hover
|
||||
|
||||
clone = Get.postFromRoot root
|
||||
post = clone.origin
|
||||
post.rmClone root.dataset.clone
|
||||
|
||||
@ -370,19 +370,29 @@ Main =
|
||||
return
|
||||
|
||||
addPosts: (records) ->
|
||||
threads = []
|
||||
posts = []
|
||||
errors = []
|
||||
threads = []
|
||||
threadsRM = []
|
||||
posts = []
|
||||
errors = []
|
||||
for record in records
|
||||
thread = Get.threadFromRoot record.target
|
||||
n = posts.length
|
||||
Main.parsePosts record.addedNodes, thread, posts, errors
|
||||
if posts.length > n and thread not in threads
|
||||
threads.push thread
|
||||
anyRemoved = false
|
||||
for el in record.removedNodes
|
||||
if Get.postFromRoot(el)?.nodes.root is el and !doc.contains(el)
|
||||
anyRemoved = true
|
||||
break
|
||||
if anyRemoved and thread not in threadsRM
|
||||
threadsRM.push thread
|
||||
Main.handleErrors errors if errors.length
|
||||
Main.callbackNodesDB 'Post', posts, ->
|
||||
for thread in threads
|
||||
$.event 'PostsInserted', null, thread.nodes.root
|
||||
for thread in threadsRM
|
||||
$.event 'PostsRemoved', null, thread.nodes.root
|
||||
return
|
||||
|
||||
callbackNodes: (klass, nodes) ->
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user