first wave of static assets
This commit is contained in:
@@ -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();
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
});
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user