diff --git a/src/Filtering/ThreadHiding.coffee b/src/Filtering/ThreadHiding.coffee index d728504bd..11c5015b3 100644 --- a/src/Filtering/ThreadHiding.coffee +++ b/src/Filtering/ThreadHiding.coffee @@ -19,6 +19,7 @@ ThreadHiding = for threadID, thread of g.BOARD.threads when thread.isHidden root = thread.OP.nodes.root.parentNode if thread.stub + thread.stub = ThreadHiding.makeStub thread, root $.prepend root, thread.stub else root.nextElementSibling.hidden = true @@ -109,6 +110,23 @@ 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 + opInfo = if Conf['Anonymize'] + 'Anonymous' + else + $('.nameBlock', thread.OP.nodes.info).textContent + + a = ThreadHiding.makeButton thread, 'show' + $.add a, $.tn " #{opInfo} (#{if numReplies is 1 then '1 reply' else "#{numReplies} replies"})" + stub = $.el 'div', + className: 'stub' + if Conf['Menu'] + $.add stub, [a, $.tn(' '), Menu.makeButton()] + else + $.add stub, a + stub saveHiddenState: (thread, makeStub) -> hiddenThreadsOnCatalog = JSON.parse(localStorage.getItem "4chan-hide-t-#{g.BOARD}") or {} @@ -144,24 +162,7 @@ ThreadHiding = threadRoot.hidden = threadRoot.nextElementSibling.hidden = true #