mirror of
https://git.alemi.dev/fedicharter.git
synced 2024-11-12 20:09:21 +01:00
fix: oops was old index
This commit is contained in:
parent
dbf679ab7f
commit
ee8a3888e9
1 changed files with 34 additions and 62 deletions
96
index.html
96
index.html
|
@ -1,68 +1,40 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<style>
|
||||
body {
|
||||
color: #eeeeee;
|
||||
background-color: #111111;
|
||||
font-family: monospace;
|
||||
}
|
||||
h1 {
|
||||
color: #bf616a;
|
||||
}
|
||||
input[type="text"] {
|
||||
color: #bf616a;
|
||||
background-color: #111111;
|
||||
border: solid;
|
||||
border-width: 1px;
|
||||
outline: none;
|
||||
font-family: monospace;
|
||||
}
|
||||
input[type="submit"] {
|
||||
border: 0;
|
||||
background: #111111;
|
||||
box-shadow: none;
|
||||
border: solid;
|
||||
border-width: 1px;
|
||||
color: #bf616a;
|
||||
margin: 5px;
|
||||
padding-top: 2px;
|
||||
padding-bottom: 3px;
|
||||
cursor: pointer;
|
||||
}
|
||||
</style>
|
||||
<html>
|
||||
<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;
|
||||
}
|
||||
#netgraph {
|
||||
width: 100%;
|
||||
height: 98vh;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div id="netgraph">
|
||||
<h3 style="text-align: center;" id="loader"><font color="#BF616A">crunching fedi network data, be patient...</font></h3>
|
||||
</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 = window.prompt("starting instance for charting", "ihatebeinga.live");
|
||||
}
|
||||
|
||||
fetch(`https://api.alemi.dev/akkoma/bubble/crawl?domain=${domain}`)
|
||||
.then((res) => res.json().then((graph) => {
|
||||
const palette = [
|
||||
'#81A1C1',
|
||||
'#5B6EA3',
|
||||
'#7468B0',
|
||||
'#84508C',
|
||||
'#AF875F',
|
||||
'#EBCB8B',
|
||||
'#2E8757',
|
||||
'#05979A',
|
||||
]
|
||||
for (const i in graph[0]) {
|
||||
if (graph[0][i].title === domain) { graph[0][i].color = '#BF616A' }
|
||||
else { graph[0][i].color = palette[Math.floor(Math.random() * palette.length)] }
|
||||
}
|
||||
|
||||
const nodes = new vis.DataSet(graph[0]);
|
||||
const edges = new vis.DataSet(graph[1]);
|
||||
|
||||
// create a network
|
||||
const container = document.getElementById("netgraph");
|
||||
const data = {
|
||||
nodes: nodes,
|
||||
edges: edges,
|
||||
};
|
||||
const options = { edges: { dashes: true, arrows: 'to' }, nodes: { color: "#bf616a", shape: "box", scaling: { min: 1, max: 500, label: { enabled: true, min: 14, max: 56 }}}};
|
||||
const network = new vis.Network(container, data, options);
|
||||
}))
|
||||
</script>
|
||||
<h1>fediverse navigator</h1>
|
||||
<h3>heavily under construction</h3>
|
||||
<div id="#app"></div>
|
||||
</body>
|
||||
</html>
|
||||
|
|
Loading…
Reference in a new issue