aboutsummaryrefslogtreecommitdiff
path: root/gameserver/gameserver.html
diff options
context:
space:
mode:
Diffstat (limited to 'gameserver/gameserver.html')
-rw-r--r--gameserver/gameserver.html18
1 files changed, 12 insertions, 6 deletions
diff --git a/gameserver/gameserver.html b/gameserver/gameserver.html
index 7fc27fc..fdce5a8 100644
--- a/gameserver/gameserver.html
+++ b/gameserver/gameserver.html
@@ -39,6 +39,7 @@ function preinit(){
var spaceidx=msg.indexOf(" "),
cmd=msg.slice(0,spaceidx),
arg=JSON.parse(msg.slice(spaceidx+1));
+ var alerttext;
console.log(cmd,arg);
if(cmd=="nick"){
nick=arg;
@@ -96,10 +97,11 @@ function preinit(){
} else if(cmd=="game_win"){
bgcell(neuidx).classList.add("win");
if(arg==imPlayer){
- alert("You have won the game!");
+ alerttext="You have won the game!";
} else {
- alert("You have lost the game! Better luck next time.");
+ alerttext="You have lost the game! Better luck next time.";
}
+ setTimeout(function(){alert(alerttext);},canclick?500:1000);
} else alert("Unrecognised message "+msg);
});
ws.addEventListener("open",function(){
@@ -242,14 +244,18 @@ function enableClicking(en,disneu){
en=en?true:false;
disneu=disneu?true:false;
for(i=0;i<8;i++){
- document.getElementById("input_neudir"+i)[en&&!disneu?"removeAttribute":"setAttribute"]("disabled");
- document.getElementById("input_dir"+i)[en?"removeAttribute":"setAttribute"]("disabled");
+ if(en&&!disneu)document.getElementById("input_neudir"+i).removeAttribute("disabled");
+ else document.getElementById("input_neudir"+i).setAttribute("disabled","");
+ if(en)document.getElementById("input_dir"+i).removeAttribute("disabled");
+ else document.getElementById("input_dir"+i).setAttribute("disabled","");
}
l=document.getElementsByName("inputstoneradio");
for(i=0;i<l.length;i++){
- l[i][en&&(imPlayer==-1||board[i]==imPlayer)?"removeAttribute":"setAttribute"]("disabled");
+ if(en&&(imPlayer==-1||board[i]==imPlayer))l[i].removeAttribute("disabled");
+ else l[i].setAttribute("disabled","");
}
- document.getElementById("input_domovebtn")[en?"removeAttribute":"setAttribute"]("disabled");
+ if(en)document.getElementById("input_domovebtn").removeAttribute("disabled");
+ else document.getElementById("input_domovebtn").setAttribute("disabled","");
clickenabled=[en,disneu];
}