slight refactor for quoteBacklink

This commit is contained in:
James Campos 2011-06-20 12:31:14 -07:00
parent 0b3fee0822
commit 9aef4c09ef
2 changed files with 8 additions and 21 deletions

View File

@ -1829,27 +1829,16 @@
};
quoteBacklink = {
init: function() {
var span, _i, _len, _ref;
_ref = $$('span[id^=no]');
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
span = _ref[_i];
$.after(span, $.el('span', {
className: 'container'
}));
}
return g.callbacks.push(quoteBacklink.node);
},
node: function(root) {
var container, el, id, link, opbl, qid, quote, quotes, _i, _len, _ref, _results;
var el, id, link, opbl, qid, quote, quotes, _i, _len, _ref, _results;
if (/inline/.test(root.className)) {
return;
}
if (!$('.container', root)) {
container = $.el('span', {
className: 'container'
});
$.after($('span[id^=no]', root), container);
}
$.after($('span[id^=no]', root), $.el('span', {
className: 'container'
}));
id = root.id || $('td[id]', root).id;
quotes = {};
opbl = $.config('OP Backlinks');

View File

@ -1440,19 +1440,17 @@ titlePost =
quoteBacklink =
init: ->
for span in $$('span[id^=no]')
$.after span, $.el 'span', className: 'container'
g.callbacks.push quoteBacklink.node
node: (root) ->
return if /inline/.test root.className
unless $ '.container', root
container = $.el 'span',
className: 'container'
$.after $('span[id^=no]', root), container
$.after $('span[id^=no]', root), $.el 'span', className: 'container'
# op or reply
id = root.id or $('td[id]', root).id
quotes = {}
opbl = $.config 'OP Backlinks'
for quote in $$ 'a.quotelink', root
#don't process >>>/b/
continue unless qid = quote.hash[1..]
#duplicate quotes get overwritten
quotes[qid] = quote