forked from steveseguin/vdo.ninja
-
Notifications
You must be signed in to change notification settings - Fork 0
/
regions.html
94 lines (80 loc) · 1.91 KB
/
regions.html
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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
<html>
<head>
<style>
div {
padding:10px;
}
body {
font-family: verdana, tahoma, arial;
margin:10px;
background: #0021;
}
#main>div div:nth-child(even) {
background: #0001;
}
.entry {
display:block;
}
.content {
display:block;
}
.avatar {
display:inline-block;
max-height:32px;
max-width:32px;
vertical-align: top;
border-radius: 32px;
margin: 3px;
margin-right: 4px;
}
.name {
display:inline-block;
font-weight: bold;
vertical-align: top;
}
.time {
display: inline-block;
font-style: italic;
font-size: 11px;
position: relative;
top: 4px;
vertical-align: top;
}
div:empty {
display:none;
}
</style>
<title>Regions for VDO.Ninja Tech Check</title>
</head>
<body>
<div id="main">
<h1>Testing Regions for <a href="https://vdo.ninja/alpha/check" target="_blank">VDO.Ninja Tech Check</a>
</div>
<script>
var data = fetch("https://turnservers.vdo.ninja/regions?ts="+Date.now()).then((response) => response.json())
.then((data) => {
data = data.servers;
data.forEach(message => {
console.log(message);
var ele = document.createElement("div");
ele.className = "entry";
var name = document.createElement("div");
name.innerText = message.name;
name.className = "name";
ele.appendChild(name);
var distance = document.createElement("div");
distance.className = "time";
distance.innerText = message.distance + " km away";
ele.appendChild(distance);
var content = document.createElement("div");
// do some basic formatting replacements
var msgCnt = "<a href='https://vdo.ninja/alpha/check?region="+message.locale+"'>https://vdo.ninja/alpha/check?region="+message.locale+"</a>";
content.innerHTML = msgCnt;
content.className = "content";
ele.appendChild(content);
document.getElementById("main").appendChild(ele);
});
});
</script>
</body>
</html>