Merge pull request #360 from MayhemYDG/master

Fix weird backlink bug
This commit is contained in:
James Campos 2011-10-31 09:16:37 -07:00
commit dfa4d17ba6
2 changed files with 15 additions and 13 deletions

View File

@ -2336,11 +2336,10 @@
format = conf['backlink'].replace(/%id/, "' + id + '");
quoteBacklink.funk = Function('id', "return'" + format + "'");
return g.callbacks.push(function(root) {
var container, el, id, link, qid, quote, quotes, _i, _len, _ref, _results;
var a, container, el, id, link, qid, quote, quotes, _i, _len, _ref, _results;
if (root.classList.contains('inline')) {
return;
}
id = $('input', root).name;
quotes = {};
_ref = $$('.quotelink', root);
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
@ -2350,6 +2349,12 @@
}
quotes[qid] = quote;
}
id = $('input', root).name;
a = $.el('a', {
href: "#" + id,
className: root.hidden ? 'filtered backlink' : 'backlink',
textContent: quoteBacklink.funk(id)
});
_results = [];
for (qid in quotes) {
if (!(el = $.id(qid))) {
@ -2358,11 +2363,7 @@
if (!conf['OP Backlinks'] && el.className === 'op') {
continue;
}
link = $.el('a', {
href: "#" + id,
className: root.hidden ? 'filtered backlink' : 'backlink',
textContent: quoteBacklink.funk(id)
});
link = a.cloneNode(true);
if (conf['Quote Preview']) {
$.bind(link, 'mouseover', quotePreview.mouseover);
$.bind(link, 'mousemove', ui.hover);

View File

@ -1765,22 +1765,23 @@ quoteBacklink =
quoteBacklink.funk = Function 'id', "return'#{format}'"
g.callbacks.push (root) ->
return if root.classList.contains 'inline'
# op or reply
id = $('input', root).name
quotes = {}
for quote in $$ '.quotelink', root
#don't process >>>/b/
continue unless qid = quote.hash[1..]
#duplicate quotes get overwritten
quotes[qid] = quote
# op or reply
id = $('input', root).name
a = $.el 'a',
href: "##{id}"
className: if root.hidden then 'filtered backlink' else 'backlink'
textContent: quoteBacklink.funk id
for qid of quotes
continue unless el = $.id qid
#don't backlink the op
continue if !conf['OP Backlinks'] and el.className is 'op'
link = $.el 'a',
href: "##{id}"
className: if root.hidden then 'filtered backlink' else 'backlink'
textContent: quoteBacklink.funk id
link = a.cloneNode true
if conf['Quote Preview']
$.bind link, 'mouseover', quotePreview.mouseover
$.bind link, 'mousemove', ui.hover