From 6797c134d1bd14b81a5c9ed274305a8c2de41291 Mon Sep 17 00:00:00 2001 From: stephen mcquay Date: Wed, 26 Aug 2015 23:15:53 -0700 Subject: [PATCH] first wave of static assets --- ui/css/hackerbots.css | 74 +++++++++++++++++++++++++++++++++++++++++++ ui/index.html | 28 ++++++++++++++++ ui/js/botui.js | 60 +++++++++++++++++++++++++++++++++++ 3 files changed, 162 insertions(+) create mode 100644 ui/css/hackerbots.css create mode 100644 ui/index.html create mode 100644 ui/js/botui.js diff --git a/ui/css/hackerbots.css b/ui/css/hackerbots.css new file mode 100644 index 0000000..8009eda --- /dev/null +++ b/ui/css/hackerbots.css @@ -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; +} diff --git a/ui/index.html b/ui/index.html new file mode 100644 index 0000000..64a1481 --- /dev/null +++ b/ui/index.html @@ -0,0 +1,28 @@ + + + + Game Center + + + + + + + +
+
+
+
+
+ +
+ + + + + + diff --git a/ui/js/botui.js b/ui/js/botui.js new file mode 100644 index 0000000..46c914a --- /dev/null +++ b/ui/js/botui.js @@ -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(); + } + } + ); + + }); + }); +}