From 363753fc198b9fba8f4048b46da413c15cc67ea0 Mon Sep 17 00:00:00 2001 From: Mayhem Date: Tue, 30 Apr 2013 19:32:12 +0200 Subject: [PATCH] Navigate to stubbed threads. #1074 --- css/style.css | 4 +--- src/Filtering/ThreadHiding.coffee | 6 +++--- src/General/Get.coffee | 2 ++ src/Miscellaneous/Nav.coffee | 4 +++- 4 files changed, 9 insertions(+), 7 deletions(-) diff --git a/css/style.css b/css/style.css index 7124d891b..8511a659c 100644 --- a/css/style.css +++ b/css/style.css @@ -551,9 +551,7 @@ a.hide-announcement { float: left; margin-right: 2px; } -.stub ~ .sideArrows, -.stub ~ .hide-reply-button, -.stub ~ .post { +.stub ~ * { display: none !important; } .stub input { diff --git a/src/Filtering/ThreadHiding.coffee b/src/Filtering/ThreadHiding.coffee index 223263550..cd2ea2960 100644 --- a/src/Filtering/ThreadHiding.coffee +++ b/src/Filtering/ThreadHiding.coffee @@ -128,10 +128,10 @@ ThreadHiding = return if thread.isHidden {OP} = thread threadRoot = OP.nodes.root.parentNode - threadRoot.hidden = thread.isHidden = true + thread.isHidden = true unless makeStub - threadRoot.nextElementSibling.hidden = true #
+ threadRoot.hidden = threadRoot.nextElementSibling.hidden = true #
return numReplies = 0 @@ -152,7 +152,7 @@ ThreadHiding = $.add thread.stub, a if Conf['Menu'] $.add thread.stub, [$.tn(' '), Menu.makeButton OP] - $.before threadRoot, thread.stub + $.prepend threadRoot, thread.stub show: (thread) -> if thread.stub diff --git a/src/General/Get.coffee b/src/General/Get.coffee index b9ec77558..adcc770ce 100644 --- a/src/General/Get.coffee +++ b/src/General/Get.coffee @@ -8,6 +8,8 @@ Get = if excerpt.length > 70 excerpt = "#{excerpt[...67]}..." "/#{thread.board}/ - #{excerpt}" + threadFromRoot: (root) -> + g.threads["#{g.BOARD}.#{root.id[1..]}"] postFromRoot: (root) -> link = $ 'a[title="Highlight this post"]', root boardID = link.pathname.split('/')[1] diff --git a/src/Miscellaneous/Nav.coffee b/src/Miscellaneous/Nav.coffee index 8f31c7865..972f66b3c 100644 --- a/src/Miscellaneous/Nav.coffee +++ b/src/Miscellaneous/Nav.coffee @@ -44,7 +44,9 @@ Nav = else headRect = Header.toggle.getBoundingClientRect() topMargin = headRect.top + headRect.height - threads = $$ '.thread:not([hidden])' + threads = $$('.thread').filter (thread) -> + thread = Get.threadFromRoot thread + !(thread.isHidden and !thread.stub) for thread, i in threads rect = thread.getBoundingClientRect() if rect.bottom > topMargin # not scrolled past