mirror of
https://github.com/Armored-Dragon/overte.git
synced 2025-03-11 16:13:16 +01:00
display all online users
This commit is contained in:
parent
23269c2efb
commit
bbed26c8fa
1 changed files with 18 additions and 3 deletions
|
@ -12,7 +12,7 @@
|
|||
<title>Users Online</title>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<link href="https://fonts.googleapis.com/css?family=Raleway" rel="stylesheet">
|
||||
<link href="https://fonts.googleapis.com/css?family=Raleway:300,400,600,700"" rel="stylesheet">
|
||||
<style>
|
||||
body {
|
||||
margin: 0;
|
||||
|
@ -26,6 +26,7 @@
|
|||
width: 100%;
|
||||
height: 90px;
|
||||
background: linear-gradient(#2b2b2b, #1e1e1e);
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.top-bar .container{
|
||||
|
@ -41,6 +42,11 @@
|
|||
padding: 30px;
|
||||
}
|
||||
|
||||
#users-list div {
|
||||
padding-top: 4px;
|
||||
padding-bottom: 4px;
|
||||
}
|
||||
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
|
@ -51,19 +57,28 @@
|
|||
</div>
|
||||
</div>
|
||||
<div class="main">
|
||||
<div id="dev-div"></div>
|
||||
<div id="users-list"></div>
|
||||
</div>
|
||||
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script>
|
||||
<script>
|
||||
var METAVERSE_API_URL = "https://metaverse.highfidelity.com/api/v1/users?status=online";
|
||||
|
||||
function displayUsers(data) {
|
||||
$("#users-list").empty();
|
||||
for (var i = 0; i < data.users.length; i++) {
|
||||
console.log(data.users[i].username + " @ " + data.users[i].location.root.name);
|
||||
$("#users-list").append("<div>" + data.users[i].username + " @ " + data.users[i].location.root.name + "</div>");
|
||||
}
|
||||
}
|
||||
|
||||
function pollUsers() {
|
||||
// TODO: better transition visual such as spin wheel or loading bar
|
||||
$("#dev-div").html("polling users");
|
||||
$.ajax({
|
||||
url: METAVERSE_API_URL,
|
||||
success: function(response) {
|
||||
$("#dev-div").html(JSON.stringify(response.data));
|
||||
console.log(response);
|
||||
displayUsers(response.data);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue