From df64f4628dab2932d1e6f6ace6881ece933055a7 Mon Sep 17 00:00:00 2001 From: Nicolas Stepien Date: Mon, 6 Feb 2012 16:07:56 +0100 Subject: [PATCH] Add recursive filtering option. Close #128 --- 4chan_x.user.js | 8 +++++--- changelog | 1 + script.coffee | 7 ++++--- 3 files changed, 10 insertions(+), 6 deletions(-) diff --git a/4chan_x.user.js b/4chan_x.user.js index 60379c816..88c6e345e 100644 --- a/4chan_x.user.js +++ b/4chan_x.user.js @@ -91,6 +91,7 @@ 'Anonymize': [false, 'Make everybody anonymous'], 'Filter': [false, 'Self-moderation placebo'], 'Filter OPs': [false, 'Filter OPs along with their threads'], + 'Recursive Filtering': [false, 'Filter replies of filtered posts, recursively'], 'Reply Hiding': [true, 'Hide single replies'], 'Thread Hiding': [true, 'Hide entire threads'], 'Show Stubs': [true, 'Of hidden threads / replies'] @@ -617,9 +618,10 @@ _results = []; for (_i = 0, _len = _ref.length; _i < _len; _i++) { quote = _ref[_i]; - if (el = $.id(quote.hash.slice(1))) { - if (el.parentNode.parentNode.parentNode.hidden) { - _results.push($.addClass(quote, 'filtered')); + if ((el = $.id(quote.hash.slice(1))) && el.parentNode.parentNode.parentNode.hidden) { + $.addClass(quote, 'filtered'); + if (conf['Recursive Filtering']) { + _results.push(root.hidden = true); } else { _results.push(void 0); } diff --git a/changelog b/changelog index 4cff966b8..8e5766236 100644 --- a/changelog +++ b/changelog @@ -4,6 +4,7 @@ master - Mayhem Increase Sauce linking possibilites: Thumbnails, full images, MD5 hashes. + New option: Recursive Filtering: Filter replies of filtered posts. Unread Favicon is now optional, independent of Unread Count. Fix some compatibility issues with file drag and drop, notably with QuickDrag extension. diff --git a/script.coffee b/script.coffee index c2cdf082d..4cf0d2113 100644 --- a/script.coffee +++ b/script.coffee @@ -14,6 +14,7 @@ config = 'Anonymize': [false, 'Make everybody anonymous'] 'Filter': [false, 'Self-moderation placebo'] 'Filter OPs': [false, 'Filter OPs along with their threads'] + 'Recursive Filtering': [false, 'Filter replies of filtered posts, recursively'] 'Reply Hiding': [true, 'Hide single replies'] 'Thread Hiding': [true, 'Hide entire threads'] 'Show Stubs': [true, 'Of hidden threads / replies'] @@ -456,9 +457,9 @@ strikethroughQuotes = g.callbacks.push (root) -> return if root.className is 'inline' for quote in $$ '.quotelink', root - if el = $.id quote.hash[1..] - if el.parentNode.parentNode.parentNode.hidden - $.addClass quote, 'filtered' + if (el = $.id quote.hash[1..]) and el.parentNode.parentNode.parentNode.hidden + $.addClass quote, 'filtered' + root.hidden = true if conf['Recursive Filtering'] expandComment = init: ->