Browse Source

Created a friends graph using visjs and jquery.

pull/17/head
jrtechs 4 years ago
parent
commit
0f640a9844
191 changed files with 60 additions and 30 deletions
  1. +0
    -0
      website/Diagram.svg
  2. +0
    -0
      website/css/bootstrap.css
  3. +0
    -0
      website/css/bootstrap.min.css
  4. +0
    -0
      website/error.html
  5. +0
    -0
      website/exampleGraph.png
  6. +0
    -0
      website/faq.html
  7. +1
    -1
      website/friendsGraph.html
  8. +0
    -0
      website/graph.html
  9. +0
    -0
      website/graphs.html
  10. +0
    -0
      website/img/404.jpg
  11. +0
    -0
      website/img/banner.png
  12. +0
    -0
      website/img/banner2.png
  13. +0
    -0
      website/img/faq/faqGraph.png
  14. +0
    -0
      website/img/faq/java.png
  15. +0
    -0
      website/img/faq/steamId.png
  16. +0
    -0
      website/img/faq/steamIdOption2.png
  17. +0
    -0
      website/img/favicon/android-chrome-192x192.png
  18. +0
    -0
      website/img/favicon/android-chrome-512x512.png
  19. +0
    -0
      website/img/favicon/apple-touch-icon.png
  20. +0
    -0
      website/img/favicon/browserconfig.xml
  21. +0
    -0
      website/img/favicon/favicon-16x16.png
  22. +0
    -0
      website/img/favicon/favicon-32x32.png
  23. +0
    -0
      website/img/favicon/favicon.ico
  24. +0
    -0
      website/img/favicon/mstile-150x150.png
  25. +0
    -0
      website/img/favicon/safari-pinned-tab.svg
  26. +0
    -0
      website/img/favicon/site.webmanifest
  27. +0
    -0
      website/img/jrtechs1.png
  28. +0
    -0
      website/img/jrtechs2.png
  29. +0
    -0
      website/img/slider/img1.png
  30. +0
    -0
      website/img/slider/img2.png
  31. +0
    -0
      website/img/slider/img3.png
  32. +0
    -0
      website/img/slider/img4.png
  33. +0
    -0
      website/img/slider/img5.png
  34. +0
    -0
      website/img/slider/img6.png
  35. +0
    -0
      website/index.html
  36. +0
    -0
      website/js/createOrgInfo.js
  37. +0
    -0
      website/js/createOrgRepoGraph.js
  38. +0
    -0
      website/js/createOrgTable.js
  39. +40
    -29
      website/js/friendsGraph.js
  40. +19
    -0
      website/js/profileGen.js
  41. +0
    -0
      website/js/profileTimeLine.js
  42. +0
    -0
      website/js/repoGen.js
  43. +0
    -0
      website/js/steamAPI.js
  44. +0
    -0
      website/js/utilities.js
  45. +0
    -0
      website/js/vis/img/network/acceptDeleteIcon.png
  46. +0
    -0
      website/js/vis/img/network/addNodeIcon.png
  47. +0
    -0
      website/js/vis/img/network/backIcon.png
  48. +0
    -0
      website/js/vis/img/network/connectIcon.png
  49. +0
    -0
      website/js/vis/img/network/cross.png
  50. +0
    -0
      website/js/vis/img/network/cross2.png
  51. +0
    -0
      website/js/vis/img/network/deleteIcon.png
  52. +0
    -0
      website/js/vis/img/network/downArrow.png
  53. +0
    -0
      website/js/vis/img/network/editIcon.png
  54. +0
    -0
      website/js/vis/img/network/leftArrow.png
  55. +0
    -0
      website/js/vis/img/network/minus.png
  56. +0
    -0
      website/js/vis/img/network/plus.png
  57. +0
    -0
      website/js/vis/img/network/rightArrow.png
  58. +0
    -0
      website/js/vis/img/network/upArrow.png
  59. +0
    -0
      website/js/vis/img/network/zoomExtends.png
  60. +0
    -0
      website/js/vis/vis-graph3d.min.js
  61. +0
    -0
      website/js/vis/vis-network.min.css
  62. +0
    -0
      website/js/vis/vis-network.min.js
  63. +0
    -0
      website/js/vis/vis-timeline-graph2d.min.css
  64. +0
    -0
      website/js/vis/vis-timeline-graph2d.min.js
  65. +0
    -0
      website/js/vis/vis.css
  66. +0
    -0
      website/js/vis/vis.js
  67. +0
    -0
      website/js/vis/vis.js.map
  68. +0
    -0
      website/js/vis/vis.map
  69. +0
    -0
      website/js/vis/vis.min.css
  70. +0
    -0
      website/js/vis/vis.min.js
  71. +0
    -0
      website/profile.html
  72. +0
    -0
      website/src/RepoJS/README.md
  73. +0
    -0
      website/src/RepoJS/bower.json
  74. +0
    -0
      website/src/RepoJS/fonts/repo.eot
  75. +0
    -0
      website/src/RepoJS/fonts/repo.svg
  76. +0
    -0
      website/src/RepoJS/fonts/repo.ttf
  77. +0
    -0
      website/src/RepoJS/fonts/repo.woff
  78. +0
    -0
      website/src/RepoJS/repo.js
  79. +0
    -0
      website/src/RepoJS/repo.min.js
  80. +0
    -0
      website/src/captors/sigma.captors.mouse.js
  81. +0
    -0
      website/src/captors/sigma.captors.touch.js
  82. +0
    -0
      website/src/classes/sigma.classes.camera.js
  83. +0
    -0
      website/src/classes/sigma.classes.configurable.js
  84. +0
    -0
      website/src/classes/sigma.classes.dispatcher.js
  85. +0
    -0
      website/src/classes/sigma.classes.edgequad.js
  86. +0
    -0
      website/src/classes/sigma.classes.graph.js
  87. +0
    -0
      website/src/classes/sigma.classes.quad.js
  88. +0
    -0
      website/src/conrad.js
  89. +0
    -0
      website/src/middlewares/sigma.middlewares.copy.js
  90. +0
    -0
      website/src/middlewares/sigma.middlewares.rescale.js
  91. +0
    -0
      website/src/misc/sigma.misc.animation.js
  92. +0
    -0
      website/src/misc/sigma.misc.bindDOMEvents.js
  93. +0
    -0
      website/src/misc/sigma.misc.bindEvents.js
  94. +0
    -0
      website/src/misc/sigma.misc.drawHovers.js
  95. +0
    -0
      website/src/plugins/sigma.exporters.svg/README.md
  96. +0
    -0
      website/src/plugins/sigma.exporters.svg/sigma.exporters.svg.js
  97. +0
    -0
      website/src/plugins/sigma.layout.forceAtlas2/Gruntfile.js
  98. +0
    -0
      website/src/plugins/sigma.layout.forceAtlas2/README.md
  99. +0
    -0
      website/src/plugins/sigma.layout.forceAtlas2/supervisor.js
  100. +0
    -0
      website/src/plugins/sigma.layout.forceAtlas2/tasks/forceAtlas2.js

