var autoJoinGameContainer = document.createElement("div");
var autoJoinGameLabel = document.getElementsByClassName("checkbox")[0].children[0].cloneNode(true);
var animator = new ToradorableAnimator();
document.getElementById('home').insertBefore(autoJoinGameContainer,document.getElementById("skin_row"));
autoJoinGameLabel.children[0].id="autoJoinGame";
autoJoinGameContainer.appendChild(autoJoinGameLabel);
autoJoinGameContainer.innerHTML = autoJoinGameContainer.innerHTML + ' Респавн';
autoJoinGame.checked=true;
myApp["onDead"] = function() {
isJoinedGame = false;
if (autoJoinGame.checked) setNick(document.getElementById('nick').value);
};
window.addEventListener('keydown', keydown);
function keydown(e) {
/* else */ if(e.keyCode === 27) {
animator.pauseAnimation();
$("#overlays")["show"]();
}
}
function ToradorableAnimator(initArgs={}) {
this.pauseAnimation = function(){
};
}
window.addEventListener('keydown', keydown);
window.addEventListener('keyup', keyup);
var EjectDown = false;
var speed = 25; //in ms
function keydown(event) {
if (event.keyCode == 87 && EjectDown === false) { // key W
EjectDown = true;
setTimeout(eject, speed);
}
if (event.keyCode == 82) { //key r
split();
setTimeout(split, 115);
}
if (event.keyCode == 69) { //key e
split();
setTimeout(split, speed);
setTimeout(split, speed*2);
setTimeout(split, speed*3);
setTimeout(split, speed*4);
setTimeout(split, speed*5);
setTimeout(split, speed*6);
setTimeout(split, speed*7);
setTimeout(split, speed*8);
setTimeout(split, speed*9);
setTimeout(split, speed*10);
}
if (event.keyCode == 81) { //key q
split();
setTimeout(split, 255);
}
}
function keyup(event) {
if (event.keyCode == 87) { // key W
EjectDown = false;
}
}
function eject() {
if (EjectDown) {
window.onkeydown({keyCode: 87}); // key W
window.onkeyup({keyCode: 87});
setTimeout(eject, 1);
}
}
function split() {
$("body").trigger($.Event("keydown", { keyCode: 32}));
$("body").trigger($.Event("keyup", { keyCode: 32}));
}