mirror of
https://git.alemi.dev/fedicharter.git
synced 2024-11-14 12:59:20 +01:00
57 lines
1.5 KiB
HTML
57 lines
1.5 KiB
HTML
|
<!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>
|