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