IW4M-Admin/Admin/webfront/players.html

111 lines
3.2 KiB
HTML
Raw Normal View History

<script>
var curFrom = 0;
function getNextPage()
{
curFrom += 15;
return curFrom;
}
function getPrevPage()
{
if ((curFrom - 15) >= 0)
{
curFrom -= 15;
return (curFrom - 15);
}
else
return 0;
}
function formatHidden(data)
{
var p = "<div class=\"hiddenWrapper\">Expand<div class=\"hiddenElements\">";
$.each(data, function(i, dat) {
p += "<span>" + dat + "</span><br/>"
})
p += "</div></div>"
return p;
}
function printPlayer(player, i)
{
$("#playersTable").append(
"<div class=\"playerInfo table alternate_" + i % 2 + "\"> \
<div class=\"tableCell\"><a href=\"/players?id="+ player['playerID'] + "\">" + player['playerName'] + "</a></div> \
<div class=\"tableCell\">"+ formatHidden(player['playerAliases']) + "</div> \
<div class=\"tableCell\">"+ formatHidden(player['playerIPs']) + "</div> \
<div class=\"tableCell\">"+ getColorForLevel(player['playerLevel'], player['playerLevel']) + "</div> \
<div class=\"tableCell\">"+ player['playerConnections'] + "</div> \
<div class=\"tableCell actionButton\" style='width: 2em;'> \
<a target=\"_blank\" href='http://server.nbsclan.org/screen.php?id=" + player.forumID+ "&name=" + player.playerName + "'> \
<i class=\"fa fa-camera\" aria-hidden=\"true\"></i> \
</a> \
<a target=\"_blank\" href='https://v2.mcsebi.ru/memberlist.php?mode=viewprofile&u=" + player.forumID + "'> \
<i class=\"fa fa-user tableCell\" aria-hidden=\"true\"></i> \
</a> \
</div> \
<div class=\"tableCell alignRight\">"+ checkJustNow(player['lastSeen']) + "</div> \
</div>"
)
}
function getPlayer(ident, identValue)
{
$("#playersTable").html("");
$(".loader").fadeIn();
$.getJSON("/getplayer?" + ident + "=" + identValue, function(result) {
$.each(result, function(i, player) {
printPlayer(player, i);
});
}).done(function (data) { $(".loader").fadeOut(); });
}
$( document ).ready(function() {
if (parseGet('id') != "undefined")
getPlayer('id', parseGet('id'));
else if (parseGet('name') != "undefined")
getPlayer('name', parseGet('name'));
else {
getPlayer('recent', '1');
}
});
$('#content').on('click', '.hiddenWrapper', function(){
$(this).find('.hiddenElements').toggle()
});
</script>
<div class="playerSearchWrap">
<input type="button" class="searchButton" name="Search" value="Search"/>
<input type="text" class="search" placeholder="Player Name..."/>
</div>
<div class="contentHeader table">
<div class="contentColumn tableCell">Name</div>
<div class="contentColumn tableCell">Aliases</div>
<div class="contentColumn tableCell">IP</div>
<div class="contentColumn tableCell">Level</div>
<div class="contentColumn tableCell">Connections</div>
<div class="contentColumn tableCell" style="width: 1em;">V2</div>
<div class="contentColumn tableCell alignRight">Last Seen</div>
</div>
<div id="playersTable">
</div>
<hr/>
<script>
$('.searchButton').click(function() {
if ($('.search').val().length > 0)
getPlayer('name', $('.search').val());
});
$(document).keypress(function(e) {
if(e.which == 13) {
$('.searchButton').click();
}
});
</script>