Created
November 5, 2016 08:07
-
-
Save thearchduke/69f685ed5a0de260eb8233ec670951a2 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$.ajax({ | |
url: "evening.html", | |
}).done(function(data) { | |
var post = $(data); | |
window.graph.nodes.push({ | |
"id": "front-page post", | |
"user": "front-page post" | |
}) | |
post.find('.comment').each(function() { | |
var cmt = $(this); | |
var user = cmt.find('div > div > cite').text(); | |
var text = cmt.find('p').text(); | |
var id = cmt.find('div:nth-of-type(2)').attr('id'); | |
var numAs = 0; | |
window.graph.nodes.push({ | |
"id": id, | |
"user": user, | |
"text": text, | |
}); | |
cmt.find('div > p > a').each(function() { | |
var anchor = $(this) | |
if (anchor.attr("href").includes("#comment-")) { | |
window.graph.links.push({ | |
"source": id, | |
"target": anchor.attr("href").split("#")[1] | |
}); | |
numAs++; | |
} | |
}) | |
if (numAs == 0) { | |
window.graph.links.push({ | |
"source": id, | |
"target": "front-page post" | |
}); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment