From 8e639fd6cccecb3f23f727ef1f00f7e9851ea04e Mon Sep 17 00:00:00 2001 From: BlueRaja Date: Sat, 25 Aug 2012 05:43:26 -0500 Subject: Fixing various javascript warnings, as well as renaming all //!! comments to //TODO --- do.php | 10 +++++----- globe.php | 6 +++--- includes/datas.php | 4 ++-- includes/mapoftheday.php | 2 +- includes/maps.php | 6 +++--- js/globe.js | 20 ++++++++++---------- js/mapspecs.js | 17 +++++++++-------- js/scores.js | 2 +- pages/achievements.php | 2 +- pages/challenge.php | 9 +++++---- pages/gallery.php | 16 ++++++++-------- pages/home.php | 4 ++-- pages/howtoplay.php | 2 +- pages/leaderboard.php | 2 +- pages/tutorial.php | 15 ++++++++------- 15 files changed, 60 insertions(+), 57 deletions(-) diff --git a/do.php b/do.php index a39b689..ebdfda9 100644 --- a/do.php +++ b/do.php @@ -31,7 +31,7 @@ if (isset($_GET['act']) && $_GET['act'] == "getmap") { } } -// !! Depreciate? +// TODO: Depreciate? if (isset($_GET['checkachieve']) && $_GET['checkachieve'] == 'true' && $_SESSION['accepted'] == 1) { $json['notification'] = true; $userID = $_SESSION['userID']; @@ -82,7 +82,7 @@ if ($_GET['r'] == 'getsol') { $userID = $_SESSION['userID']; -///// !! FIX FIX FIX FIX FIX FIX ////// +///// TODO: FIX FIX FIX FIX FIX FIX ////// if ($_SESSION['accepted'] == 1) { $json = getSolution($userID, $mapID); if ($tmp['moves'] > $_SESSION[$mapID.'sol']) { @@ -137,11 +137,11 @@ if ($_GET['r'] == 'getpath') { $json['path'][] = routePath($mygrid); $json['path'][] = routePath($mygrid, false, true); - // !! Tmp + // TODO: Tmp //$moves = $json['moves']; $moves = $json['path1']['moves']; - // !! Tmp + // TODO: Tmp $json['blocked'] = ($json['path1']['blocked']); $json['mapid'] = $mapID; @@ -276,7 +276,7 @@ if ($_GET['r'] == 'getpath') { function isCurrentMap($mapID) { - // !! Broke + // TODO: Broke include_once('./includes/db.inc.php'); $sql = "SELECT maps.ID FROM `mapOfTheDay` diff --git a/globe.php b/globe.php index 2764b4f..05d2e39 100644 --- a/globe.php +++ b/globe.php @@ -7,7 +7,7 @@ if (!session_id()) //Database login: //include_once 'db.inc.php'; -//!! CONFIRM THIS DOMAIN BEFORE TRANSFER +//TODO: CONFIRM THIS DOMAIN BEFORE TRANSFER //$mydomain = "http://www.mazetd.4xg.net/"; $mydomain = "http://www.pathery.com/"; @@ -113,7 +113,7 @@ Function DoLogin($Username, $Password, $RememberMe = False, $EN = False) { Function CheckAuth($page) { - //!! + //TODO: if ($_SESSION['Accepted'] == 1) { return true; } else { @@ -123,7 +123,7 @@ Function CheckAuth($page) { } } -//!! Contains domain !! +//TODO: Contains domain !! Function DoRedirect($message = "Thanks", $to = "http://www.pathery.com/", $duration = "3") { $to=(is_null($to)?'http://www.pathery.com/':$to); diff --git a/includes/datas.php b/includes/datas.php index 0041da2..d64776c 100644 --- a/includes/datas.php +++ b/includes/datas.php @@ -182,7 +182,7 @@ function getNotified($userID) { //Returns true when an achievement is applied. // Usage example: applyCareerAchievement($userID); -// !! DEPRECIATED +// TODO: DEPRECIATED function applyCareerPathAchievements($userID) { $sql = "SELECT SUM(solutions.moves) as totalMoves @@ -236,7 +236,7 @@ function applyCareerPathAchievements($userID) { } //Almost a duplicate of applyCareerPathAchievements -// !! DEPRECIATED +// TODO: DEPRECIATED function applyCareerMazesAchievements($userID) { $sql = "SELECT COUNT(*) as totalSolutions diff --git a/includes/mapoftheday.php b/includes/mapoftheday.php index c5b9834..a695ed1 100644 --- a/includes/mapoftheday.php +++ b/includes/mapoftheday.php @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/includes/maps.php b/includes/maps.php index e322bc4..05559b4 100644 --- a/includes/maps.php +++ b/includes/maps.php @@ -349,7 +349,7 @@ function GenerateMap($rows, $cols, $rockchance, $numBlocks = -1, $cp = -1, $tp = } elseif (rand(1, $rockchance) == 2) { $grid[$y][$x] = "r"; $rocks++; - //!! rock count could be off if covered by checkpoint. + //TODO: rock count could be off if covered by checkpoint. //Just a normal square. } else { $grid[$y][$x] = "o"; @@ -836,7 +836,7 @@ function findPath($mapMatrix, $start = '0,1', $target = 'f', $isBlockedByX = fal $path = $mapMatrix[$y][$x]; case "o": //Available squares - // !! + // TODO: case "p": case "s": case "f": //Start and end tiles @@ -917,7 +917,7 @@ function routePath($mygrid, $validate = false, $traverseBackwards = false) { if ($traverseBackwards) $cpnames = array("e", "d", "c", "b", "a"); - //!! Improve the 'findTiles' function to prevent duplicate itterations. + //TODO: Improve the 'findTiles' function to prevent duplicate itterations. //Add the existing checkpoints to target array. foreach ($cpnames as $cpt) if (findTiles($mygrid, $cpt)) diff --git a/js/globe.js b/js/globe.js index 7fcd6a7..2c6f088 100644 --- a/js/globe.js +++ b/js/globe.js @@ -1,5 +1,5 @@ -// !! Remember to preload images +// TODO: Remember to preload images function showSignin() { @@ -15,15 +15,15 @@ function showSignin() { } -var signinDiv = '
-

