inline node funk

This commit is contained in:
James Campos 2011-06-20 12:32:09 -07:00
parent 9aef4c09ef
commit 2e98085f18
2 changed files with 71 additions and 74 deletions

View File

@ -1829,53 +1829,52 @@
}; };
quoteBacklink = { quoteBacklink = {
init: function() { init: function() {
return g.callbacks.push(quoteBacklink.node); return g.callbacks.push(function(root) {
}, var el, id, link, opbl, qid, quote, quotes, _i, _len, _ref, _results;
node: function(root) { if (/inline/.test(root.className)) {
var el, id, link, opbl, qid, quote, quotes, _i, _len, _ref, _results; return;
if (/inline/.test(root.className)) {
return;
}
$.after($('span[id^=no]', root), $.el('span', {
className: 'container'
}));
id = root.id || $('td[id]', root).id;
quotes = {};
opbl = $.config('OP Backlinks');
_ref = $$('a.quotelink', root);
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
quote = _ref[_i];
if (!(qid = quote.hash.slice(1))) {
continue;
} }
quotes[qid] = quote; $.after($('span[id^=no]', root), $.el('span', {
} className: 'container'
_results = []; }));
for (qid in quotes) { id = root.id || $('td[id]', root).id;
quote = quotes[qid]; quotes = {};
if (!(el = d.getElementById(qid))) { opbl = $.config('OP Backlinks');
continue; _ref = $$('a.quotelink', root);
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
quote = _ref[_i];
if (!(qid = quote.hash.slice(1))) {
continue;
}
quotes[qid] = quote;
} }
if (!opbl && el.className === 'op') { _results = [];
continue; for (qid in quotes) {
quote = quotes[qid];
if (!(el = d.getElementById(qid))) {
continue;
}
if (!opbl && el.className === 'op') {
continue;
}
link = $.el('a', {
href: '#' + id,
className: 'backlink',
textContent: '>>' + id
});
if ($.config('Quote Preview')) {
$.bind(link, 'mouseover', quotePreview.mouseover);
$.bind(link, 'mousemove', ui.hover);
$.bind(link, 'mouseout', ui.hoverend);
$.bind(link, 'mouseout', quotePreview.mouseout);
}
if ($.config('Quote Inline')) {
$.bind(link, 'click', quoteInline.toggle);
}
_results.push($.append($('.container', el), $.tn(' '), link));
} }
link = $.el('a', { return _results;
href: '#' + id, });
className: 'backlink',
textContent: '>>' + id
});
if ($.config('Quote Preview')) {
$.bind(link, 'mouseover', quotePreview.mouseover);
$.bind(link, 'mousemove', ui.hover);
$.bind(link, 'mouseout', ui.hoverend);
$.bind(link, 'mouseout', quotePreview.mouseout);
}
if ($.config('Quote Inline')) {
$.bind(link, 'click', quoteInline.toggle);
}
_results.push($.append($('.container', el), $.tn(' '), link));
}
return _results;
} }
}; };
quoteInline = { quoteInline = {

View File

@ -1440,36 +1440,34 @@ titlePost =
quoteBacklink = quoteBacklink =
init: -> init: ->
g.callbacks.push quoteBacklink.node g.callbacks.push (root) ->
return if /inline/.test root.className
node: (root) -> $.after $('span[id^=no]', root), $.el 'span', className: 'container'
return if /inline/.test root.className # op or reply
$.after $('span[id^=no]', root), $.el 'span', className: 'container' id = root.id or $('td[id]', root).id
# op or reply quotes = {}
id = root.id or $('td[id]', root).id opbl = $.config 'OP Backlinks'
quotes = {} for quote in $$ 'a.quotelink', root
opbl = $.config 'OP Backlinks' #don't process >>>/b/
for quote in $$ 'a.quotelink', root continue unless qid = quote.hash[1..]
#don't process >>>/b/ #duplicate quotes get overwritten
continue unless qid = quote.hash[1..] quotes[qid] = quote
#duplicate quotes get overwritten for qid, quote of quotes
quotes[qid] = quote continue unless el = d.getElementById qid
for qid, quote of quotes #don't backlink the op
continue unless el = d.getElementById qid continue if !opbl and el.className is 'op'
#don't backlink the op link = $.el 'a',
continue if !opbl and el.className is 'op' href: '#'+id
link = $.el 'a', className: 'backlink'
href: '#'+id textContent: '>>'+id
className: 'backlink' if $.config 'Quote Preview'
textContent: '>>'+id $.bind link, 'mouseover', quotePreview.mouseover
if $.config 'Quote Preview' $.bind link, 'mousemove', ui.hover
$.bind link, 'mouseover', quotePreview.mouseover $.bind link, 'mouseout', ui.hoverend
$.bind link, 'mousemove', ui.hover $.bind link, 'mouseout', quotePreview.mouseout
$.bind link, 'mouseout', ui.hoverend if $.config 'Quote Inline'
$.bind link, 'mouseout', quotePreview.mouseout $.bind link, 'click', quoteInline.toggle
if $.config 'Quote Inline' $.append $('.container', el), $.tn(' '), link
$.bind link, 'click', quoteInline.toggle
$.append $('.container', el), $.tn(' '), link
quoteInline = quoteInline =
init: -> init: ->