You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
60 lines
2.1 KiB
HTML
60 lines
2.1 KiB
HTML
<!--
|
|
TerranQuest - Augmented Reality fantasy game
|
|
|
|
Copyright 2016 Netsyms Technologies
|
|
|
|
Licensed under the Apache License, Version 2.0 (the "License");
|
|
you may not use this file except in compliance with the License.
|
|
You may obtain a copy of the License at
|
|
|
|
http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
Unless required by applicable law or agreed to in writing, software
|
|
distributed under the License is distributed on an "AS IS" BASIS,
|
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
See the License for the specific language governing permissions and
|
|
limitations under the License.
|
|
-->
|
|
<div class="scrollable-box">
|
|
<h4>Players</h4>
|
|
<div class="list-group" id="nearby-people-list">
|
|
<div class="list-group-item">
|
|
<i class="fa fa-spinner fa-pulse fa-fw"></i> Loading...
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<script>
|
|
function getpeoplehtmlfromjson(person) {
|
|
var peoplehtml = "<div class='list-group-item nearby-item' id='nearby-person-" + person.uuid + "'>"
|
|
+ "<h4 class='nearbyname'>" + person.name + "</h4>"
|
|
+ "<p class='nearbyteam' style='color: #" + getTeamColorFromId(person.team) + ";'>" + getTeamNameFromId(person.team) + "</p>"
|
|
+ "</div>";
|
|
return peoplehtml;
|
|
}
|
|
|
|
function loadnearby() {
|
|
$.getJSON(mkApiUrl('nearby'), {
|
|
lat: latitude,
|
|
long: longitude
|
|
}, function (data) {
|
|
var content = "";
|
|
if (data.status === 'OK') {
|
|
var people = data.people;
|
|
people.forEach(function (person) {
|
|
if (person.name !== username) {
|
|
content += getpeoplehtmlfromjson(person);
|
|
}
|
|
});
|
|
} else {
|
|
content = "<div class='list-group-item'>An error occurred.</div>";
|
|
}
|
|
if (content == '') {
|
|
content = "<div class='list-group-item'>There's nobody else here...</div>";
|
|
}
|
|
$('#nearby-people-list').html(content);
|
|
});
|
|
}
|
|
|
|
loadnearby();
|
|
</script> |