From b8b53efa4afca9727bde2b954012b443bc77c78e Mon Sep 17 00:00:00 2001 From: Nicolas Stepien Date: Mon, 20 Jun 2011 15:39:47 +0200 Subject: [PATCH] Don't backlink cross-thread OP quotes. --- 4chan_x.user.js | 9 ++++----- script.coffee | 5 ++--- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/4chan_x.user.js b/4chan_x.user.js index 18c997b6b..56dc868db 100644 --- a/4chan_x.user.js +++ b/4chan_x.user.js @@ -1823,7 +1823,7 @@ return g.callbacks.push(quoteBacklink.node); }, node: function(root) { - var container, el, id, link, opbl, qid, quote, quotes, tid, _i, _len, _ref, _results; + var container, el, id, link, opbl, qid, quote, quotes, _i, _len, _ref, _results; if (/inline/.test(root.className)) { return; } @@ -1833,7 +1833,6 @@ $.after($('span[id^=no]', root), container); id = root.id || $('td[id]', root).id; quotes = {}; - tid = g.THREAD_ID || root.parentNode.firstChild.id; opbl = $.config('OP Backlinks'); _ref = $$('a.quotelink', root); for (_i = 0, _len = _ref.length; _i < _len; _i++) { @@ -1841,9 +1840,6 @@ if (!(qid = quote.hash.slice(1))) { continue; } - if (!opbl && qid === tid) { - continue; - } quotes[qid] = quote; } _results = []; @@ -1852,6 +1848,9 @@ if (!(el = d.getElementById(qid))) { continue; } + if (!opbl && el.className === 'op') { + continue; + } link = $.el('a', { href: '#' + id, className: 'backlink', diff --git a/script.coffee b/script.coffee index 3985dc00d..51f19e994 100644 --- a/script.coffee +++ b/script.coffee @@ -1445,16 +1445,15 @@ quoteBacklink = $.after $('span[id^=no]', root), container id = root.id or $('td[id]', root).id quotes = {} - tid = g.THREAD_ID or root.parentNode.firstChild.id opbl = $.config 'OP Backlinks' for quote in $$ 'a.quotelink', root continue unless qid = quote.hash[1..] - #don't backlink the op - continue if !opbl and qid is tid #duplicate quotes get overwritten quotes[qid] = quote for qid, quote of quotes continue unless el = d.getElementById qid + #don't backlink the op + continue if !opbl and el.className is 'op' link = $.el 'a', href: '#'+id className: 'backlink'