-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
47 lines (41 loc) · 919 Bytes
/
index.html
File metadata and controls
47 lines (41 loc) · 919 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
<!doctype html>
<html>
<head>
<title>webring demo</title>
<meta charset="utf-8" />
<style type="text/css">
body {
max-width: 80em;
margin: 1em auto;
}
div {
margin-left: 1em;
}
</style>
</head>
<body>
<div id="root"></div>
<script src="webring.js" crossorigin="anonymous"></script>
<script>
const to_id = (from) => {
return from.replaceAll(".", "").replaceAll("/", "");
};
const push = (where, what, prepend = "∟ ") => {
const new_el = document.createElement("div");
new_el.id = to_id(what);
new_el.textContent = `${prepend}${what}`;
document.querySelectorAll(`#${where}`)[0].append(new_el);
};
const root = "webring-plusplus.github.io/client-js";
push("root", root, prepend="⬘ ");
webring(
"webring-plusplus.github.io/client-js",
(uri, peers, depth) => {
peers.forEach((peer) => push(to_id(uri), peer));
console.log(uri, peers, depth);
},
depth=2
);
</script>
</body>
</html>