Use IDs for backlink containers.

This commit is contained in:
Nicolas Stepien 2012-05-07 10:03:22 +02:00
parent f6bb81cfcd
commit a5912734f3
2 changed files with 9 additions and 6 deletions

View File

@ -3058,7 +3058,7 @@
textContent: QuoteBacklink.funk(post.id) textContent: QuoteBacklink.funk(post.id)
}); });
for (qid in quotes) { for (qid in quotes) {
if (!(el = $.id("pi" + qid)) || /\bop\b/.test(el.parentNode.className) && !Conf['OP Backlinks']) { if (!(el = $.id("pi" + qid)) || !Conf['OP Backlinks'] && /\bop\b/.test(el.parentNode.className)) {
continue; continue;
} }
link = a.cloneNode(true); link = a.cloneNode(true);
@ -3070,9 +3070,10 @@
} else { } else {
link.setAttribute('onclick', "replyhl('" + post.id + "');"); link.setAttribute('onclick', "replyhl('" + post.id + "');");
} }
if (!((container = $('.container', el)) && container.parentNode === el)) { if (!(container = $.id("blc" + qid))) {
container = $.el('span', { container = $.el('span', {
className: 'container' className: 'container',
id: "blc" + qid
}); });
$.add(el, container); $.add(el, container);
} }

View File

@ -2370,7 +2370,7 @@ QuoteBacklink =
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 "pi#{qid}") or /\bop\b/.test(el.parentNode.className) and !Conf['OP Backlinks'] continue if !(el = $.id "pi#{qid}") or !Conf['OP Backlinks'] and /\bop\b/.test el.parentNode.className
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
@ -2378,8 +2378,10 @@ QuoteBacklink =
$.on link, 'click', QuoteInline.toggle $.on link, 'click', QuoteInline.toggle
else else
link.setAttribute 'onclick', "replyhl('#{post.id}');" link.setAttribute 'onclick', "replyhl('#{post.id}');"
unless (container = $ '.container', el) and container.parentNode is el unless container = $.id "blc#{qid}"
container = $.el 'span', className: 'container' container = $.el 'span',
className: 'container'
id: "blc#{qid}"
$.add el, container $.add el, container
$.add container, [$.tn(' '), link] $.add container, [$.tn(' '), link]
return return