try to draw 1000*1000 svg grig

This commit is contained in:
Gnieark 2016-06-29 13:43:20 +02:00
parent 54fdebc9b1
commit 5703818c3b

View File

@ -5,13 +5,25 @@ function createElem(type,attributes){
return elem; return elem;
} }
function createElemNS(type,attributes){ function createElemNS(type,attributes){
//same as createElem but with ns for svg file
var elem=document.createElementNS("http://www.w3.org/2000/svg",type); var elem=document.createElementNS("http://www.w3.org/2000/svg",type);
for (var i in attributes) for (var i in attributes)
{elem.setAttributeNS(null,i,attributes[i]);} {elem.setAttributeNS(null,i,attributes[i]);}
return elem; return elem;
} }
function applyInitMessage(){
if(request.readyState == 4){
if(request.status == 200) {
alert ("ok");
}else{
alert ('error ' + xhr.status);
document.getElementById('fightButton').disabled=false;
return;
}
}
}
function tron(bot1,bot2,xdcheck){ function tron(bot1,bot2,xdcheck){
//empty //empty
while (document.getElementById('fightResult').firstChild) { while (document.getElementById('fightResult').firstChild) {
@ -23,4 +35,15 @@ function tron(bot1,bot2,xdcheck){
svg.appendChild(rect); svg.appendChild(rect);
document.getElementById("fightResult").appendChild(svg); document.getElementById("fightResult").appendChild(svg);
//ask arena to send bots init messages
var request = new XMLHttpRequest();
request.onreadystatechange = applyInitMessage;
request.open("POST", '/tron', true);
request.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
request.send('act=initGame&bot1=' + bot1 + '&bot2=' + bot2 + '&xd_check=' + xd_check + '&fullLogs=' + document.getElementById("fullLogs").checked);
}
} }