From c3995a173bd5076b7138f2017e25f72efdb00151 Mon Sep 17 00:00:00 2001 From: Nicolas Stepien Date: Thu, 14 Jun 2012 19:03:37 +0200 Subject: [PATCH] Add isArchived to preParsing. Disable Reveal Spoilers on archived posts. --- 4chan_x.user.js | 3 ++- script.coffee | 7 ++++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/4chan_x.user.js b/4chan_x.user.js index 7d8dbaa3b..5d86e4cda 100644 --- a/4chan_x.user.js +++ b/4chan_x.user.js @@ -2840,7 +2840,7 @@ node: function(post) { var img; img = post.img; - if (!(img && /^Spoiler/.test(img.alt)) || post.isInlined && !post.isCrosspost) { + if (!(img && /^Spoiler/.test(img.alt)) || post.isInlined && !post.isCrosspost || post.isArchived) { return; } img.removeAttribute('style'); @@ -4509,6 +4509,7 @@ "class": el.className, id: el.id.match(/\d+$/)[0], threadId: g.THREAD_ID || $.x('ancestor::div[parent::div[@class="board"]]', node).id.match(/\d+$/)[0], + isArchived: /\barchivedPost\b/.test(parentClass), isInlined: /\binline\b/.test(parentClass), isCrosspost: /\bcrosspost\b/.test(parentClass), blockquote: el.lastElementChild, diff --git a/script.coffee b/script.coffee index cedfbe3b3..fe10a76fd 100644 --- a/script.coffee +++ b/script.coffee @@ -2243,7 +2243,7 @@ RevealSpoilers = Main.callbacks.push @node node: (post) -> {img} = post - if not (img and /^Spoiler/.test img.alt) or post.isInlined and not post.isCrosspost + if not (img and /^Spoiler/.test img.alt) or post.isInlined and not post.isCrosspost or post.isArchived return img.removeAttribute 'style' img.src = "//thumbs.4chan.org#{img.parentNode.pathname.replace /src(\/\d+).+$/, 'thumb$1s.jpg'}" @@ -3520,8 +3520,9 @@ Main = class: el.className id: el.id.match(/\d+$/)[0] threadId: g.THREAD_ID or $.x('ancestor::div[parent::div[@class="board"]]', node).id.match(/\d+$/)[0] - isInlined: /\binline\b/.test parentClass - isCrosspost: /\bcrosspost\b/.test parentClass + isArchived: /\barchivedPost\b/.test parentClass + isInlined: /\binline\b/.test parentClass + isCrosspost: /\bcrosspost\b/.test parentClass blockquote: el.lastElementChild quotes: el.getElementsByClassName 'quotelink' backlinks: el.getElementsByClassName 'backlink'