From 4db8b753a61500dbe64829c03aabb68cc4659f10 Mon Sep 17 00:00:00 2001 From: ccd0 Date: Sat, 17 Sep 2016 02:26:01 -0700 Subject: [PATCH] Bring back IndexBuild event. --- src/Filtering/ThreadHiding.coffee | 5 +++-- src/General/Index.coffee | 11 ++++++++--- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/src/Filtering/ThreadHiding.coffee b/src/Filtering/ThreadHiding.coffee index 7087deb12..395968c2a 100644 --- a/src/Filtering/ThreadHiding.coffee +++ b/src/Filtering/ThreadHiding.coffee @@ -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 diff --git a/src/General/Index.coffee b/src/General/Index.coffee index 8f1c69f10..8c6512890 100644 --- a/src/General/Index.coffee +++ b/src/General/Index.coffee @@ -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 = ''