fix: move html dir

This commit is contained in:
Diavolo committed 2023-01-08 10:16:08 +01:00
1 parent 38206c025e
commit 0802f5fd1c
5 files changed
-12

No files matched your search

Binary file not shown.

After

Width:  |  Height:  |  Size: 416 KiB

+42
View File
@@ -0,0 +1,42 @@
<!doctype html>
<html>
<head>
<meta charset="utf-8" />
<script src="https://code.jquery.com/jquery-2.2.4.min.js"></script>
<script src="script.js"></script>
<link rel="stylesheet" href="style.css">
<!-- This will be updated dynamically -->
<title>IW4x Server</title>
</head>
<body>
<h1 id="header">Welcome to <span id="servername">IW4x Server</span></h1>
<table id="serverinfo">
<thead>
<tr>
<th colspan="3">Serverinfo</th>
</tr>
</thead>
</table>
<span id="connect">Connect</span>
<table id="playertable">
<thead>
<tr>
<th>Player</th>
<th>Score</th>
<th>Ping</th>
</tr>
</thead>
<tbody id="players">
</tbody>
</table>
<!-- <div id="footer">
Get IW4x!
</div> -->
</body>
</html>
+112
View File
@@ -0,0 +1,112 @@
window.address = location.hostname + (location.port ? ':' + location.port : '');
window.origin = location.protocol + '//' + window.address;
function toBool (data)
{
if (data > 0)
{
return "Yes";
}
return "No";
}
function getFfType (data)
{
switch(data)
{
case 0:
return "Disabled";
break;
case 1:
return "Enabled";
break;
case 2:
return "Reflected";
break;
case 3:
return "Shared";
break;
default:
return "Disabled";
}
}
function getServerInfo(status, countPlayers)
{
var friendlyFire = status.scr_team_fftype;
var mod = status.fs_game;
if (!mod)
{
mod = "";
}
var row = "<tr>";
row += "<td><b>Map:</b> " + status.mapname + "</td><td><b>Gametype:</b> " + status.g_gametype + "</td><td><b>Players:</b> " + countPlayers + "/" + status.sv_maxclients + "</td>";
row += "</tr><tr>"
row += "<td><b>Mod:</b> " + mod.replace(/^mods\//g, "") + "</td><td><b>Security Level:</b> " + status.sv_securityLevel + "</td><td><b>Password Protected:</b> " + toBool(status.isPrivate) + "</td>";
row += "</tr><tr>"
row += "<td><b>Hardcore Mode:</b> " + toBool(status.g_hardcore) + "</td><td><b>KillCam:</b> " + toBool(status.scr_game_allowkillcam) + "</td><td><b>Friendly Fire:</b> " + getFfType(status.scr_team_fftype) + "</td>";
row += "</tr>"
$("#serverinfo").append(row);
}
function buildPlayerList(players)
{
for (var i = 0; i < players.length; ++i)
{
var row = "<tr>";
row += "<td>" + players[i].name + "</td>";
row += "<td>" + players[i].score + "</td>";
row += "<td>" + players[i].ping + "</td>";
row += "</tr>";
$("#players").append(row);
}
if (players.length == 0)
{
$("#playertable").fadeOut(1);
}
}
function buildPage(data)
{
// Get dvar sv_hostname and remove color codes
var hostname = (data["status"]["sv_hostname"]).replace(/\^[0-9:;c]/g, "");
// Set title
document.title = hostname
$("#servername").text(document.title);
//$("#info").text(JSON.stringify(data));
getServerInfo(data["status"], data["players"].length);
buildPlayerList(data["players"]);
$('body').fadeIn(300);
}
$(document).ready(function()
{
$("#connect").click(function()
{
location.replace("iw4x://" + window.address);
});
$.getJSON(origin + "/info", function(data)
{
console.log(data);
setTimeout(buildPage.bind(undefined, data), 10);
}).fail(function()
{
alert("An error occured while updating the server information!");
});
$("#footer").click(function()
{
location.replace("https://iw4xcachep26muba.onion.to");
});
});
+94
View File
@@ -0,0 +1,94 @@
@import url(https://fonts.googleapis.com/css?family=Open+Sans:400,300);
html,
body {
margin: 0;
font-family: 'Open Sans', sans-serif;
}
body {
display: none;
text-align: center;
background-color: white;
background-repeat: no-repeat;
background-size: cover;
background-image: url("img/background_default.png");
color: #fafafa;
}
body> h1,
body> table,
body thead,
body tr,
body th {
margin: auto;
text-align: center;
}
body> table {
width: 90%;
border-collapse: collapse;
border: 1px solid rgba(250, 250, 250, 0.6);
background-color: rgba(100, 100, 100, 0.4);
border: none;
}
body th,
body td {
width: 33%;
border: 1px solid rgba(250, 250, 250, 0.6);
}
body th {
font-size: 20px;
}
#header {
margin-top: 20px;
font-weight: bold;
}
#connect {
margin: auto;
text-align: center;
cursor: pointer;
color: #fafafa;
background-color: rgba(100, 100, 100, 0.4);
padding-left: 12px;
padding-right: 12px;
padding-top: 3px;
padding-bottom: 3px;
font-size: 24px;
}
#connect:hover {
color: black;
background-color: transparent;
}
#serverinfo {
margin-top: 40px;
margin-bottom: 40px;
}
#serverinfo td {
padding-left: 10px;
text-align: left;
}
#playertable {
margin-top: 40px;
}
#footer {
position: absolute;
bottom: 0;
padding-bottom: 10px;
width: 100%;
overflow: hidden;
cursor: pointer;
color: #fafafa;
}
#footer:hover {
color: black;
}