src/main/resources/website/Diagram.svg → website/Diagram.svg View File


src/main/resources/website/css/bootstrap.css → website/css/bootstrap.css View File


src/main/resources/website/css/bootstrap.min.css → website/css/bootstrap.min.css View File


src/main/resources/website/error.html → website/error.html View File


src/main/resources/website/exampleGraph.png → website/exampleGraph.png View File


src/main/resources/website/faq.html → website/faq.html View File


src/main/resources/website/friendsGraph.html → website/friendsGraph.html View File

@ -19,7 +19,7 @@
</script> </script>
<script src="js/steamAPI.js"></script> <script src="js/steamAPI.js"></script>
<script src="js/friendsGraph.js"></script> <script src="js/friendsGraph.js"></script>
<!-- <script src="js/profileGen.js"></script>-->
<script src="js/profileGen.js"></script>
<script src="js/utilities.js"></script> <script src="js/utilities.js"></script>
<script type="text/javascript" src="js/vis/vis.js"></script> <script type="text/javascript" src="js/vis/vis.js"></script>

src/main/resources/website/graph.html → website/graph.html View File


src/main/resources/website/graphs.html → website/graphs.html View File


src/main/resources/website/img/404.jpg → website/img/404.jpg View File


src/main/resources/website/img/banner.png → website/img/banner.png View File


