mirror of
https://git.alemi.dev/fedicharter.git
synced 2024-11-12 20:09:21 +01:00
feat: simple index html file
This commit is contained in:
parent
68cbe3c062
commit
5a4f26f3dd
1 changed files with 56 additions and 0 deletions
56
dist/index.html
vendored
Normal file
56
dist/index.html
vendored
Normal file
|
@ -0,0 +1,56 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<title>akkoma bubble network</title>
|
||||
<script
|
||||
type="text/javascript"
|
||||
src="https://unpkg.com/vis-network/standalone/umd/vis-network.min.js"
|
||||
></script>
|
||||
<style type="text/css">
|
||||
body {
|
||||
background: #111111;
|
||||
}
|
||||
#mynetwork {
|
||||
width: 100%;
|
||||
height: 98vh;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div id="mynetwork"></div>
|
||||
<script type="text/javascript">
|
||||
let nodes_array = []
|
||||
let edges_array = []
|
||||
|
||||
let domain;
|
||||
const urlParams = new URLSearchParams(window.location.search);
|
||||
const domainParam = urlParams.get('domain');
|
||||
if (domainParam) {
|
||||
domain = domainParam;
|
||||
console.log("scanning domain " + domain);
|
||||
} else {
|
||||
domain = "social.alemi.dev";
|
||||
console.log("defaulting to social.alemi.dev");
|
||||
}
|
||||
|
||||
fetch(`https://api.alemi.dev/akkoma/bubble/crawl?domain=${domain}`)
|
||||
.then((res) => res.json().then((graph) => {
|
||||
|
||||
// create an array with nodes
|
||||
var nodes = new vis.DataSet(graph.nodes);
|
||||
|
||||
// create an array with edges
|
||||
var edges = new vis.DataSet(graph.vertices);
|
||||
|
||||
// create a network
|
||||
var container = document.getElementById("mynetwork");
|
||||
var data = {
|
||||
nodes: nodes,
|
||||
edges: edges,
|
||||
};
|
||||
var options = { edges: { dashes: true }, nodes: { color: "#bf616a", shape: "box" }};
|
||||
var network = new vis.Network(container, data, options);
|
||||
}))
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
Loading…
Reference in a new issue