-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathscoreboard.html
59 lines (59 loc) · 1.93 KB
/
scoreboard.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
<!DOCTYPE html>
<html>
<header>
<a href="/dashboard">Back</a>
</header>
<body>
<iframe id="database" style="display:none;"></iframe>
<div id="container">
Fetching Data...
</div>
<script src="https://js.pusher.com/7.0/pusher.min.js"></script>
<script>
var embed = document.getElementById("database");
var pusher = new Pusher('127a8a2ca4a3676b2df9', {
cluster: 'us2',
authEndpoint: 'https://DimgreyZigzagProjector--five-nine.repl.co/pusher/auth',
});
var database = document.getElementById("database");
function list(item) {
var channel = pusher.subscribe('database-return2');
channel.bind('list', function(response) {
messages = response.data;
pusher.unsubscribe('database-return2');
});
window.setTimeout(function() {
database.src='https://starlitedatabase.cs641311.repl.co/?task=list&item='+item;
}, 300);
}
setTimeout(function() {
list('playerdata');
}, 1000);
setTimeout(renderResults, 3000);
function renderResults() {
document.getElementById('container').innerHTML = "";
var l = 0;
while(l<messages.length) {
messages[l] = JSON.parse(messages[l])
if (messages[l]['increedible-tanks'] == undefined) {
messages.splice(l, 1);
l--;
}
l++;
}
messages.sort(function(a, b) {
return b['increedible-tanks'].coins - a['increedible-tanks'].coins;
})
var l = 0;
while (l<messages.length) {
if (messages[l]['increedible-tanks'] != undefined) {
var t = document.createElement("DIV");
t.innerHTML = messages[l]["increedible-tanks"].username + ": "+messages[l]["increedible-tanks"].coins;
document.getElementById('container').appendChild(t);
}
l++;
}
}
</script>
</body>
</html>