src/main/resources/website/img/banner2.png → website/img/banner2.png View File


src/main/resources/website/img/faq/faqGraph.png → website/img/faq/faqGraph.png View File


src/main/resources/website/img/faq/java.png → website/img/faq/java.png View File


src/main/resources/website/img/faq/steamId.png → website/img/faq/steamId.png View File


src/main/resources/website/img/faq/steamIdOption2.png → website/img/faq/steamIdOption2.png View File


src/main/resources/website/img/favicon/android-chrome-192x192.png → website/img/favicon/android-chrome-192x192.png View File


src/main/resources/website/img/favicon/android-chrome-512x512.png → website/img/favicon/android-chrome-512x512.png View File


src/main/resources/website/img/favicon/apple-touch-icon.png → website/img/favicon/apple-touch-icon.png View File


src/main/resources/website/img/favicon/browserconfig.xml → website/img/favicon/browserconfig.xml View File


src/main/resources/website/img/favicon/favicon-16x16.png → website/img/favicon/favicon-16x16.png View File


src/main/resources/website/img/favicon/favicon-32x32.png → website/img/favicon/favicon-32x32.png View File


src/main/resources/website/img/favicon/favicon.ico → website/img/favicon/favicon.ico View File


src/main/resources/website/img/favicon/mstile-150x150.png → website/img/favicon/mstile-150x150.png View File


src/main/resources/website/img/favicon/safari-pinned-tab.svg → website/img/favicon/safari-pinned-tab.svg View File


src/main/resources/website/img/favicon/site.webmanifest → website/img/favicon/site.webmanifest View File


src/main/resources/website/img/jrtechs1.png → website/img/jrtechs1.png View File


src/main/resources/website/img/jrtechs2.png → website/img/jrtechs2.png View File


src/main/resources/website/img/slider/img1.png → website/img/slider/img1.png View File


src/main/resources/website/img/slider/img2.png → website/img/slider/img2.png View File


src/main/resources/website/img/slider/img3.png → website/img/slider/img3.png View File


src/main/resources/website/img/slider/img4.png → website/img/slider/img4.png View File


src/main/resources/website/img/slider/img5.png → website/img/slider/img5.png View File


src/main/resources/website/img/slider/img6.png → website/img/slider/img6.png View File


src/main/resources/website/index.html → website/index.html View File


src/main/resources/website/js/createOrgInfo.js → website/js/createOrgInfo.js View File


src/main/resources/website/js/createOrgRepoGraph.js → website/js/createOrgRepoGraph.js View File


src/main/resources/website/js/createOrgTable.js → website/js/createOrgTable.js View File


src/main/resources/website/js/friendsGraph.js → website/js/friendsGraph.js View File

