Go deeper

This commit is contained in:
Nicolas Stepien 2011-05-09 18:46:47 +02:00
parent 19bfaa923d
commit 9927dc85f8
2 changed files with 39 additions and 40 deletions

View File

@ -1681,26 +1681,26 @@
return g.callbacks.push(quoteBacklink.node); return g.callbacks.push(quoteBacklink.node);
}, },
node: function(root) { node: function(root) {
var backlink, el, id, link, nogood, quote, _i, _len, _ref, _results; var backlink, el, good, id, link, quote, _i, _len, _ref, _results;
_ref = $$('a.quotelink', root); _ref = $$('a.quotelink', root);
_results = []; _results = [];
for (_i = 0, _len = _ref.length; _i < _len; _i++) { for (_i = 0, _len = _ref.length; _i < _len; _i++) {
quote = _ref[_i]; quote = _ref[_i];
el = d.getElementById(quote.textContent.slice(2));
_results.push((function() { _results.push((function() {
var _j, _len2, _ref2; var _j, _len2, _ref2;
if (el = d.getElementById(quote.textContent.slice(2))) { if (el && el.className !== 'op') {
good = 1;
id = quote.parentNode.parentNode.parentNode.id; id = quote.parentNode.parentNode.parentNode.id;
if (el.className !== 'op') {
nogood = 0;
_ref2 = $$('a.backlink', el); _ref2 = $$('a.backlink', el);
for (_j = 0, _len2 = _ref2.length; _j < _len2; _j++) { for (_j = 0, _len2 = _ref2.length; _j < _len2; _j++) {
backlink = _ref2[_j]; backlink = _ref2[_j];
if (backlink.textContent === '>>' + id) { if (backlink.textContent === '>>' + id) {
nogood = 1; good = 0;
break; break;
} }
} }
if (!nogood) { if (good) {
link = $.el('a', { link = $.el('a', {
href: '#' + id, href: '#' + id,
className: 'backlink', className: 'backlink',
@ -1714,7 +1714,6 @@
return $.before($('br, blockquote', el), link); return $.before($('br, blockquote', el), link);
} }
} }
}
})()); })());
} }
return _results; return _results;

View File

@ -1346,16 +1346,16 @@ quoteBacklink =
g.callbacks.push quoteBacklink.node g.callbacks.push quoteBacklink.node
node: (root) -> node: (root) ->
for quote in $$ 'a.quotelink', root for quote in $$ 'a.quotelink', root
if el = d.getElementById quote.textContent[2..] el = d.getElementById(quote.textContent[2..])
if el and el.className isnt 'op'
good = 1
id = quote.parentNode.parentNode.parentNode.id id = quote.parentNode.parentNode.parentNode.id
unless el.className is 'op'
nogood = 0
for backlink in $$ 'a.backlink', el for backlink in $$ 'a.backlink', el
if backlink.textContent is '>>'+id if backlink.textContent is '>>'+id
nogood = 1 good = 0
break break
unless nogood if good
link = $.el 'a' link = $.el 'a',
href: '#'+id href: '#'+id
className: 'backlink' className: 'backlink'
textContent: '>>'+id textContent: '>>'+id