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 = { quoteBacklink = {
init: function() { 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); return g.callbacks.push(quoteBacklink.node);
}, },
node: function(root) { 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)) { if (/inline/.test(root.className)) {
return; return;
} }
if (!$('.container', root)) { $.after($('span[id^=no]', root), $.el('span', {
container = $.el('span', { className: 'container'
className: 'container' }));
});
$.after($('span[id^=no]', root), container);
}
id = root.id || $('td[id]', root).id; id = root.id || $('td[id]', root).id;
quotes = {}; quotes = {};
opbl = $.config('OP Backlinks'); opbl = $.config('OP Backlinks');

View File

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