diff --git a/src/Filtering/ThreadHiding.coffee b/src/Filtering/ThreadHiding.coffee index b5352fc80..9e6154e5a 100644 --- a/src/Filtering/ThreadHiding.coffee +++ b/src/Filtering/ThreadHiding.coffee @@ -49,12 +49,12 @@ ThreadHiding = node: -> return if @isReply or @isClone or @isFetchedQuote + if Conf['Thread Hiding Buttons'] + $.prepend @nodes.root, ThreadHiding.makeButton(@thread, 'hide') + if data = ThreadHiding.db.get {boardID: @board.ID, threadID: @ID} ThreadHiding.hide @thread, data.makeStub - return unless Conf['Thread Hiding Buttons'] - $.prepend @nodes.root, ThreadHiding.makeButton(@thread, 'hide') - onIndexRefresh: -> g.BOARD.threads.forEach (thread) -> {root} = thread.nodes @@ -143,9 +143,10 @@ ThreadHiding = a.dataset.fullID = thread.fullID $.on a, 'click', ThreadHiding.toggle a + makeStub: (thread, root) -> - numReplies = $$('.thread > .replyContainer', root).length - numReplies += +summary.textContent.match /\d+/ if summary = $ '.summary', root + numReplies = $$(Site.selectors.postContainer + Site.selectors.relative.replyPost, root).length + numReplies += +summary.textContent.match /\d+/ if summary = $ Site.selectors.summary, root a = ThreadHiding.makeButton thread, 'show' $.add a, $.tn " #{thread.OP.info.nameBlock} (#{if numReplies is 1 then '1 reply' else "#{numReplies} replies"})" @@ -157,6 +158,10 @@ ThreadHiding = $.add thread.stub, a $.prepend root, thread.stub + # Prevent hiding of thread divider on sites that put it inside the thread + if (threadDivider = $ Site.selectors.threadDivider, root) + $.addClass threadDivider, 'threadDivider' + saveHiddenState: (thread, makeStub) -> if thread.isHidden ThreadHiding.db.set diff --git a/src/css/style.css b/src/css/style.css index eaf39e64e..cf33795ea 100644 --- a/src/css/style.css +++ b/src/css/style.css @@ -1517,7 +1517,7 @@ input[name="Default Volume"] { margin-top: -1px; width: 11px; } -.stub ~ * { +.stub ~ :not(.threadDivider) { display: none !important; } .stub input {