2017-11-19 01:44:11 -05:00
|
|
|
|
2017-05-26 18:49:27 -04:00
|
|
|
<script>
|
2017-11-19 01:44:11 -05:00
|
|
|
function escapeHtml(unsafe) {
|
|
|
|
return unsafe
|
2018-02-16 23:24:03 -05:00
|
|
|
.replace(/&/g, "&")
|
|
|
|
.replace(/</g, "<")
|
|
|
|
.replace(/>/g, ">")
|
|
|
|
.replace(/"/g, """)
|
|
|
|
.replace(/'/g, "'");
|
2017-11-19 01:44:11 -05:00
|
|
|
}
|
|
|
|
|
2017-11-04 19:42:31 -04:00
|
|
|
var curFrom = 0;
|
|
|
|
|
|
|
|
function getNextPage() {
|
|
|
|
curFrom += 15;
|
|
|
|
return curFrom;
|
|
|
|
}
|
|
|
|
|
|
|
|
function getPrevPage() {
|
|
|
|
if ((curFrom - 15) >= 0) {
|
|
|
|
curFrom -= 15;
|
2017-11-19 01:44:11 -05:00
|
|
|
return (curFrom);
|
2017-11-04 19:42:31 -04:00
|
|
|
}
|
2017-11-19 01:44:11 -05:00
|
|
|
else {
|
|
|
|
curFrom = 0;
|
2017-11-04 19:42:31 -04:00
|
|
|
return 0;
|
2017-11-19 01:44:11 -05:00
|
|
|
}
|
2017-05-27 00:22:50 -04:00
|
|
|
}
|
|
|
|
|
2017-11-04 19:42:31 -04:00
|
|
|
function printPlayer(player, i) {
|
|
|
|
var p = "";
|
|
|
|
p +=
|
2018-02-16 23:24:03 -05:00
|
|
|
"<div class=\"playerInfo table alternate_" + i % 2 + "\"> \
|
2018-02-14 14:01:26 -05:00
|
|
|
<div class=\"tableCell\"><a href=\"/profile?id=" + player['playerID'] + "\">" + escapeHtml(player['playerName']) + "</a></div> \
|
2018-02-16 23:24:03 -05:00
|
|
|
<div class=\"tableCell\">" + getColorForLevel(player['playerLevel'], player['playerLevel']) + "</div>";
|
2017-11-04 19:42:31 -04:00
|
|
|
|
2017-05-27 00:22:50 -04:00
|
|
|
p +=
|
2018-02-16 23:24:03 -05:00
|
|
|
"<div class=\"tableCell alignRight\">" + checkJustNow(player['LastSeen']) + " ago</div> \
|
2017-11-04 19:42:31 -04:00
|
|
|
</div>";
|
|
|
|
|
|
|
|
$("#playersTable").append(p);
|
2017-05-27 00:22:50 -04:00
|
|
|
}
|
|
|
|
|
2017-11-04 19:42:31 -04:00
|
|
|
function getPlayer(ident, identValue) {
|
|
|
|
$("#playersTable").html("");
|
|
|
|
$(".loader").fadeIn();
|
2017-05-27 00:22:50 -04:00
|
|
|
|
2017-11-04 19:42:31 -04:00
|
|
|
$.getJSON("/getplayer?" + ident + "=" + identValue, function (result) {
|
|
|
|
$.each(result, function (i, player) {
|
|
|
|
printPlayer(player, i);
|
|
|
|
});
|
2018-02-16 23:24:03 -05:00
|
|
|
}).done(function (data) {
|
|
|
|
$(".loader").fadeOut();
|
|
|
|
}).fail(function () {
|
|
|
|
$(".loader").fadeOut();
|
|
|
|
});
|
2017-05-26 18:49:27 -04:00
|
|
|
}
|
|
|
|
|
2017-11-18 01:59:37 -05:00
|
|
|
function getRecentPlayers(offset) {
|
|
|
|
$("#playersTable").html("");
|
|
|
|
$(".loader").fadeIn();
|
|
|
|
|
|
|
|
$.getJSON("/getplayer?recent=1&offset=" + offset, function (result) {
|
|
|
|
$.each(result, function (i, player) {
|
|
|
|
printPlayer(player, i);
|
|
|
|
});
|
2017-11-19 01:44:11 -05:00
|
|
|
}).done(function (data) { $(".loader").fadeOut(); })
|
2018-02-16 23:24:03 -05:00
|
|
|
.error(function (data) { $(".loader").fadeOut(); })
|
2017-11-18 01:59:37 -05:00
|
|
|
}
|
|
|
|
|
2017-11-04 19:42:31 -04:00
|
|
|
$(document).ready(function () {
|
|
|
|
if (parseGet('id') != "undefined")
|
|
|
|
getPlayer('id', parseGet('id'));
|
|
|
|
else if (parseGet('name') != "undefined")
|
|
|
|
getPlayer('name', parseGet('name'));
|
|
|
|
else {
|
2017-11-18 01:59:37 -05:00
|
|
|
getRecentPlayers(0);
|
2017-11-04 19:42:31 -04:00
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
$('#content').on('click', 'div.hiddenWrapper span', function () {
|
|
|
|
$(this).parent().find('.hiddenElements').toggle()
|
|
|
|
});
|
2017-05-26 18:49:27 -04:00
|
|
|
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<div class="playerSearchWrap">
|
2017-11-04 19:42:31 -04:00
|
|
|
<input type="button" class="searchButton" name="Search" value="Search" />
|
|
|
|
<input type="text" class="search" placeholder="Player Name..." />
|
2017-05-26 18:49:27 -04:00
|
|
|
</div>
|
|
|
|
|
|
|
|
<div class="contentHeader table">
|
2017-11-04 19:42:31 -04:00
|
|
|
<div class="contentColumn tableCell">Name</div>
|
|
|
|
<div class="contentColumn tableCell">Level</div>
|
|
|
|
<div class="contentColumn tableCell alignRight">Last Seen</div>
|
2017-05-26 18:49:27 -04:00
|
|
|
</div>
|
|
|
|
<div id="playersTable">
|
|
|
|
</div>
|
2017-11-04 19:42:31 -04:00
|
|
|
<hr />
|
2017-05-26 18:49:27 -04:00
|
|
|
|
2017-11-18 01:59:37 -05:00
|
|
|
<div id="paginationButtons" class="table">
|
|
|
|
<div id="previousPage" class="tableCell"><a href=# onclick="getRecentPlayers(getPrevPage())"><<</a></div>
|
|
|
|
<div id="nextPage" class="tableCell"><a href=# onclick="getRecentPlayers(getNextPage())">>></a></div>
|
|
|
|
</div>
|
|
|
|
|
2017-05-26 18:49:27 -04:00
|
|
|
<script>
|
2017-11-04 19:42:31 -04:00
|
|
|
$('.searchButton').click(function () {
|
|
|
|
if ($('.search').val().length > 0)
|
|
|
|
getPlayer('name', $('.search').val());
|
|
|
|
});
|
|
|
|
|
|
|
|
$(document).keypress(function (e) {
|
|
|
|
if (e.which == 13) {
|
|
|
|
$('.searchButton').click();
|
|
|
|
}
|
|
|
|
});
|
2017-05-26 18:49:27 -04:00
|
|
|
</script>
|