From 16b4fd5424fa11c0e1da2687dc4ce26ae32ccdcc Mon Sep 17 00:00:00 2001 From: Nicolas Stepien Date: Mon, 14 May 2012 19:18:49 +0200 Subject: [PATCH] Fix #471 --- 4chan_x.user.js | 12 +++++++----- script.coffee | 11 ++++++----- 2 files changed, 13 insertions(+), 10 deletions(-) diff --git a/4chan_x.user.js b/4chan_x.user.js index 3f41e1430..91b777fe4 100644 --- a/4chan_x.user.js +++ b/4chan_x.user.js @@ -3119,10 +3119,12 @@ return this.classList.toggle('inlined'); }, add: function(q, id) { - var clonePost, el, i, inline, pathname, root; - root = q; - while (root.parentNode.nodeName !== 'BLOCKQUOTE') { - root = root.parentNode; + var clonePost, el, i, inline, isBacklink, pathname, root; + if (!(isBacklink = /\bbacklink\b/.test(q.className))) { + root = q; + while (root.parentNode.nodeName !== 'BLOCKQUOTE') { + root = root.parentNode; + } } if (el = $.id("p" + id)) { if (/\bop\b/.test(el.className)) { @@ -3131,7 +3133,7 @@ $.removeClass(el, 'qphl'); } clonePost = QuoteInline.clone(id, el); - if (/\bbacklink\b/.test(q.className)) { + if (isBacklink) { $.after(q.parentNode, clonePost); if (Conf['Forward Hiding']) { $.addClass(el.parentNode, 'forwarded'); diff --git a/script.coffee b/script.coffee index 503525f56..67bcdedef 100644 --- a/script.coffee +++ b/script.coffee @@ -2404,16 +2404,17 @@ QuoteInline = add: (q, id) -> # Can't use this because Firefox a shit: # root = $.x 'ancestor::*[parent::blockquote]', q - root = q - while root.parentNode.nodeName isnt 'BLOCKQUOTE' - root = root.parentNode - if el = $.id "p#{id}" + unless isBacklink = /\bbacklink\b/.test q.className + root = q + while root.parentNode.nodeName isnt 'BLOCKQUOTE' + root = root.parentNode + if el = $.id "p#{id}" if /\bop\b/.test el.className $.removeClass el.parentNode, 'qphl' else $.removeClass el, 'qphl' clonePost = QuoteInline.clone id, el - if /\bbacklink\b/.test q.className + if isBacklink $.after q.parentNode, clonePost if Conf['Forward Hiding'] $.addClass el.parentNode, 'forwarded'