From cf4af138b16da878404cf3319d5d988dacee198a Mon Sep 17 00:00:00 2001 From: raylu Date: Sat, 5 Nov 2011 03:04:49 -0700 Subject: new layout --- js/mapspecs.js | 48 +++--------------------------------------------- 1 file changed, 3 insertions(+), 45 deletions(-) (limited to 'js/mapspecs.js') diff --git a/js/mapspecs.js b/js/mapspecs.js index 2494800..79e93aa 100644 --- a/js/mapspecs.js +++ b/js/mapspecs.js @@ -23,8 +23,6 @@ var mapjson = new Array(); var htmlscores = ''; function loadSol(sol) { - //alert("Temporary debug"); - //document.getElementById('debug').innerHTML = "
Exe1..."; if (sol == null) if (document.getElementById('mapsol') != undefined) sol = document.getElementById('mapsol').innerHTML; @@ -37,15 +35,12 @@ function loadSol(sol) { clearwalls(mapid); - //document.getElementById('debug').innerHTML += "
"+mapid+','+position[1]; for(var i in position) { - //document.getElementById('debug').innerHTML += "
"+mapid+','+position[i]; if (document.getElementById(mapid+','+position[i]) != undefined) { object = document.getElementById(mapid+','+position[i]); grid_click(object); } - //alert(soldata[i]); } } } @@ -62,7 +57,6 @@ function grid_click(obj) { if (solution[mapid] == undefined) { getmapdata(mapid); } - //alert(obj.cv); //Is this placing a wall, or removing one? if (obj.cv) { @@ -74,14 +68,11 @@ function grid_click(obj) { //IE 7 obj.style.backgroundColor = ''; blocks[mapid]++; - //alert(obj.id); //Remove wall solution[mapid] = solution[mapid].replace('.'+y+','+x+'.', '.'); - //alert(y+','+x+'.'); } else { //Placing a wall if (blocks[mapid] < 1) { - //alert("Outa blocks!"); updateDsp(mapid, 'dspWalls', "OUT!"); //document.getElementById(mapid+',dspWalls').innerHTML = "OUT!"; return; @@ -116,14 +107,11 @@ function updateDsp(mapid, element, data) { } function getmapdata(mapid) { - //alert(typeof(JSON)); if (typeof(JSON) == 'undefined') { - //alert("We're using EVAL instead"); text = document.getElementById(mapid+',mapdata').innerHTML; mapdata[mapid] = !(/[^,:{}\[\]0-9.\-+Eaeflnr-u \n\r\t]/.test(text.replace(/"(\\.|[^"\\])*"/g, ''))) && eval('(' + text + ')'); //mapdata[mapid] = eval(document.getElementById(mapid+',mapdata').innerHTML); } else { - //alert("We're using JSON"); mapdata[mapid] = JSON.parse(document.getElementById(mapid+',mapdata').innerHTML); } @@ -144,35 +132,28 @@ function doSend(mapid) { reqstr = ""; reqstr += "&mapcode="+mapdata[mapid].code; reqstr += "&mapid="+mapid; - //alert (mapdata[mapid].code); reqstr += "&solution="+solution[mapid]; - //alert(reqstr); //document.getElementById('dispdo').innerHTML = "http://mazetd.4xg.net/do.php?r=getpath"+reqstr - //alert("request string:"+reqstr); ajax.requestFile = "do.php?r=getpath"+reqstr; //prepare strdata ajax.onCompletion = request_path_done; // Specify function to be executed on response. ajax.runAJAX();// Do it! } function requestSol(solid) { - //alert("requesting solution id:" + solid); ajax.requestFile = "do.php?r=getsol&solutionid="+solid; //prepare strdata ajax.onCompletion = requestSolDone; // Specify function to be executed on response. ajax.runAJAX();// Do it! } function requestSolDone() { - //alert("request complete"); if (typeof(JSON) == 'undefined') { - //alert("We're using EVAL instead AGAIN."); text = ajax.response; var JO = !(/[^,:{}\[\]0-9.\-+Eaeflnr-u \n\r\t]/.test(text.replace(/"(\\.|[^"\\])*"/g, ''))) && eval('(' + text + ')'); //mapdata[mapid] = eval(document.getElementById(mapid+',mapdata').innerHTML); } else { - //alert("We're using JSON again"); var JO = JSON.parse(ajax.response); } @@ -184,16 +165,13 @@ function clearwalls(mapid) { if (solution[mapid] == undefined) return; walls = solution[mapid].split('.'); for(var i in walls) { - //alert(walls[i]); tmp = walls[i].split(','); eid = mapid+','+tmp[0]+','+tmp[1]; - //alert('eid:'+eid); if (document.getElementById(eid) != undefined) { obj = document.getElementById(eid); obj.setAttribute("class", "grid_td"); obj.style.backgroundColor = ''; obj.cv = false; - //alert("exe"); } } solution[mapid] = undefined; @@ -209,22 +187,18 @@ function resetwalls(mapid) { function request_path_done() { //document.getElementById('mapdisplay').innerHTML = ajax.response; - //alert ("resp: "+ajax.response); //if (ajax.response == undefined) return; if (typeof(JSON) == 'undefined') { - //alert("We're using EVAL instead AGAIN."); text = ajax.response; var JO = !(/[^,:{}\[\]0-9.\-+Eaeflnr-u \n\r\t]/.test(text.replace(/"(\\.|[^"\\])*"/g, ''))) && eval('(' + text + ')'); //mapdata[mapid] = eval(document.getElementById(mapid+',mapdata').innerHTML); } else { - //alert("We're using JSON again"); var JO = JSON.parse(ajax.response); } mapjson[JO.mapid] = JO; - //alert ("resp: "+ajax.response); // if (typeof(JSON) == undefined) { // var JO = eval(ajax.response); // } else { @@ -235,18 +209,16 @@ function request_path_done() { } for(var i in JO.error) { - alert('\n JO error ' + JO.error[i]); + console.error('\n JO error ' + JO.error[i]); } //document.getElementById('disp').innerHTML = JO.map; if (JO.blocked) { - alert("Path is blocked make sure there is a way for it to go!"); + alert("The path is blocked!"); return; } //document.write(JO.map); - //alert ("moves: "+JO.moves); - //alert ("path: "+JO.start); //document.getElementById('disppath').innerHTML = JO.path; //document.getElementById('disptotalmoves').innerHTML = JO.moves; var disptext = "Record: "+JO.best+" by "+JO.bestby; @@ -268,7 +240,6 @@ function animatePath(path, mapid, start) { x = tmp[1]; p = path; - //alert("Begin"); //t = p.length; t = ''; //count[mapid] = 0; @@ -279,9 +250,7 @@ function animatePath(path, mapid, start) { function animatePathDone(mapid) { document.getElementById(mapid+',btn').disabled = false; - //alert("animate done..." + htmlscores); if (htmlscores) { - //alert("showing scores..."); updateDsp(mapid, 'dspScore', htmlscores); htmlscores = ''; } @@ -292,18 +261,14 @@ function animatePathDone(mapid) { function request_scores_done() { - //alert("score request complete"); //Get scores. if (typeof(JSON) == 'undefined') { - //alert("We're using EVAL instead AGAIN."); text = ajax.response; var JO = !(/[^,:{}\[\]0-9.\-+Eaeflnr-u \n\r\t]/.test(text.replace(/"(\\.|[^"\\])*"/g, ''))) && eval('(' + text + ')'); //mapdata[mapid] = eval(document.getElementById(mapid+',mapdata').innerHTML); } else { - //alert("We're using JSON again"); var JO = JSON.parse(ajax.response); } - //alert("scores saveing " + JO.scores); htmlscores = JO.scores; } @@ -332,7 +297,6 @@ function doanimate(x, y, p, c, mapid) { if (count[mapid] == undefined) { count[mapid] = 0; } - //alert("test"); if (snake[mapid] == undefined) { snake[mapid] = new Array(); snake[mapid]['color'] = '#4444bb'; @@ -346,7 +310,7 @@ function doanimate(x, y, p, c, mapid) { eid = mapid+','+x+','+y; //Verify. if (document.getElementById(eid) == undefined) { - alert("Path exited field..?"); + console.error("Path exited field...?"); animatePathDone(mapid); return; } @@ -361,7 +325,6 @@ function doanimate(x, y, p, c, mapid) { // if (origclass == 'grid_td_animate' || origclass == 'grid_td_animate_pre' ) { origclass = handle.classOrigName; //setTimeout(handle.setAttribute('class', origclass), 850); - //alert('ex ' + origclass); } //handle.style.backgroundColor = snake[mapid]['color']; handle.classOrigName = origclass; @@ -391,7 +354,6 @@ function doanimate(x, y, p, c, mapid) { if (checkSound(mapid)) { soundManager.play('charm'); } - //alert("count-hit: "+count[mapid]); //Flash flashelement(mapid+',dspCount', 4); break; @@ -410,7 +372,6 @@ function doanimate(x, y, p, c, mapid) { string = "if (document.getElementById('"+eid+"').className == 'grid_td_path"+c+"') "; string += "document.getElementById('"+eid+"').className = '"+origclass+"';"; - //alert (string); setTimeout(string, 855); //And incase that didn't work... //setTimeout("document.getElementById('"+eid+"').className = '"+origclass+"'", 7500); @@ -419,7 +380,6 @@ function doanimate(x, y, p, c, mapid) { if (handle.pressed == true) { setTimeout("document.getElementById('"+eid+"').style.backgroundColor = '#dddddd';", 865); } else { - //alert(eid); setTimeout("document.getElementById('"+eid+"').style.backgroundColor = '';", 865); } @@ -616,7 +576,6 @@ function doanimate(x, y, p, c, mapid) { //soundManager.play('002'); //soundManager.play('003'); } - //alert(tpEid); document.getElementById(eid).style.backgroundColor='#CCCCCC'; document.getElementById(tpEid).style.backgroundColor='#CCCCCC'; //flashelement(eid, 7); @@ -639,7 +598,6 @@ function doanimate(x, y, p, c, mapid) { } function flashelement(eid, times, color, speed) { - //alert("exe"+eid); if (document.getElementById(eid) == undefined) return; if (!color) { color = "#FFFF44"; -- cgit v1.2.3