From 498dfda2ef73a7d483f17d4340dcb9c4ffe5b7bc Mon Sep 17 00:00:00 2001 From: Mayhem Date: Wed, 19 Feb 2014 05:01:47 +0100 Subject: [PATCH] Update code related to hidden threads. --- src/General/Build.coffee | 6 ++---- src/General/Config.coffee | 2 +- src/General/Get.coffee | 2 +- src/Images/ImageExpand.coffee | 4 ++-- src/Miscellaneous/Nav.coffee | 2 -- 5 files changed, 6 insertions(+), 10 deletions(-) diff --git a/src/General/Build.coffee b/src/General/Build.coffee index f818f3ff1..12a5d38e8 100644 --- a/src/General/Build.coffee +++ b/src/General/Build.coffee @@ -243,10 +243,8 @@ Build = Build.spoilerRange[board] = data.custom_spoiler if (OP = board.posts[data.no]) and root = OP.nodes.root.parentNode - for node in $$ '.thread > :not(.stub):not(.opContainer)', root - $.rm node - if OP.thread.stub and stub = OP.thread.stub.firstElementChild.lastChild - stub.textContent = stub.textContent.replace /\d+ rep\w+/, "#{data.replies} repl#{if data.replies is 1 then 'y' else 'ies'}" + $.rmAll root + $.add root, OP.nodes.root else root = $.el 'div', className: 'thread' diff --git a/src/General/Config.coffee b/src/General/Config.coffee index 354fb7365..015c137be 100644 --- a/src/General/Config.coffee +++ b/src/General/Config.coffee @@ -18,7 +18,7 @@ Config = 'Anonymize': [false, 'Make everyone Anonymous.'] 'Filter': [true, 'Self-moderation placebo.'] 'Post Hiding': [true, 'Add buttons to hide threads and replies.'] - 'Stubs': [true, 'Show stubs of hidden threads and replies.'] + 'Stubs': [true, 'Show stubs of hidden posts.'] 'Recursive Hiding': [true, 'Hide replies of hidden posts, recursively.'] 'Images': 'Auto-GIF': [false, 'Animate GIF thumbnails (disabled on /gif/, /wsg/).'] diff --git a/src/General/Get.coffee b/src/General/Get.coffee index 6ba9afca1..e581bb504 100644 --- a/src/General/Get.coffee +++ b/src/General/Get.coffee @@ -232,6 +232,6 @@ Get = thread = g.threads["#{boardID}.#{threadID}"] or new Thread threadID, board post = new Post Build.post(o, true), thread, board, {isArchived: true} - $('.page-num', post.nodes.info).hidden = true unless post.isReply + $('.page-num', post.nodes.info)?.hidden = true Main.callbackNodes Post, [post] Get.insert post, root, context diff --git a/src/Images/ImageExpand.coffee b/src/Images/ImageExpand.coffee index 9d754da91..213543a0e 100644 --- a/src/Images/ImageExpand.coffee +++ b/src/Images/ImageExpand.coffee @@ -43,7 +43,7 @@ ImageExpand = for post in [post].concat post.clones {file} = post continue unless file and file.isImage and doc.contains post.nodes.root - if ImageExpand.on and + if ImageExpand.on and !post.isHidden and (!Conf['Expand spoilers'] and file.isSpoiler or Conf['Expand from here'] and Header.getTopOf(file.thumb) < 0) continue @@ -76,7 +76,7 @@ ImageExpand = expand: (post, src) -> # Do not expand images of hidden/filtered replies, or already expanded pictures. {thumb} = post.file - return if post.isHidden or post.file.isExpanded or $.hasClass thumb, 'expanding' + return if post.file.isExpanded or $.hasClass thumb, 'expanding' $.addClass thumb, 'expanding' if post.file.fullImage # Expand already-loaded/ing picture. diff --git a/src/Miscellaneous/Nav.coffee b/src/Miscellaneous/Nav.coffee index 0c93cc2d5..b6132e82a 100644 --- a/src/Miscellaneous/Nav.coffee +++ b/src/Miscellaneous/Nav.coffee @@ -38,8 +38,6 @@ Nav = getThread: -> for threadRoot in $$ '.thread' - thread = Get.threadFromRoot threadRoot - continue if thread.isHidden and !thread.stub if Header.getTopOf(threadRoot) >= -threadRoot.getBoundingClientRect().height # not scrolled past return threadRoot return $ '.board'