Don't backlink cross-thread OP quotes.

This commit is contained in:
Nicolas Stepien 2011-06-20 15:39:47 +02:00
parent e3aff3ab6e
commit b8b53efa4a
2 changed files with 6 additions and 8 deletions

View File

@ -1823,7 +1823,7 @@
return g.callbacks.push(quoteBacklink.node); return g.callbacks.push(quoteBacklink.node);
}, },
node: function(root) { 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)) { if (/inline/.test(root.className)) {
return; return;
} }
@ -1833,7 +1833,6 @@
$.after($('span[id^=no]', root), container); $.after($('span[id^=no]', root), container);
id = root.id || $('td[id]', root).id; id = root.id || $('td[id]', root).id;
quotes = {}; quotes = {};
tid = g.THREAD_ID || root.parentNode.firstChild.id;
opbl = $.config('OP Backlinks'); opbl = $.config('OP Backlinks');
_ref = $$('a.quotelink', root); _ref = $$('a.quotelink', root);
for (_i = 0, _len = _ref.length; _i < _len; _i++) { for (_i = 0, _len = _ref.length; _i < _len; _i++) {
@ -1841,9 +1840,6 @@
if (!(qid = quote.hash.slice(1))) { if (!(qid = quote.hash.slice(1))) {
continue; continue;
} }
if (!opbl && qid === tid) {
continue;
}
quotes[qid] = quote; quotes[qid] = quote;
} }
_results = []; _results = [];
@ -1852,6 +1848,9 @@
if (!(el = d.getElementById(qid))) { if (!(el = d.getElementById(qid))) {
continue; continue;
} }
if (!opbl && el.className === 'op') {
continue;
}
link = $.el('a', { link = $.el('a', {
href: '#' + id, href: '#' + id,
className: 'backlink', className: 'backlink',

View File

@ -1445,16 +1445,15 @@ quoteBacklink =
$.after $('span[id^=no]', root), container $.after $('span[id^=no]', root), container
id = root.id or $('td[id]', root).id id = root.id or $('td[id]', root).id
quotes = {} quotes = {}
tid = g.THREAD_ID or root.parentNode.firstChild.id
opbl = $.config 'OP Backlinks' opbl = $.config 'OP Backlinks'
for quote in $$ 'a.quotelink', root for quote in $$ 'a.quotelink', root
continue unless qid = quote.hash[1..] continue unless qid = quote.hash[1..]
#don't backlink the op
continue if !opbl and qid is tid
#duplicate quotes get overwritten #duplicate quotes get overwritten
quotes[qid] = quote quotes[qid] = quote
for qid, quote of quotes for qid, quote of quotes
continue unless el = d.getElementById qid continue unless el = d.getElementById qid
#don't backlink the op
continue if !opbl and el.className is 'op'
link = $.el 'a', link = $.el 'a',
href: '#'+id href: '#'+id
className: 'backlink' className: 'backlink'