first wave of static assets

This commit is contained in:
Stephen McQuay 2015-08-26 23:15:53 -07:00
parent 77f9f8033b
commit 6797c134d1
3 changed files with 162 additions and 0 deletions

74
ui/css/hackerbots.css Normal file
View File

@ -0,0 +1,74 @@
body {
background: #333;
color: #888;
font-family: Helvetica, Sans-Serif;
}
.error {
background-color: #993333;
color: #cccccc;
}
.under-button {
font-variant: small-caps;
font-size: 8pt;
text-align: center;
}
.health {
height: 5px;
background-color: #55FF55;
width: 100%;
}
canvas {
border: 3px solid black;
width: 100%;
height: 100%;
background-color: #888;
}
.ace_editor {
position: relative !important;
/*border: 1px solid lightgray;*/
/*height: 600px;*/
/*width: 85%;*/
font-family: "Monaco", "Menlo", "Ubuntu Mono", "Droid Sans Mono", "Consolas", monospace !important;
font-size: 12px !important;
font-weight: 400 !important;
letter-spacing: 0 !important;
}
.debug {
background-color: #888;
margin-top: 30px;
width: 80%;
}
.center {
margin: auto;
}
.label {
position: absolute;
border: 2px solid;
padding-top: 1px;
padding-bottom: 1px;
padding-left: 4px;
padding-right: 4px;
border-color: #666666;
border-radius: 7px;
font-variant: small-caps;
font-size: 9pt;
}
.step {
position: relative;
width: 900px;
padding: 40px;
margin: 20px auto;
/*font-family: 'PT Serif', georgia, serif;*/
font-size: 48px;
line-height: 1.5;
}

28
ui/index.html Normal file
View File

@ -0,0 +1,28 @@
<!DOCTYPE html>
<html lang="en">
<head>
<title>Game Center</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0 user-scalable=no">
<link href="/ui/bs/css/bootstrap.min.css" rel="stylesheet" media="screen">
<link href="/ui/bs/css/bootstrap-theme.min.css" rel="stylesheet" media="screen">
<link href="/ui/css/hackerbots.css" rel="stylesheet" media="screen">
</head>
<body>
<div class="page-header">
<div class="container">
<h1>Game Center</h1>
</div>
</div>
<div class="container">
<div id="error" class="alert alert-danger">
<div class="container"></div>
</div>
</div>
<div class="container" id="game-list"></div>
<script src="/ui/jquery.js"></script>
<script src="/ui/bs/js/bootstrap.min.js"></script>
<script src="/ui/js/botui.js"></script>
</body>
</html>

60
ui/js/botui.js Normal file
View File

@ -0,0 +1,60 @@
$(function(){
$("#error").hide();
if($("#error > div").text() != "") {
$("#error").show();
}
loadServers();
loadGames();
});
function loadServers() {
$.get("/ui/servers", function(data) {
$("#server-list").append(data);
$(".start").click(function(e) {
$("#error").hide();
data = {
'server': $(this).attr("value"),
}
$.post(
"/api/v1/game/add/",
JSON.stringify(data),
function(data) {
if (data.ok) {
loadGames();
} else {
$("#error").text(data.error);
$("#error").show();
}
}
);
});
});
}
function loadGames() {
$.get("/ui/games", function(data) {
$("#game-list").empty();
$("#game-list").append(data);
$(".stop").click(function(e) {
$("#error").hide();
data = {
'name': $(this).attr("server"),
'game_id': $(this).attr("value"),
}
$.post(
"/api/v1/game/stop/",
JSON.stringify(data),
function(data) {
if (data.ok) {
loadGames();
} else {
$("#error").text(data.error);
$("#error").show();
}
}
);
});
});
}