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);
},
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) {
return;
}
@ -3066,17 +3066,17 @@
_ref = post.quotes;
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
quote = _ref[_i];
if (qid = quote.hash.slice(1)) {
if (qid = quote.hash.slice(2)) {
quotes[qid] = true;
}
}
a = $.el('a', {
href: "#" + post.id,
href: "#p" + post.id,
className: post.root.hidden ? 'filtered backlink' : 'backlink',
textContent: QuoteBacklink.funk(post.id)
});
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;
}
link = a.cloneNode(true);
@ -3092,12 +3092,9 @@
container = $.el('span', {
className: 'container'
});
$.add(container, [$.tn(' '), link]);
root = $('.reportbutton', el) || $('span[id]', el);
$.after(root, container);
} else {
$.add(container, [$.tn(' '), link]);
$.add(el, container);
}
$.add(container, [$.tn(' '), link]);
}
}
};

View File

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