Sometimes we can just do it better when we give it a second look.
This commit is contained in:
parent
6a1223ef04
commit
2e1dc0088d
@ -3108,36 +3108,34 @@
|
||||
};
|
||||
},
|
||||
allQuotelinksLinkingTo: function(post) {
|
||||
var ID, handleClones, qLconcat, quote, quotedPost, quotelinks, quoterPost, _i, _len, _ref, _ref1, _ref2;
|
||||
var ID, handleQuotes, qLconcat, quote, quotedPost, quotelinks, quoterPost, _i, _len, _ref, _ref1, _ref2;
|
||||
quotelinks = [];
|
||||
qLconcat = function(links) {
|
||||
return quotelinks = quotelinks.concat(links);
|
||||
};
|
||||
handleClones = function(clones) {
|
||||
var clone, _i, _len;
|
||||
for (_i = 0, _len = clones.length; _i < _len; _i++) {
|
||||
clone = clones[_i];
|
||||
handleQuotes = function(post) {
|
||||
var clone, _i, _len, _ref;
|
||||
qLconcat(post.nodes.quotelinks);
|
||||
_ref = post.clones;
|
||||
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
||||
clone = _ref[_i];
|
||||
qLconcat(clone.nodes.quotelinks);
|
||||
}
|
||||
};
|
||||
_ref = g.posts;
|
||||
for (ID in _ref) {
|
||||
quoterPost = _ref[ID];
|
||||
if (!(_ref1 = post.fullID, __indexOf.call(quoterPost.quotes, _ref1) >= 0)) {
|
||||
continue;
|
||||
if (_ref1 = post.fullID, __indexOf.call(quoterPost.quotes, _ref1) >= 0) {
|
||||
handleQuotes(quoterPost);
|
||||
}
|
||||
qLconcat(quoterPost.nodes.quotelinks);
|
||||
handleClones(quoterPost.clones);
|
||||
}
|
||||
if (Conf['Quote Backlinks']) {
|
||||
_ref2 = post.quotes;
|
||||
for (_i = 0, _len = _ref2.length; _i < _len; _i++) {
|
||||
quote = _ref2[_i];
|
||||
if (!(quotedPost = g.posts[quote])) {
|
||||
continue;
|
||||
if (quotedPost = g.posts[quote]) {
|
||||
handleQuotes(quotedPost);
|
||||
}
|
||||
qLconcat(quotedPost.nodes.quotelinks);
|
||||
handleClones(quotedPost.clones);
|
||||
}
|
||||
}
|
||||
return quotelinks.filter(function(quotelink) {
|
||||
|
||||
@ -3118,36 +3118,34 @@
|
||||
};
|
||||
},
|
||||
allQuotelinksLinkingTo: function(post) {
|
||||
var ID, handleClones, qLconcat, quote, quotedPost, quotelinks, quoterPost, _i, _len, _ref, _ref1, _ref2;
|
||||
var ID, handleQuotes, qLconcat, quote, quotedPost, quotelinks, quoterPost, _i, _len, _ref, _ref1, _ref2;
|
||||
quotelinks = [];
|
||||
qLconcat = function(links) {
|
||||
return quotelinks = quotelinks.concat(links);
|
||||
};
|
||||
handleClones = function(clones) {
|
||||
var clone, _i, _len;
|
||||
for (_i = 0, _len = clones.length; _i < _len; _i++) {
|
||||
clone = clones[_i];
|
||||
handleQuotes = function(post) {
|
||||
var clone, _i, _len, _ref;
|
||||
qLconcat(post.nodes.quotelinks);
|
||||
_ref = post.clones;
|
||||
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
||||
clone = _ref[_i];
|
||||
qLconcat(clone.nodes.quotelinks);
|
||||
}
|
||||
};
|
||||
_ref = g.posts;
|
||||
for (ID in _ref) {
|
||||
quoterPost = _ref[ID];
|
||||
if (!(_ref1 = post.fullID, __indexOf.call(quoterPost.quotes, _ref1) >= 0)) {
|
||||
continue;
|
||||
if (_ref1 = post.fullID, __indexOf.call(quoterPost.quotes, _ref1) >= 0) {
|
||||
handleQuotes(quoterPost);
|
||||
}
|
||||
qLconcat(quoterPost.nodes.quotelinks);
|
||||
handleClones(quoterPost.clones);
|
||||
}
|
||||
if (Conf['Quote Backlinks']) {
|
||||
_ref2 = post.quotes;
|
||||
for (_i = 0, _len = _ref2.length; _i < _len; _i++) {
|
||||
quote = _ref2[_i];
|
||||
if (!(quotedPost = g.posts[quote])) {
|
||||
continue;
|
||||
if (quotedPost = g.posts[quote]) {
|
||||
handleQuotes(quotedPost);
|
||||
}
|
||||
qLconcat(quotedPost.nodes.quotelinks);
|
||||
handleClones(quotedPost.clones);
|
||||
}
|
||||
}
|
||||
return quotelinks.filter(function(quotelink) {
|
||||
|
||||
@ -40,28 +40,25 @@ Get =
|
||||
allQuotelinksLinkingTo: (post) ->
|
||||
# Get quotelinks & backlinks linking to the given post.
|
||||
quotelinks = []
|
||||
qLconcat = (links) ->
|
||||
quotelinks = quotelinks.concat links
|
||||
handleQuotes = (post) ->
|
||||
qLconcat post.nodes.quotelinks
|
||||
for clone in post.clones
|
||||
qLconcat clone.nodes.quotelinks
|
||||
return
|
||||
# First:
|
||||
# In every posts,
|
||||
# if it did quote this post,
|
||||
# get all their backlinks.
|
||||
qLconcat = (links) ->
|
||||
quotelinks = quotelinks.concat links
|
||||
handleClones = (clones) ->
|
||||
for clone in clones
|
||||
qLconcat clone.nodes.quotelinks
|
||||
return
|
||||
for ID, quoterPost of g.posts when post.fullID in quoterPost.quotes
|
||||
qLconcat quoterPost.nodes.quotelinks
|
||||
handleClones quoterPost.clones
|
||||
handleQuotes quoterPost for ID, quoterPost of g.posts when post.fullID in quoterPost.quotes
|
||||
# Second:
|
||||
# If we have quote backlinks:
|
||||
# in all posts this post quoted
|
||||
# and their clones,
|
||||
# get all of their backlinks.
|
||||
if Conf['Quote Backlinks']
|
||||
for quote in post.quotes when quotedPost = g.posts[quote]
|
||||
qLconcat quotedPost.nodes.quotelinks
|
||||
handleClones quotedPost.clones
|
||||
handleQuotes quotedPost for quote in post.quotes when quotedPost = g.posts[quote]
|
||||
# Third:
|
||||
# Filter out irrelevant quotelinks.
|
||||
quotelinks.filter (quotelink) ->
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user