Website for visualizing a persons github network.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

46 lines
1.8 KiB

5 years ago
5 years ago
5 years ago
5 years ago
  1. function profileGen(username, container) {
  2. queryAPIByUser("", username, (user) => {
  3. console.log(user);
  4. html =
  5. "<div> \
  6. <img src=\""+user.avatar_url+"\"></img> \
  7. <h1>"+user.name+"</h1> \
  8. <h2>"+user.login+"</h2> \
  9. <p>Followers: "+user.followers+"</p> \
  10. <p>Following: "+user.following+"</p> \
  11. <svg class=\"octicon octicon-star mr-2 text-gray-light\" viewBox=\"0 0 14 16\" version=\"1.1\" width=\"14\" height=\"16\" aria-hidden=\"true\"><path fill-rule=\"evenodd\" d=\"M14 6l-4.9-.64L7 1 4.9 5.36 0 6l3.6 3.26L2.67 14 7 11.67 11.33 14l-.93-4.74L14 6z\"></path></svg> \
  12. <p>"+(user.bio != null ? "Bio: "+user.bio : "")+"</p> \
  13. <p>"+(user.location != null ? "Location: "+user.location : "")+"</p> \
  14. <p>"+(user.email != null ? "Email: "+user.email : "")+"</p> \
  15. <p>"+(user.blog != null ? "Site: "+user.blog : "")+"</p> \
  16. <p>"+(user.company != null ? "Company: "+user.company : "")+"</p> \
  17. <p>"+(user.organizations_url != null ? "Organizations: "+parseOrgs(user.organizations_url) : "")+"</p> \
  18. <a href=\""+user.html_url+"\">"+user.html_url+"</h2> \
  19. <h2></h2> \
  20. </div>"
  21. $("#"+container).html(html);
  22. }, () => {
  23. console.error("error getting user info");
  24. });
  25. }
  26. function parseOrgs(oranization_url) {
  27. queryOrgUrl(oranization_url, (orgs) => {
  28. for (org in orgs) {
  29. console.log(org);
  30. }
  31. }, () => {
  32. console.error("error getting orgs");
  33. })
  34. }
  35. function queryOrgUrl(url, successCallBack, errorCallBack) {
  36. console.log(urlpath);
  37. $.ajax({
  38. type:'GET',
  39. url: urlpath,
  40. crossDomain: true,
  41. dataType: "json",
  42. success: successCallBack,
  43. error:errorCallBack
  44. });
  45. }