Sign in

-
-

Do you have an account here?

- Sign in with Google - Sign in with Yahoo - Learn more about OpenID -
-
'; +var signinDiv = '
' + +'

Sign in

' + +'
' + +'

Do you have an account here?

' + +' Sign in with Google' + +' Sign in with Yahoo' + +' Learn more about OpenID' + +'
' + +'
'; diff --git a/js/mapspecs.js b/js/mapspecs.js index cbb642c..ded7bfc 100644 --- a/js/mapspecs.js +++ b/js/mapspecs.js @@ -136,9 +136,7 @@ function grid_click(obj) { else obj.style.backgroundColor = playerWallColor; - if (typeof playerWallEmblem === 'undefined') - ''; - else + if (typeof playerWallEmblem !== 'undefined') obj.style.backgroundImage="url(images/marks/"+playerWallEmblem+")"; //Add Wall @@ -206,11 +204,12 @@ function requestSol(mapID) { } function requestSolDone() { + var JO; if (typeof(JSON) == 'undefined') { text = ajax.response; - var JO = !(/[^,:{}\[\]0-9.\-+Eaeflnr-u \n\r\t]/.test(text.replace(/"(\\.|[^"\\])*"/g, ''))) && eval('(' + text + ')'); + JO = !(/[^,:{}\[\]0-9.\-+Eaeflnr-u \n\r\t]/.test(text.replace(/"(\\.|[^"\\])*"/g, ''))) && eval('(' + text + ')'); } else { - var JO = JSON.parse(ajax.response); + JO = JSON.parse(ajax.response); } if (JO.solution == 'undefined') return; @@ -288,7 +287,7 @@ function request_path_done() { mapdata[mapid].restoreTiles = new Array(); mapdata[mapid].pathColor = new Object; - for(var i in JO.path) { + for(i in JO.path) { mapdata[mapid].moveCount[i] = 0; mapdata[mapid].pathColor[i] = '#ffffff'; animatePath(JO.path[i].path, mapid, JO.path[i].start, i); @@ -297,11 +296,12 @@ function request_path_done() { } function decryptJSON(text) { + var JO; if (typeof(JSON) == 'undefined') { - var JO = !(/[^,:{}\[\]0-9.\-+Eaeflnr-u \n\r\t]/.test(text.replace(/"(\\.|[^"\\])*"/g, ''))) && eval('(' + text + ')'); + JO = !(/[^,:{}\[\]0-9.\-+Eaeflnr-u \n\r\t]/.test(text.replace(/"(\\.|[^"\\])*"/g, ''))) && eval('(' + text + ')'); //mapdata[mapid] = eval(document.getElementById(mapid+',mapdata').innerHTML); } else { - var JO = JSON.parse(ajax.response); + JO = JSON.parse(ajax.response); } return JO; } @@ -792,6 +792,7 @@ for (i=0;i"; p = p+ ""; - // !! Don't forget to make sure these images are cached; + // TODO: Don't forget to make sure these images are cached; if (u.medal == 'gold') { p = p+ ""; } else if (u.medal == 'silver') { diff --git a/pages/achievements.php b/pages/achievements.php index 1d81220..9e91366 100644 --- a/pages/achievements.php +++ b/pages/achievements.php @@ -143,7 +143,7 @@ function toColor($n) return("#".substr("000000".dechex($n),-6)); } -// !! END TESTING AREA; +// TODO: END TESTING AREA; //Self-healing code for unlocks. if (!$viewer) { diff --git a/pages/challenge.php b/pages/challenge.php index f011d3e..1f0e258 100644 --- a/pages/challenge.php +++ b/pages/challenge.php @@ -48,6 +48,7 @@ challenge5.help = "Try placing the walls as highlighted."; function challengeGo(mapid) { var moves = mapjson[mapid].moves; + var tiles; switch (mapid) { case '1': @@ -85,7 +86,7 @@ function challengeGo(mapid) { tv.unlock(5); } else { updateDsp(1, 'instructions', challenge4.help); - var tiles = ["4,1,5","4,2,6","4,3,7","4,4,9"]; + tiles = ["4,1,5","4,2,6","4,3,7","4,4,9"]; markTiles(tiles); } break; @@ -96,7 +97,7 @@ function challengeGo(mapid) { //Unlock next button. } else { updateDsp(1, 'instructions', challenge5.help); - var tiles = ["5,1,5","5,2,6","5,3,3","5,4,2","5,3,1"]; + tiles = ["5,1,5","5,2,6","5,3,3","5,4,2","5,3,1"]; markTiles(tiles); } break; @@ -113,7 +114,7 @@ function markTiles(tiles) { } } -//!! +//TODO: function challengeWall(mapid) { //Disable function return; @@ -192,7 +193,7 @@ TutorialView.prototype.showTutorial = function(num) { if (elem.className.indexOf('hidden') < 0) elem.className += 'hidden'; } - var elem = document.getElementById("tut-" + num); + elem = document.getElementById("tut-" + num); elem.className = elem.className.replace('hidden', ''); //Is the map after this disabled? this.nextbtn.className = this.nextbtn.className.replace(' disabled', ''); diff --git a/pages/gallery.php b/pages/gallery.php index 2d540b6..098cf74 100644 --- a/pages/gallery.php +++ b/pages/gallery.php @@ -30,14 +30,14 @@ include('./includes/mapoftheday.php'); $openmaps[] = 'Souxoooooooooooooooooooo'; -$openmaps[] = 'ooxooooooooooooooooooooo'; -$openmaps[] = 'oxooooooooooooooeocooooo'; -$openmaps[] = 'oooooooooooooooooooooooo'; -$openmaps[] = 'ooooooooooaoootooooooooo'; -$openmaps[] = 'oooooooooooooooooooooooo'; -$openmaps[] = 'oooooooooooooooooooooooo'; -$openmaps[] = 'ooooooXXoooooooooooooooo'; -$openmaps[] = 'oooooXbdoooooooooooooooo'; +$openmaps[] = 'ooxoooXooooooooooooooooo'; +$openmaps[] = 'oxooooXoooooooooeocooooo'; +$openmaps[] = 'oxooooXooooooooooooooooo'; +$openmaps[] = 'oxooooXoooaoootooooooooo'; +$openmaps[] = 'oxooooXooooooooooooooooo'; +$openmaps[] = 'oxooooXooooooooooooooooo'; +$openmaps[] = 'oxooooXooooooooooooooooo'; +$openmaps[] = 'oxoooXbdoooooooooooooooo'; $openmaps[] = 'fooooXooooooooooooooooos'; $myparams['checkpoints'] = 5; diff --git a/pages/home.php b/pages/home.php index 2b59bc2..4e46ac6 100644 --- a/pages/home.php +++ b/pages/home.php @@ -159,7 +159,7 @@ function displayMaze($motd, $mapType) { if ($accepted) { $sol = getSolution($userID, $mapID); $mysolution = $sol['solution']; - //!! implement mymoves + //TODO: implement mymoves $mymoves = $sol['moves']; } if (isset($_SESSION[$mapID.'sol']) && $mysolution == '') { @@ -263,7 +263,7 @@ function showStats(type) { elem = document.getElementById("dl-" + i); elem.className = elem.className.replace('selected', ''); } - var elem = document.getElementById("yms-" + type); + elem = document.getElementById("yms-" + type); elem.className = elem.className.replace('hidden-maps', 'shown-maps'); elem = document.getElementById("dl-" + type); if (elem.className.indexOf('selected') < 0) diff --git a/pages/howtoplay.php b/pages/howtoplay.php index b600fd8..8c9f2f5 100644 --- a/pages/howtoplay.php +++ b/pages/howtoplay.php @@ -116,7 +116,7 @@ function showTutorial(num) { if (elem.className.indexOf('hidden') < 0) elem.className += 'hidden'; } - var elem = document.getElementById("tut-" + num); + elem = document.getElementById("tut-" + num); elem.className = elem.className.replace('hidden', ''); } showTutorial(0); diff --git a/pages/leaderboard.php b/pages/leaderboard.php index 440f1e5..a457a8d 100644 --- a/pages/leaderboard.php +++ b/pages/leaderboard.php @@ -320,7 +320,7 @@ function showStats(type) { elem = document.getElementById("dl-" + i); elem.className = elem.className.replace('selected', ''); } - var elem = document.getElementById("yms-" + type); + elem = document.getElementById("yms-" + type); elem.className = elem.className.replace('hidden-stats', ''); elem = document.getElementById("dl-" + type); if (elem.className.indexOf('selected') < 0) diff --git a/pages/tutorial.php b/pages/tutorial.php index 95a5a53..d09480c 100644 --- a/pages/tutorial.php +++ b/pages/tutorial.php @@ -11,7 +11,7 @@ else topbar($Links); -//!! Turn this into a function? +//TODO: Turn this into a function? if ($accepted) { include_once ('./includes/db.inc.php'); $userID = $_SESSION['userID']; @@ -71,6 +71,7 @@ challenge5.help = "Try placing the walls as highlighted."; function challengeGo(mapid) { var moves = mapjson[mapid].moves; + var tiles; switch (mapid) { case '1': @@ -84,7 +85,7 @@ function challengeGo(mapid) { tv.unlock(3); } else { updateDsp(1, 'instructions', challenge2.help); - var tiles = ["2,3,5","2,4,6"]; + tiles = ["2,3,5","2,4,6"]; markTiles(tiles); } break; @@ -95,7 +96,7 @@ function challengeGo(mapid) { tv.unlock(4); } else { updateDsp(1, 'instructions', challenge3.help); - var tiles = ["3,3,6","3,4,7","3,3,2","3,2,1"]; + tiles = ["3,3,6","3,4,7","3,3,2","3,2,1"]; markTiles(tiles); } break; @@ -106,7 +107,7 @@ function challengeGo(mapid) { tv.unlock(5); } else { updateDsp(1, 'instructions', challenge4.help); - var tiles = ["4,1,5","4,2,6","4,3,7","4,4,9"]; + tiles = ["4,1,5","4,2,6","4,3,7","4,4,9"]; markTiles(tiles); } break; @@ -117,7 +118,7 @@ function challengeGo(mapid) { //Unlock next button. } else { updateDsp(1, 'instructions', challenge5.help); - var tiles = ["5,1,5","5,2,6","5,3,3","5,4,2","5,3,1"]; + tiles = ["5,1,5","5,2,6","5,3,3","5,4,2","5,3,1"]; markTiles(tiles); } break; @@ -134,7 +135,7 @@ function markTiles(tiles) { } } -//!! +//TODO: function challengeWall(mapid) { //Required walls: var reqwall = new Array(); @@ -212,7 +213,7 @@ TutorialView.prototype.showTutorial = function(num) { if (elem.className.indexOf('hidden') < 0) elem.className += 'hidden'; } - var elem = document.getElementById("tut-" + num); + elem = document.getElementById("tut-" + num); elem.className = elem.className.replace('hidden', ''); //Is the map after this disabled? this.nextbtn.className = this.nextbtn.className.replace(' disabled', ''); -- cgit v1.2.3