Bring back IndexBuild event.

This commit is contained in:
ccd0 2016-09-17 02:26:01 -07:00
parent 696d3c37c3
commit 4db8b753a6
2 changed files with 11 additions and 5 deletions

View File

@ -4,6 +4,7 @@ ThreadHiding =
@db = new DataBoard 'hiddenThreads'
return @catalogWatch() if g.VIEW is 'catalog'
@catalogSet g.BOARD
$.on d, 'IndexBuild', @onIndexBuild
Callbacks.Post.push
name: 'Thread Hiding'
cb: @node
@ -48,8 +49,8 @@ ThreadHiding =
return unless Conf['Thread Hiding Buttons']
$.prepend @nodes.root, ThreadHiding.makeButton(@thread, 'hide')
onIndexBuild: (nodes) ->
for root in nodes
onIndexBuild: ->
for root in $$ '.board > .thread'
thread = Get.threadFromRoot root
if thread.isHidden and thread.stub and !root.contains thread.stub
ThreadHiding.makeStub thread, root

View File

@ -116,7 +116,9 @@ Index =
board = $ '.board'
$.replace board, Index.root
$.event 'PostsInserted'
if Index.nodes
$.event 'PostsInserted'
$.event 'IndexBuild'
# Hacks:
# - When removing an element from the document during page load,
# its ancestors will still be correctly created inside of it.
@ -707,6 +709,8 @@ Index =
nodes = Index.buildCatalogViews()
Index.sizeCatalogViews nodes
$.add Index.root, nodes
if doc.contains Index.root
$.event 'IndexBuild'
else
Index.buildReplies threads if Conf['Show Replies']
Index.buildStructure threads
@ -726,8 +730,9 @@ Index =
# XXX https://bugzilla.mozilla.org/show_bug.cgi?id=1021289
thumb.removeAttribute 'data-src'
$.add Index.root, [node, $.el 'hr']
$.event 'PostsInserted' if doc.contains Index.root
ThreadHiding.onIndexBuild nodes
if doc.contains Index.root
$.event 'PostsInserted'
$.event 'IndexBuild'
clearSearch: ->
Index.searchInput.value = ''