IW4M-Admin/Admin/webfront/header.html

146 lines
4.1 KiB
HTML

<!DOCTYPE html>
<html lang="en" xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta charset="utf-8" />
<title>IW4MAdmin by RaidMax</title>
<meta name="description" content="Administration tool for IW4M servers. Created by RaidMax">
<link href='https://fonts.googleapis.com/css?family=Open+Sans' rel='stylesheet' type='text/css'>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.2.4/jquery.min.js"></script>
<script src="https://use.fontawesome.com/9c581fe29b.js"></script>
<link rel="stylesheet" type="text/css" href="/webfront/main.css"/>
<link rel="stylesheet" type="text/css" href="/webfront/mobile.css"/>
</head>
<script>
var user;
$.getJSON("_userinfo", function(response) {
user = response;
$(document).trigger("actionEventLoad");
});
function showErrorMessage(msg)
{
$('.alertBox').html(msg).addClass('error').slideDown("fast");
}
function parseGet(val) {
var result = "undefined",
tmp = [];
location.search
.substr(1)
.split("&")
.forEach(function (item) {
tmp = item.split("=");
if (tmp[0] === val) result = decodeURIComponent(tmp[1]);
});
return result;
}
function getColorForLevel(level, name)
{
switch (level)
{
case "User":
case "Guest":
return "<span style='color: rgba(255, 255, 255, 0.85);'>" + name + "</span>";
case "Trusted":
case "Kick":
case "User":
return "<span style='color: rgba(116,147,99,1);''>" + name + "</span>";
case "Flagged":
case "TempBan":
return "<span style='color: rgba(253, 139, 22, 0.85);'>" + name + "</span>";
case "Banned":
case "Ban":
case "Console":
return "<span style='color: rgba(255, 69, 69, 0.85);'>" + name + "</span>";
case "Moderator":
case "Warning":
return "<span style='color: rgba(235, 211, 101, 0.75);'>" + name + "</span>";
case "Administrator":
return "<span style='color: rgba(236, 130, 222, 0.69);'>" + name + "</span>";
case "SeniorAdmin":
return "<span style='color: rgba(50, 177, 185, 0.85);'>" + name + "</span>";
case "Owner":
return "<span style='color: rgb(0, 122, 204);'>" + name + "</span>";
}
}
function formatMessages(messages)
{
var chats = "";
$.each(messages, function(i, chat) {
chats +=
"<div class='chatPlayerName tableCell'>" + chat['Name'] + ":</div><div class='chatPlayerMessage tableCell'>" + $("<div/>").html(chat['Message']).text() + "</div> \
<div style='display:table-row'></div>"
});
return chats;
}
function getPages()
{
$.getJSON("/pages", function(result){
$.each(result, function(i, page){
if (page['visible'] == true)
$("#navContainer").append("<div class=navEntry><a href=\"" + page['pagePath'] + "\">" + page['pageName'] + "</a></div>");
});
});
}
function shouldHideAction(author)
{
// fixme dynamic
if (user.rank == null || author.ranking == null)
return " display: none";
else if (user.rank.name == "Moderator" || user.rank.name == "Administrator" || user.username == author.username)
return "";
else {
return " display: none";
}
}
function formatPlayers(players)
{
var p = "";
for (i = 0; i < players.length; i++)
{
p += "<div class='playerName tableCell'><a href=\"/players?id=" + players[1*i]['playerID'] + "\">" + getColorForLevel(players[1*i]['playerLevel'], players[1*i]['playerName']) + "</a></div>";
if (i % 2 == 1 && i != 0 )
p += "<div style='display: table-row'></div>";
}
return p;
}
function checkJustNow(timestr)
{
if (timestr.includes("just now"))
return timestr;
else
return timestr + " ago";
}
function getDate(datestr)
{
var creationDate = new Date(datestr);
return (creationDate.getMonth() + 1) + '-' + creationDate.getDate() + '-' + creationDate.getFullYear();
}
function checkPrivilege()
{
$.getJSON("_userinfo", function(response) { if (response.rank.id != 1) window.location.replace("home"); else $('.infoBox').show(); });
}
</script>
<body>
<div id="header">
<div id="navContainer">
<div id="navHeader">IW4MAdmin</div>
</div>
</div>
<div class="loader"></div>
<div id="content">