Skip to content
Snippets Groups Projects
Commit 42f4d6f6 authored by Stuart John Watson's avatar Stuart John Watson
Browse files

commit to checkout another branch

parent 8b85fe64
No related branches found
No related tags found
1 merge request!1Major Rebuild: AJAX and working game info
No preview for this file type
......@@ -7,6 +7,19 @@
<link href="css/material-wfont.min.css" rel="stylesheet">
<title>SUCS Games Server</title>
<style>
.if-NO_LOGIN,
.if-NO_GAMES,
.if-GAME_ACCESS {
display:none;
}
.mode-NO_LOGIN .if-NO_LOGIN,
.mode-NO_GAMES .if-NO_ {
}
</style>
</head>
<body>
<nav class="navbar navbar-inverse navbar-warning">
......@@ -143,35 +156,36 @@
function loginRefresh(){
console.log()
$.post("controll.php",{},onPostResponse);
$.post("controll.php",{renew:1},onPostResponse);
}
function onPostResponse(response){
console.log(response)
var level = response["level"],
error = response["loginError"],
username = response["username"],
extraPayload = response["extraPayload"]
if (level == "NO_LOGIN"){
//Show an error if there is one
if (response.loginError){
$("#loginErrorWrap").show();
$("#loginError").text(ERR_MAP[error]);
} else {
$("#loginErrorWrap").hide();
}
var username = response["username"],
extraPayload = response["extraPayload"];
if (response.level == "NO_LOGIN"){
//User isn't logged in
$("#onlineListWrap").hide()
$("#username").hide();
$("#login").show();
$("#logout").hide();
$("#signup").show()
} else {
//User is logged in ...
setTimeout(loginRefresh,30*1000);
$("#username").show().text("Hello "+username);
$("#login").hide();
$("#logout").show();
setTimeout(loginRefresh,30*1000);
if (level == "NO_GAMES") {
//...but cannot access games
$("#loginErrorWrap").show();
$("#loginError").text(ERR_MAP[error]);
if(error == "UNI_DISALLOWED"){
$("#loginMessage").show().html(SIGNUP_INFO);
$("#signup").show()
......@@ -179,7 +193,6 @@
$("#loginMessage").hide()
}
$("#onlineList").hide()
} else if (level == "GAME_ACCESS") {
//...and can access games
$("#loginMessage").show().html(SUCCESS);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment