SUCCESS="You are now logged into the SUCS Game Server system, and can connect to any of the servers we have running by simply specifying the hostname/IP address 'games.sucs.org'. This page must be left open while you are playing. When you close this window, you will no longer have access to the games server, and will have to login again if you wish to play some more.",

SIGNUP_INFO="Thank you for taking an interest in playing on the SUCS game server. Unfortunately the game server is currently only available to SUCS members, you can <a href=\"https://sucs.org/join\">sign up</a> to SUCS and get 24/7 access to the server plus all the other benefits that come with SUCS membership.";

functionloginRefresh(){

console.log()

$.post("controll.php",{renew:1},onPostResponse);

}

varREFRESH_ID;

functionscheduleRefresh(){

REFRESH_ID=setTimeout(loginRefresh,30*1000);

}

functioncancelRefresh(){

clearTimeout(REFRESH_ID);

}

functionpopulateExtraData(data,domain){

if(domain===undefined){

domain=$("body")

}

$.each(data,function(key,value){

vartarget=domain.find("[data-target='"+key+"']");

if(target.length==0){

console.warn("failed to find target",key,"under",domain);

return;

}

if(key=="_online"){

if(value){

target.css("color","green").text("Online")

}else{

target.css("color","red").text("Offline")

}

}elseif(value==null){

target.empty();

}elseif(valueinstanceofArray){

target.empty();

for(vari=0;i<value.length;i++){

$("<li>").text(value[i]).appendTo(target);

}

}elseif(typeofvalue=="object"){

populateExtraData(value,target)

}else{

target.text(value);

}

})

}

functiononPostResponse(response){

console.log(response)

//When this response comes back it will be 1 of 5 diffrent state we care about

//DEFAULT|BANNED|UNI-NO|GAME-ACCESS|BAD-CREDENTIALS

//Populate extra payload data

populateExtraData(response.extraPayload)

//if the response is AS_BEFORE nothing changes, just schedle a refresh

SUCCESS="You are now logged into the SUCS Game Server system, and can connect to any of the servers we have running by simply specifying the hostname/IP address 'games.sucs.org'. This page must be left open while you are playing. When you close this window, you will no longer have access to the games server, and will have to login again if you wish to play some more.",

SIGNUP_INFO="Thank you for taking an interest in playing on the SUCS game server. Unfortunately the game server is currently only available to SUCS members, you can <a href=\"https://sucs.org/join\">sign up</a> to SUCS and get 24/7 access to the server plus all the other benefits that come with SUCS membership.";

functionloginRefresh(){

console.log()

$.post("controll.php",{renew:1},onPostResponse);

}

varREFRESH_ID;

functionscheduleRefresh(){

REFRESH_ID=setTimeout(loginRefresh,30*1000);

}

functioncancelRefresh(){

clearTimeout(REFRESH_ID);

}

functionpopulateExtraData(data,domain){

if(domain===undefined){

domain=$("body")

}

$.each(data,function(key,value){

vartarget=domain.find("[data-target='"+key+"']");

if(target.length==0){

console.warn("failed to find target",key,"under",domain);

return;

}

if(key=="_online"){

if(value){

target.css("color","green").text("Online")

}else{

target.css("color","red").text("Offline")

}

}elseif(value==null){

target.empty();

}elseif(valueinstanceofArray){

target.empty();

for(vari=0;i<value.length;i++){

$("<li>").text(value[i]).appendTo(target);

}

}elseif(typeofvalue=="object"){

populateExtraData(value,target)

}else{

target.text(value);

}

})

}

functiononPostResponse(response){

console.log(response)

//When this response comes back it will be 1 of 5 diffrent state we care about

//DEFAULT|BANNED|UNI-NO|GAME-ACCESS|BAD-CREDENTIALS

//Populate extra payload data

populateExtraData(response.extraPayload)

//if the response is AS_BEFORE nothing changes, just schedle a refresh