Browse Source

Moved files around to work with nodejs static routes.

pull/11/head
Jeffery Russell 5 years ago
parent
commit
c9f54ad038
29 changed files with 54697 additions and 0 deletions
  1. +179
    -0
      public/js/friendsGraph.js
  2. +44
    -0
      public/js/githubAPI.js
  3. +27
    -0
      public/js/profileGen.js
  4. BIN
      public/js/vis/img/network/acceptDeleteIcon.png
  5. BIN
      public/js/vis/img/network/addNodeIcon.png
  6. BIN
      public/js/vis/img/network/backIcon.png
  7. BIN
      public/js/vis/img/network/connectIcon.png
  8. BIN
      public/js/vis/img/network/cross.png
  9. BIN
      public/js/vis/img/network/cross2.png
  10. BIN
      public/js/vis/img/network/deleteIcon.png
  11. BIN
      public/js/vis/img/network/downArrow.png
  12. BIN
      public/js/vis/img/network/editIcon.png
  13. BIN
      public/js/vis/img/network/leftArrow.png
  14. BIN
      public/js/vis/img/network/minus.png
  15. BIN
      public/js/vis/img/network/plus.png
  16. BIN
      public/js/vis/img/network/rightArrow.png
  17. BIN
      public/js/vis/img/network/upArrow.png
  18. BIN
      public/js/vis/img/network/zoomExtends.png
  19. +34
    -0
      public/js/vis/vis-graph3d.min.js
  20. +1
    -0
      public/js/vis/vis-network.min.css
  21. +42
    -0
      public/js/vis/vis-network.min.js
  22. +1
    -0
      public/js/vis/vis-timeline-graph2d.min.css
  23. +40
    -0
      public/js/vis/vis-timeline-graph2d.min.js
  24. +1448
    -0
      public/js/vis/vis.css
  25. +52833
    -0
      public/js/vis/vis.js
  26. +0
    -0
      public/js/vis/vis.js.map
  27. +1
    -0
      public/js/vis/vis.map
  28. +1
    -0
      public/js/vis/vis.min.css
  29. +46
    -0
      public/js/vis/vis.min.js

+ 179
- 0
public/js/friendsGraph.js View File

@ -0,0 +1,179 @@
var nodes;
var edges;
const options = {
nodes: {
borderWidth:4,
size:30,
color: {
border: '#222222',
background: '#666666'
},
font:{color:'#eeeeee'}
},
edges: {
color: 'lightgray'
}
};
function alreadyInGraph(userID)
{
for(var i = 0; i < nodes.length; i++)
{
if(nodes[i].id === userID)
{
return true;
}
}
return false;
}
function addPersonToGraph(profileData)
{
nodes.push(
{
id:profileData.id,
name:profileData.login,
shape: 'circularImage',
image:profileData.avatar_url
});
}
function addFriends(username, apiPath)
{
return new Promise(function(resolve, reject)
{
queryAPIByUser(apiPath, username, function(data)
{
for(var i = 0; i < data.length; i++)
{
if(!alreadyInGraph(data[i].id))
{
addPersonToGraph(data[i]);
}
}
resolve();
},
function(error)
{
reject(error);
})
});
}
function addConnection(person1, person2)
{
edges.push(
{
from: person1.id,
to: person2.id
});
}
function processUserConnections(userName)
{
return new Promise(function(resolve, reject)
{
queryAPIByUser(API_FOLLOWING, userName,
function(data)
{
for(var i = 0; i < data.length; i++)
{
}
queryAPIByUser(API_FOLLOWERS, userName, function(data2)
{
for(var i = 0; i < data2.length; i++)
{
}
resolve();
},
function(error)
{
reject(error);
});
},
function(error)
{
reject(error);
})
});
}
function createConnections()
{
return new Promise(function(resolve, reject)
{
var prom = [];
for(var i = 0; i < nodes.length; i++)
{
prom.push(processUserConnections(nodes[i].name));
}
Promise.all(prom).then(function()
{
resolve();
}).catch(function(error)
{
reject(error);
});
});
}
function addSelfToGraph(username)
{
return new Promise(function(resolve, reject)
{
queryAPIByUser("", username, function(data)
{
addPersonToGraph(data);
resolve();
},
function(error)
{
reject(error);
});
});
}
function createFriendsGraph(username, containerName, graphsTitle)
{
nodes = [];
edges = [];
addSelfToGraph(username).then(function()
{
addFriends(username, API_FOLLOWERS).then(function()
{
addFriends(username, API_FOLLOWING).then(function()
{
createConnections().then(function()
{
var container = document.getElementById(containerName);
var data =
{
nodes: nodes,
edges: edges
};
var network = new vis.Network(container, data, options);
});
});
})
}).catch(function(error)
{
console.log(error);
$("#" + graphsTitle).html("Error Fetching Data From API");
});
}

+ 44
- 0
public/js/githubAPI.js View File

@ -0,0 +1,44 @@
/**
* Simple file which uses jQuery's ajax
* calls to make it easier to get data
* from the github api.
*
* @author Jeffery Russell 2-16-19
*/
const APIROOT = "https://api.github.com";
const API_USER_PATH = "/users/";
const API_FOLLOWING = "/following";
const API_FOLLOWERS = "/followers";
const API_REPOSITORIES = "/repos";
const API_ORGANIZATIONS = "/orgs";
/**
* Builds a query for the github rest api and
* allows you to get at the data using a
* callback which gives you a json object.
*
* @param apiPath the path on the github api ie API_FOLLOWING
* @param user the username to query
* @param successCallBack callback to complete when data is returned
* @param errorCallBack callback which is invoked on error
*/
function queryAPIByUser(apiPath, user, successCallBack, errorCallBack) {
const urlpath = APIROOT + API_USER_PATH + user + apiPath;
console.log(urlpath);
$.ajax({
type:'GET',
url: urlpath,
crossDomain: true,
dataType: "json",
success: successCallBack,
error:errorCallBack
});
}

+ 27
- 0
public/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) {
}

BIN
public/js/vis/img/network/acceptDeleteIcon.png View File

Before After
Width: 24  |  Height: 24  |  Size: 20 KiB

BIN
public/js/vis/img/network/addNodeIcon.png View File

Before After
Width: 24  |  Height: 24  |  Size: 20 KiB

BIN
public/js/vis/img/network/backIcon.png View File

Before After
Width: 24  |  Height: 24  |  Size: 20 KiB

BIN
public/js/vis/img/network/connectIcon.png View File

Before After
Width: 24  |  Height: 24  |  Size: 20 KiB

BIN
public/js/vis/img/network/cross.png View File

Before After
Width: 7  |  Height: 7  |  Size: 18 KiB

BIN
public/js/vis/img/network/cross2.png View File

Before After
Width: 5  |  Height: 5  |  Size: 17 KiB

BIN
public/js/vis/img/network/deleteIcon.png View File

Before After
Width: 24  |  Height: 24  |  Size: 20 KiB

BIN
public/js/vis/img/network/downArrow.png View File

Before After
Width: 30  |  Height: 30  |  Size: 4.4 KiB

BIN
public/js/vis/img/network/editIcon.png View File

Before After
Width: 24  |  Height: 24  |  Size: 20 KiB

BIN
public/js/vis/img/network/leftArrow.png View File

Before After
Width: 30  |  Height: 30  |  Size: 4.4 KiB

BIN
public/js/vis/img/network/minus.png View File

Before After
Width: 30  |  Height: 30  |  Size: 4.0 KiB

BIN
public/js/vis/img/network/plus.png View File

Before After
Width: 30  |  Height: 30  |  Size: 4.2 KiB

BIN
public/js/vis/img/network/rightArrow.png View File

Before After
Width: 30  |  Height: 30  |  Size: 4.4 KiB

BIN
public/js/vis/img/network/upArrow.png View File

Before After
Width: 30  |  Height: 30  |  Size: 4.4 KiB

BIN
public/js/vis/img/network/zoomExtends.png View File

Before After
Width: 30  |  Height: 30  |  Size: 4.4 KiB

+ 34
- 0
public/js/vis/vis-graph3d.min.js
File diff suppressed because it is too large
View File


+ 1
- 0
public/js/vis/vis-network.min.css
File diff suppressed because it is too large
View File


+ 42
- 0
public/js/vis/vis-network.min.js
File diff suppressed because it is too large
View File


+ 1
- 0
public/js/vis/vis-timeline-graph2d.min.css
File diff suppressed because it is too large
View File


+ 40
- 0
public/js/vis/vis-timeline-graph2d.min.js
File diff suppressed because it is too large
View File


+ 1448
- 0
public/js/vis/vis.css
File diff suppressed because it is too large
View File


+ 52833
- 0
public/js/vis/vis.js
File diff suppressed because it is too large
View File


+ 0
- 0
public/js/vis/vis.js.map View File


+ 1
- 0
public/js/vis/vis.map
File diff suppressed because it is too large
View File


+ 1
- 0
public/js/vis/vis.min.css
File diff suppressed because it is too large
View File


+ 46
- 0
public/js/vis/vis.min.js
File diff suppressed because it is too large
View File


Loading…
Cancel
Save