Quote Backlinks fixes.

This commit is contained in:
Nicolas Stepien 2012-04-29 15:39:12 +02:00
parent 0313b094ce
commit 52687b5ea6
2 changed files with 11 additions and 17 deletions

View File

@ -3058,7 +3058,7 @@
return Main.callbacks.push(this.node); return Main.callbacks.push(this.node);
}, },
node: function(post) { node: function(post) {
var a, container, el, link, qid, quote, quotes, root, _i, _len, _ref; var a, container, el, link, qid, quote, quotes, _i, _len, _ref;
if (post.isInlined) { if (post.isInlined) {
return; return;
} }
@ -3066,17 +3066,17 @@
_ref = post.quotes; _ref = post.quotes;
for (_i = 0, _len = _ref.length; _i < _len; _i++) { for (_i = 0, _len = _ref.length; _i < _len; _i++) {
quote = _ref[_i]; quote = _ref[_i];
if (qid = quote.hash.slice(1)) { if (qid = quote.hash.slice(2)) {
quotes[qid] = true; quotes[qid] = true;
} }
} }
a = $.el('a', { a = $.el('a', {
href: "#" + post.id, href: "#p" + post.id,
className: post.root.hidden ? 'filtered backlink' : 'backlink', className: post.root.hidden ? 'filtered backlink' : 'backlink',
textContent: QuoteBacklink.funk(post.id) textContent: QuoteBacklink.funk(post.id)
}); });
for (qid in quotes) { for (qid in quotes) {
if (!(el = $.id(qid)) || el.className === 'op' && !Conf['OP Backlinks']) { if (!(el = $.id("pi" + qid)) || /\bop\b/.test(el.parentNode.className) && !Conf['OP Backlinks']) {
continue; continue;
} }
link = a.cloneNode(true); link = a.cloneNode(true);
@ -3092,12 +3092,9 @@
container = $.el('span', { container = $.el('span', {
className: 'container' className: 'container'
}); });
$.add(container, [$.tn(' '), link]); $.add(el, container);
root = $('.reportbutton', el) || $('span[id]', el);
$.after(root, container);
} else {
$.add(container, [$.tn(' '), link]);
} }
$.add(container, [$.tn(' '), link]);
} }
} }
}; };

View File

@ -2391,16 +2391,16 @@ QuoteBacklink =
quotes = {} quotes = {}
for quote in post.quotes for quote in post.quotes
# Don't process >>>/b/. # Don't process >>>/b/.
if qid = quote.hash[1..] if qid = quote.hash[2..]
# Duplicate quotes get overwritten. # Duplicate quotes get overwritten.
quotes[qid] = true quotes[qid] = true
a = $.el 'a', a = $.el 'a',
href: "##{post.id}" href: "#p#{post.id}"
className: if post.root.hidden then 'filtered backlink' else 'backlink' className: if post.root.hidden then 'filtered backlink' else 'backlink'
textContent: QuoteBacklink.funk post.id textContent: QuoteBacklink.funk post.id
for qid of quotes for qid of quotes
# Don't backlink the OP. # Don't backlink the OP.
continue if !(el = $.id qid) or el.className is 'op' and !Conf['OP Backlinks'] continue if !(el = $.id "pi#{qid}") or /\bop\b/.test(el.parentNode.className) and !Conf['OP Backlinks']
link = a.cloneNode true link = a.cloneNode true
if Conf['Quote Preview'] if Conf['Quote Preview']
$.on link, 'mouseover', QuotePreview.mouseover $.on link, 'mouseover', QuotePreview.mouseover
@ -2410,11 +2410,8 @@ QuoteBacklink =
link.setAttribute 'onclick', "replyhl('#{post.id}');" link.setAttribute 'onclick', "replyhl('#{post.id}');"
unless (container = $ '.container', el) and container.parentNode is el unless (container = $ '.container', el) and container.parentNode is el
container = $.el 'span', className: 'container' container = $.el 'span', className: 'container'
$.add container, [$.tn(' '), link] $.add el, container
root = $('.reportbutton', el) or $('span[id]', el) $.add container, [$.tn(' '), link]
$.after root, container
else
$.add container, [$.tn(' '), link]
return return
QuoteInline = QuoteInline =