mirror of
https://github.com/overte-org/overte.git
synced 2025-04-29 19:42:36 +02:00
99 lines
No EOL
3.2 KiB
HTML
99 lines
No EOL
3.2 KiB
HTML
<!--
|
|
// users.html
|
|
//
|
|
// Created by Faye Li on 18 Jan 2017
|
|
// Copyright 2017 High Fidelity, Inc.
|
|
//
|
|
// Distributed under the Apache License, Version 2.0.
|
|
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
|
-->
|
|
<html>
|
|
<head>
|
|
<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:300,400,600,700"" rel="stylesheet">
|
|
<style>
|
|
body {
|
|
margin: 0;
|
|
width: 100%;
|
|
font-family: 'Raleway', sans-serif;
|
|
color: white;
|
|
background: linear-gradient(#2b2b2b, #0f212e);
|
|
}
|
|
|
|
.top-bar {
|
|
width: 100%;
|
|
height: 90px;
|
|
background: linear-gradient(#2b2b2b, #1e1e1e);
|
|
font-weight: bold;
|
|
}
|
|
|
|
.top-bar .container{
|
|
display: flex;
|
|
justify-content: space-between;
|
|
align-items: center;
|
|
margin-left: 30px;
|
|
margin-right: 30px;
|
|
height: 100%;
|
|
}
|
|
|
|
.main {
|
|
padding: 30px;
|
|
}
|
|
|
|
#users-list div {
|
|
padding-top: 4px;
|
|
padding-bottom: 4px;
|
|
}
|
|
|
|
</style>
|
|
</head>
|
|
<body>
|
|
<div class="top-bar">
|
|
<div class="container">
|
|
<div>Users Online</div>
|
|
<button type="button" onclick="pollUsers()">Refresh</button>
|
|
</div>
|
|
</div>
|
|
<div class="main">
|
|
<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) {
|
|
console.log(response);
|
|
displayUsers(response.data);
|
|
}
|
|
});
|
|
}
|
|
|
|
function onScriptEventReceived(event) {
|
|
// TODO: event handling
|
|
}
|
|
|
|
$(document).ready(function() {
|
|
$("#dev-div").html("ready");
|
|
// Send a ready event to hifi
|
|
EventBridge.emitWebEvent("ready");
|
|
// Listen for events from hifi
|
|
EventBridge.scriptEventReceived.connect(onScriptEventReceived);
|
|
});
|
|
</script
|
|
</body>
|
|
</html> |