From cd8326a9c56b10eb587160e429bce5978425278f Mon Sep 17 00:00:00 2001 From: Nicolas Stepien Date: Mon, 26 Mar 2012 04:37:05 +0200 Subject: [PATCH] Add the forwardlink class to backlinks too. --- 4chan_x.user.js | 20 ++++++++++---------- script.coffee | 19 ++++++++++++------- 2 files changed, 22 insertions(+), 17 deletions(-) diff --git a/4chan_x.user.js b/4chan_x.user.js index 6f0755e4c..70fd78b6b 100644 --- a/4chan_x.user.js +++ b/4chan_x.user.js @@ -3231,7 +3231,7 @@ } }, mouseover: function(e) { - var el, id, qp, quote, replyID, threadID, _i, _len, _ref; + var el, id, node, qp, quote, replyID, threadID, _i, _len, _ref; if (/\binlined\b/.test(this.className)) return; qp = UI.el = $.el('div', { id: 'qp', @@ -3242,13 +3242,12 @@ if (el = $.id(id)) { qp.innerHTML = el.innerHTML; if (Conf['Quote Highlighting']) $.addClass(el, 'qphl'); - if (/\bbacklink\b/.test(this.className)) { - replyID = $.x('preceding-sibling::input', this.parentNode).name; - _ref = $$('.quotelink', qp); - for (_i = 0, _len = _ref.length; _i < _len; _i++) { - quote = _ref[_i]; - if (quote.hash.slice(1) === replyID) $.addClass(quote, 'forwardlink'); - } + node = /\bbacklink\b/.test(this.className) ? this.parentNode : $.x('ancestor::blockquote', this); + replyID = $.x('preceding-sibling::input', node).name; + _ref = $$('.quotelink, .backlink', qp); + for (_i = 0, _len = _ref.length; _i < _len; _i++) { + quote = _ref[_i]; + if (quote.hash.slice(1) === replyID) $.addClass(quote, 'forwardlink'); } } else { qp.textContent = "Loading " + id + "..."; @@ -4427,8 +4426,9 @@ input ~ a > img[md5] {\ .filtered {\ text-decoration: line-through;\ }\ -.quotelink.forwardlink {\ - color: #2C2C63;\ +.quotelink.forwardlink,\ +.backlink.forwardlink {\ + color: #4C4CA9;\ }\ ' }; diff --git a/script.coffee b/script.coffee index 6465891f6..7948976ed 100644 --- a/script.coffee +++ b/script.coffee @@ -2690,11 +2690,15 @@ QuotePreview = if el = $.id id qp.innerHTML = el.innerHTML $.addClass el, 'qphl' if Conf['Quote Highlighting'] - if /\bbacklink\b/.test @className - replyID = $.x('preceding-sibling::input', @parentNode).name - for quote in $$ '.quotelink', qp - if quote.hash[1..] is replyID - $.addClass quote, 'forwardlink' + node = + if /\bbacklink\b/.test @className + @parentNode + else + $.x 'ancestor::blockquote', @ + replyID = $.x('preceding-sibling::input', node).name + for quote in $$ '.quotelink, .backlink', qp + if quote.hash[1..] is replyID + $.addClass quote, 'forwardlink' else qp.textContent = "Loading #{id}..." threadID = @pathname.split('/').pop() or $.x('ancestor::div[@class="thread"]', @).firstChild.id @@ -3767,8 +3771,9 @@ input ~ a > img[md5] { .filtered { text-decoration: line-through; } -.quotelink.forwardlink { - color: #2C2C63; +.quotelink.forwardlink, +.backlink.forwardlink { + color: #4C4CA9; } '