Browse Source

profileGen v1

pull/11/head
Bryce Murphy 5 years ago
parent
commit
82d89566ed
3 changed files with 35 additions and 3 deletions
  1. +7
    -1
      GraphTest.html
  2. +1
    -2
      js/githubAPI.js
  3. +27
    -0
      js/profileGen.js

+ 7
- 1
GraphTest.html View File

@ -24,6 +24,7 @@
</script>
<script src="js/githubAPI.js"></script>
<script src="js/friendsGraph.js"></script>
<script src="js/profileGen.js"></script>
<script type="text/javascript" src="js/vis/vis.js"></script>
@ -34,11 +35,16 @@
<body>
<h2 id="graphLabel"></h2>
<div id="myGraph" style="width:100%"></div>
<div id="myGraph" style="width:50%"></div>
<div id="profileGen" style="width:50%"></div>
<script>
createFriendsGraph("jrtechs", "myGraph", "graphLabel");
</script>
<script>
profileGen("ylberveliu", "profileGen");
</script>
</body>
</html>

+ 1
- 2
js/githubAPI.js View File

@ -30,8 +30,7 @@ const API_ORGANIZATIONS = "/orgs";
* @param successCallBack callback to complete when data is returned
* @param errorCallBack callback which is invoked on error
*/
function queryAPIByUser(apiPath, user, successCallBack, errorCallBack)
{
function queryAPIByUser(apiPath, user, successCallBack, errorCallBack) {
const urlpath = APIROOT + API_USER_PATH + user + apiPath;
console.log(urlpath);
$.ajax({

+ 27
- 0
js/profileGen.js View File

@ -0,0 +1,27 @@
function profileGen(username, container) {
queryAPIByUser("", username, (data) => {
console.log(data);
html =
"<div> \
<img src=\""+data.avatar_url+"\"></img> \
<h1>"+data.name+"</h1> \
<h2>"+data.login+"</h2> \
<p>Followers: "+data.followers+"</p> \
<p>Following: "+data.following+"</p> \
<p>"+(data.bio != null ? "Bio: "+data.bio : "")+"</p> \
<p>"+(data.location != null ? "Location: "+data.location : "")+"</p> \
<p>"+(data.email != null ? "Email: "+data.email : "")+"</p> \
<p>"+(data.blog != null ? "Site: "+data.blog : "")+"</p> \
<p>"+(data.company != null ? "Company: "+data.company : "")+"</p> \
<a href=\""+data.html_url+"\">"+data.html_url+"</h2> \
<h2></h2> \
</div>"
$("#"+container).html(html);
}, () => {
console.log("error");
});
}
function parseOrgs(oranization_url) {
}

Loading…
Cancel
Save