@ -141,7 +141,6 @@ function addConnection(id1, id2)
{ {
if(alreadyInGraph(id2) && !edgeInGraph(id1, id2)) if(alreadyInGraph(id2) && !edgeInGraph(id1, id2))
{ {
console.log("adding edge dynamic")
network.body.data.edges.add([{ network.body.data.edges.add([{
from: id1, from: id1,
to: id2 to: id2
@ -159,13 +158,13 @@ function addConnection(id1, id2)
*/ */
function processUserConnections(node) function processUserConnections(node)
{ {
updateProgress();
getPersonAPI(node.id, getPersonAPI(node.id,
(data)=> (data)=>
{ {
updateProgress();
for(var i = 0; i < data.friends.length; i++) for(var i = 0; i < data.friends.length; i++)
{ {
console.log("adding new con");
addConnection(node.id, data.friends[i].id) addConnection(node.id, data.friends[i].id)
} }
}, (error)=> }, (error)=>
@ -183,15 +182,11 @@ function processUserConnections(node)
*/ */
function createConnections() function createConnections()
{ {
return new Promise((resolve, reject)=>
var prom = [];
for(var i = 0; i < nodes.length; i++)
{ {
var prom = [];
for(var i = 0; i < nodes.length; i++)
{
processUserConnections(nodes[i]);
}
});
processUserConnections(nodes[i]);
}
} }
@ -201,13 +196,20 @@ function createConnections()
function updateProgress() function updateProgress()
{ {
indexed++; indexed++;
const percent = parseInt((indexed/total)*100);
$("#" + progressID).html("<div class=\"progress\">\n" +
" <div class=\"progress-bar progress-bar-striped progress-bar-animated\" role=\"progressbar\" style=\"width: " + percent + "%\" aria-valuenow=\"" + percent + "\" aria-valuemin=\"0\" aria-valuemax=\"100\"></div>\n" +
"</div>");
if(indexed >= total)
{
$("#" + progressID).html("");
}
else
{
const percent = parseInt((indexed/total)*100);
$("#" + progressID).html("<div class=\"progress\">\n" +
" <div class=\"progress-bar progress-bar-striped progress-bar-animated\" role=\"progressbar\" style=\"width: " + percent + "%\" aria-valuenow=\"" + percent + "\" aria-valuemin=\"0\" aria-valuemax=\"100\"></div>\n" +
"</div>");
}
} }
var selfData;
/** /**
* Adds the base person to the graph. * Adds the base person to the graph.
@ -221,6 +223,7 @@ function addSelfToGraph(id)
{ {
getPersonAPI(id, (data)=> getPersonAPI(id, (data)=>
{ {
selfData = data;
baseID = data.id; baseID = data.id;
total = data.friends.length; total = data.friends.length;
addPersonToGraph(data); addPersonToGraph(data);
@ -241,11 +244,19 @@ function addSelfToGraph(id)
*/ */
function bringUpProfileView(uname) function bringUpProfileView(uname)
{ {
for(var i = 0; i < nodes.length; i++)
console.log(uname);
if(uname === selfData.id)
{
profileGen(selfData, "profileGen");
}
else
{ {
if(nodes[i].id === uname)
for(var i = 0; i < selfData.friends.length; i++)
{ {
profileGen(nodes[i].id, "profileGen");
if(selfData.friends[i].id === uname)
{
profileGen(selfData.friends[i], "profileGen");
}
} }
} }
} }
@ -275,18 +286,18 @@ function createFriendsGraph(username, containerName, progressBarID)
edges: edges edges: edges
}; };
network = new vis.Network(container, data, options); network = new vis.Network(container, data, options);
createConnections().then(()=>
bringUpProfileView(selfData.id);
network.on("click", function (params)
{ {
network.on("click", function (params)
if(Number(this.getNodeAt(params.pointer.DOM)) !== NaN)
{ {
if(Number(this.getNodeAt(params.pointer.DOM)) !== NaN)
{
bringUpProfileView(this.getNodeAt(params.pointer.DOM));
}
});
bringUpProfileView(this.getNodeAt(params.pointer.DOM));
}
});
createConnections().then(()=>
{
// $("#" + progressID).html("");
console.log("Finished");
}) })
}).catch((error)=> }).catch((error)=>
{ {

+ 19
- 0
website/js/profileGen.js View File

@ -0,0 +1,19 @@
function profileGen(data, container)
{
let html = `
<div class="card shadow-sm" style="font-size: 16px;">
<div class="card-img-top" style="position: relative;">
<img src="${data.avatar}" alt="${data.avatar}" width="100%" class="img-fluid"/>
</div>
<div class="card-body">
${data.name ? `<h5 class="card-title mb-1">${data.name}</h5>` : ""}
<a href="${data.avatar}" class="card-subtitle text-muted">${data.realName}</a>
<ul class="list-unstyled">
<li><a href="https://steamcommunity.com/profiles/${data.id}">Steam profile</a></li>
<li><a href="/friendsGraph.html?id=${data.id}">Friends Graph</a></li>
</ul>
</div>
</div>
`;
$("#"+container).html(html);
}

src/main/resources/website/js/profileTimeLine.js → website/js/profileTimeLine.js View File


src/main/resources/website/js/repoGen.js → website/js/repoGen.js View File


src/main/resources/website/js/steamAPI.js → website/js/steamAPI.js View File


src/main/resources/website/js/utilities.js → website/js/utilities.js View File


src/main/resources/website/js/vis/img/network/acceptDeleteIcon.png → website/js/vis/img/network/acceptDeleteIcon.png View File


src/main/resources/website/js/vis/img/network/addNodeIcon.png → website/js/vis/img/network/addNodeIcon.png View File


src/main/resources/website/js/vis/img/network/backIcon.png → website/js/vis/img/network/backIcon.png View File


src/main/resources/website/js/vis/img/network/connectIcon.png → website/js/vis/img/network/connectIcon.png View File


src/main/resources/website/js/vis/img/network/cross.png → website/js/vis/img/network/cross.png View File


src/main/resources/website/js/vis/img/network/cross2.png → website/js/vis/img/network/cross2.png View File


src/main/resources/website/js/vis/img/network/deleteIcon.png → website/js/vis/img/network/deleteIcon.png View File


src/main/resources/website/js/vis/img/network/downArrow.png → website/js/vis/img/network/downArrow.png View File


src/main/resources/website/js/vis/img/network/editIcon.png → website/js/vis/img/network/editIcon.png View File


src/main/resources/website/js/vis/img/network/leftArrow.png → website/js/vis/img/network/leftArrow.png View File


src/main/resources/website/js/vis/img/network/minus.png → website/js/vis/img/network/minus.png View File


src/main/resources/website/js/vis/img/network/plus.png → website/js/vis/img/network/plus.png View File


src/main/resources/website/js/vis/img/network/rightArrow.png → website/js/vis/img/network/rightArrow.png View File


src/main/resources/website/js/vis/img/network/upArrow.png → website/js/vis/img/network/upArrow.png View File


src/main/resources/website/js/vis/img/network/zoomExtends.png → website/js/vis/img/network/zoomExtends.png View File


src/main/resources/website/js/vis/vis-graph3d.min.js → website/js/vis/vis-graph3d.min.js View File


src/main/resources/website/js/vis/vis-network.min.css → website/js/vis/vis-network.min.css View File


src/main/resources/website/js/vis/vis-network.min.js → website/js/vis/vis-network.min.js View File


src/main/resources/website/js/vis/vis-timeline-graph2d.min.css → website/js/vis/vis-timeline-graph2d.min.css View File


src/main/resources/website/js/vis/vis-timeline-graph2d.min.js → website/js/vis/vis-timeline-graph2d.min.js View File


src/main/resources/website/js/vis/vis.css → website/js/vis/vis.css View File


src/main/resources/website/js/vis/vis.js → website/js/vis/vis.js View File


src/main/resources/website/js/vis/vis.js.map → website/js/vis/vis.js.map View File


src/main/resources/website/js/vis/vis.map → website/js/vis/vis.map View File


src/main/resources/website/js/vis/vis.min.css → website/js/vis/vis.min.css View File


src/main/resources/website/js/vis/vis.min.js → website/js/vis/vis.min.js View File


src/main/resources/website/profile.html → website/profile.html View File


src/main/resources/website/src/RepoJS/README.md → website/src/RepoJS/README.md View File


src/main/resources/website/src/RepoJS/bower.json → website/src/RepoJS/bower.json View File


src/main/resources/website/src/RepoJS/fonts/repo.eot → website/src/RepoJS/fonts/repo.eot View File


src/main/resources/website/src/RepoJS/fonts/repo.svg → website/src/RepoJS/fonts/repo.svg View File


src/main/resources/website/src/RepoJS/fonts/repo.ttf → website/src/RepoJS/fonts/repo.ttf View File


src/main/resources/website/src/RepoJS/fonts/repo.woff → website/src/RepoJS/fonts/repo.woff View File


src/main/resources/website/src/RepoJS/repo.js → website/src/RepoJS/repo.js View File


src/main/resources/website/src/RepoJS/repo.min.js → website/src/RepoJS/repo.min.js View File


src/main/resources/website/src/captors/sigma.captors.mouse.js → website/src/captors/sigma.captors.mouse.js View File


src/main/resources/website/src/captors/sigma.captors.touch.js → website/src/captors/sigma.captors.touch.js View File


src/main/resources/website/src/classes/sigma.classes.camera.js → website/src/classes/sigma.classes.camera.js View File


src/main/resources/website/src/classes/sigma.classes.configurable.js → website/src/classes/sigma.classes.configurable.js View File


src/main/resources/website/src/classes/sigma.classes.dispatcher.js → website/src/classes/sigma.classes.dispatcher.js View File


src/main/resources/website/src/classes/sigma.classes.edgequad.js → website/src/classes/sigma.classes.edgequad.js View File


src/main/resources/website/src/classes/sigma.classes.graph.js → website/src/classes/sigma.classes.graph.js View File


src/main/resources/website/src/classes/sigma.classes.quad.js → website/src/classes/sigma.classes.quad.js View File


src/main/resources/website/src/conrad.js → website/src/conrad.js View File


src/main/resources/website/src/middlewares/sigma.middlewares.copy.js → website/src/middlewares/sigma.middlewares.copy.js View File


src/main/resources/website/src/middlewares/sigma.middlewares.rescale.js → website/src/middlewares/sigma.middlewares.rescale.js View File


src/main/resources/website/src/misc/sigma.misc.animation.js → website/src/misc/sigma.misc.animation.js View File


src/main/resources/website/src/misc/sigma.misc.bindDOMEvents.js → website/src/misc/sigma.misc.bindDOMEvents.js View File


src/main/resources/website/src/misc/sigma.misc.bindEvents.js → website/src/misc/sigma.misc.bindEvents.js View File


src/main/resources/website/src/misc/sigma.misc.drawHovers.js → website/src/misc/sigma.misc.drawHovers.js View File


src/main/resources/website/src/plugins/sigma.exporters.svg/README.md → website/src/plugins/sigma.exporters.svg/README.md View File


src/main/resources/website/src/plugins/sigma.exporters.svg/sigma.exporters.svg.js → website/src/plugins/sigma.exporters.svg/sigma.exporters.svg.js View File


src/main/resources/website/src/plugins/sigma.layout.forceAtlas2/Gruntfile.js → website/src/plugins/sigma.layout.forceAtlas2/Gruntfile.js View File


src/main/resources/website/src/plugins/sigma.layout.forceAtlas2/README.md → website/src/plugins/sigma.layout.forceAtlas2/README.md View File


src/main/resources/website/src/plugins/sigma.layout.forceAtlas2/supervisor.js → website/src/plugins/sigma.layout.forceAtlas2/supervisor.js View File


src/main/resources/website/src/plugins/sigma.layout.forceAtlas2/tasks/forceAtlas2.js → website/src/plugins/sigma.layout.forceAtlas2/tasks/forceAtlas2.js View File


Some files were not shown because too many files changed in this diff

Loading…
Cancel
Save