mirror of
https://github.com/clusterio/clusterio.git
synced 2026-11-18 15:33:12 +09:00
Added webpage to display network contents
This commit is contained in:
1 parent
8ea74821b4
commit
410b3e5e53
4 files changed
+97
-8
No files matched your search
+1
-8
@@ -1,11 +1,4 @@
|
||||
{"name":"raw-fish","count":"2","_id":"a0TVkMwP8M99LLbp"}
|
||||
{"name":"iron-ore","count":26524,"_id":"bEcyT728rLO8JvqY"}
|
||||
{"name":"\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000iron-ore","count":8,"_id":"i6fEF857vuxZpRfw"}
|
||||
{"name":"iron-ore","count":25823,"_id":"bEcyT728rLO8JvqY"}
|
||||
{"name":"electronic-circuit","count":200,"_id":"n3JBn8ksl9YIkCWy"}
|
||||
{"name":"coal","count":10406,"_id":"qnEjvk1EypjWAEQk"}
|
||||
{"name":"\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000iron-ore","count":4,"_id":"xOe2eh4SbnodgQG2"}
|
||||
{"name":"iron-ore","count":26523,"_id":"bEcyT728rLO8JvqY"}
|
||||
{"name":"iron-ore","count":26522,"_id":"bEcyT728rLO8JvqY"}
|
||||
{"name":"iron-ore","count":26513,"_id":"bEcyT728rLO8JvqY"}
|
||||
{"name":"iron-ore","count":26423,"_id":"bEcyT728rLO8JvqY"}
|
||||
{"name":"iron-ore","count":25823,"_id":"bEcyT728rLO8JvqY"}
|
||||
@@ -0,0 +1,30 @@
|
||||
<doctype HTML>
|
||||
<head>
|
||||
<title>Clusterio</title>
|
||||
<link rel="stylesheet" type="text/css" href="style.css">
|
||||
<script src="main.js"></script>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div id="header">
|
||||
|
||||
</div>
|
||||
<div id="sidenav">
|
||||
<div id="logo">
|
||||
<h1>Clusterio</h1>
|
||||
</div>
|
||||
<div id="storage" class="button-black">
|
||||
<p>Storage</p>
|
||||
</div>
|
||||
<div id="production" class="button-black">
|
||||
<p>Production</p>
|
||||
</div>
|
||||
</div>
|
||||
<div id="body">
|
||||
<div id="storage">
|
||||
<h2>Storage</h2>
|
||||
<div id="contents">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
@@ -0,0 +1,27 @@
|
||||
|
||||
|
||||
contents = {
|
||||
"iron-plate":100,
|
||||
"copper-plate":7312,
|
||||
}
|
||||
|
||||
function drawcontents(data) {
|
||||
keys = Object.keys(data);
|
||||
result = "<table>";
|
||||
for(i = 0;i < data.length; i++) {
|
||||
result = result + "<tr><td>" + data[i].name + "</td><td>" + data[i].count + "</td></tr>";
|
||||
}
|
||||
result = result + "</table>"
|
||||
document.getElementById("contents").innerHTML = result;
|
||||
}
|
||||
setInterval(function() {
|
||||
var xmlhttp = new XMLHttpRequest();
|
||||
xmlhttp.onreadystatechange = function() {
|
||||
if(xmlhttp.readyState == 4 && xmlhttp.status == 200) {
|
||||
data = JSON.parse(xmlhttp.responseText);
|
||||
drawcontents(data);
|
||||
}
|
||||
}
|
||||
xmlhttp.open("GET", "inventory", true);
|
||||
xmlhttp.send();
|
||||
}, 500)
|
||||
@@ -0,0 +1,39 @@
|
||||
* {
|
||||
margin:0px;
|
||||
}
|
||||
|
||||
#logo {
|
||||
background-color: yellow;
|
||||
}
|
||||
|
||||
#sidenav {
|
||||
position:fixed;
|
||||
left:0px;
|
||||
width:200px;
|
||||
background-color:darkgrey;
|
||||
height:100%;
|
||||
}
|
||||
#body {
|
||||
margin-left:200px;
|
||||
}
|
||||
#contents table {
|
||||
border: 1px solid black;
|
||||
}
|
||||
.button-black {
|
||||
width:100%;
|
||||
height:40px;
|
||||
background-color:black;
|
||||
color:white;
|
||||
transition: all 300ms;
|
||||
}
|
||||
.button-black:hover {
|
||||
background-color:#444;
|
||||
color:yellow;
|
||||
cursor:pointer;
|
||||
}
|
||||
.button-black * {
|
||||
text-align:center;
|
||||
position: relative;
|
||||
top: 50%;
|
||||
transform: translateY(-50%);
|
||||
}
|
||||
Reference in new issue
Block a user