summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.htaccess8
-rw-r--r--ajax/maps.ajax.php62
-rw-r--r--ajax/scores.ajax.php174
-rw-r--r--ajax/users.ajax.php2
-rw-r--r--css/page.css34
-rw-r--r--do.php15
-rw-r--r--humans.txt40
-rw-r--r--includes/chats.php2
-rw-r--r--includes/datas.php16
-rw-r--r--includes/emails.php2
-rw-r--r--includes/header.php4
-rw-r--r--includes/sqlEmbedded.php3
-rw-r--r--includes/sqli.php4
-rw-r--r--js/mapspecs.js10
-rw-r--r--js/scores.js8
-rw-r--r--pages/admin.php2
-rw-r--r--pages/massemail.php2
-rw-r--r--pages/scores.php37
18 files changed, 214 insertions, 211 deletions
diff --git a/.htaccess b/.htaccess
index c8a1820..f300bce 100644
--- a/.htaccess
+++ b/.htaccess
@@ -18,10 +18,18 @@ RewriteRule ^([a-z]+)$ /index\.php?page=$1 [QSA,NC]
# GetMap Re-write
RewriteRule ^map/(.*)$ /ajax/maps\.ajax\.php?mapid=$1 [QSA,NC]
+RewriteRule ^a/map/(.*)$ /ajax/maps\.ajax\.php?mapid=$1 [QSA,NC]
+
+RewriteRule ^a/mapsbydate/(.*)$ /ajax/maps\.ajax\.php?getmapidsbydate=$1 [QSA,NC]
RewriteRule ^challenge/(.*)$ /ajax/challenges\.ajax\.php?challengeid=$1 [QSA,NC]
+RewriteRule ^a/challenge/(.*)$ /ajax/challenges\.ajax\.php?challengeid=$1 [QSA,NC]
RewriteRule ^user/(.*)$ /ajax/users\.ajax\.php?userid=$1 [QSA,NC]
+RewriteRule ^a/user/(.*)$ /ajax/users\.ajax\.php?userid=$1 [QSA,NC]
+
+RewriteRule ^a/score/(.*)$ /ajax/scores\.ajax\.php?r=$1 [QSA,NC]
+
# CSS and JS cache for 480 weeks
diff --git a/ajax/maps.ajax.php b/ajax/maps.ajax.php
index 611080d..8ceade5 100644
--- a/ajax/maps.ajax.php
+++ b/ajax/maps.ajax.php
@@ -3,21 +3,35 @@ ob_start("ob_gzhandler");
include('../includes/mapclass.php');
include('../includes/maps.php');
+include('../includes/sqlEmbedded.php');
-//Remove the ending .js
-$tmp = explode(".", $_GET['mapid']);
-$mapID = $tmp[0] * 1;
-if (!is_int($mapID)) exit;
-
-$map = getMapObjectByID($mapID);
+if (isset($_GET['getmapidsbydate'])) {
+ //Remove the ending .js
+ $tmp = explode(".", $_GET['getmapidsbydate']);
+ $requestDate = $tmp[0];
+ sendCacheHeaders();
+ echo json_encode(getMapIDsByDate($requestDate));
+ exit;
+}
+if (isset($_GET['mapid'])) {
+ //Remove the ending .js
+ $tmp = explode(".", $_GET['mapid']);
+ $mapID = $tmp[0] * 1;
+ if (!is_int($mapID)) exit;
+ $map = getMapObjectByID($mapID);
+ sendCacheHeaders();
+ echo json_encode($map);
+ exit;
+}
-$expires = 365*24*60*60;
-//TODO: Remove this line once we're confident in data in the mapObject.
-$expires = 1*24*60*60;
-header("Cache-Control: public, maxage=".$expires);
-header('Expires: ' . gmdate('D, d M Y H:i:s', time()+$expires) . ' GMT');
-header("Content-type: text/javascript");
-echo json_encode($map);
+function sendCacheHeaders() {
+ $expires = 365*24*60*60;
+ //TODO: Remove this line once we're confident in data in the mapObject.
+ $expires = 120;
+ header("Cache-Control: public, maxage=".$expires);
+ header('Expires: ' . gmdate('D, d M Y H:i:s', time()+$expires) . ' GMT');
+ header("Content-type: text/javascript");
+}
function getMapObjectByID($mapID) {
include_once('../includes/sqlEmbedded.php');
@@ -37,5 +51,27 @@ function getMapObjectByID($mapID) {
}
}
+function getMapIDsByDate($date) {
+ global $mysqli;
+ $sql = "SELECT MIN(mapOfTheDay.mapId) AS mapId
+ FROM `mapOfTheDay`
+ INNER JOIN
+ (
+ SELECT mapType, MIN(mapExpireTime) AS mapExpireTime
+ FROM mapOfTheDay
+ WHERE mapExpireTime > ?
+ GROUP BY mapType
+ ) AS expireTimes ON mapOfTheDay.mapType = expireTimes.mapType
+ AND mapOfTheDay.mapExpireTime = expireTimes.mapExpireTime
+ GROUP BY mapOfTheDay.mapType";
+ $stmt = $mysqli->prepare($sql);
+ $stmt->bind_param("s", $date);
+ $stmt->execute();
+ $stmt->bind_result($mapID);
+ while ($stmt->fetch()) {
+ $ids[] = $mapID;
+ }
+ return $ids;
+}
?> \ No newline at end of file
diff --git a/ajax/scores.ajax.php b/ajax/scores.ajax.php
index 7ba25d0..f2d38fc 100644
--- a/ajax/scores.ajax.php
+++ b/ajax/scores.ajax.php
@@ -8,153 +8,37 @@ $userID = $_SESSION['userID'];
require('../includes/maps.php');
require('../includes/mapclass.php');
require('../includes/datas.php');
-include_once('../includes/sqli.php');
-
-if ($_GET['getmap'] == 'true') {
- $mapID = $_GET['mapID'];
- $code = getMapCode($mapID);
- $map = GenerateMapByCode($code);
- echo displaymap($map, $mapID);
-}
-
-
-if ($_GET['getscores'] == 'true') {
-
-}
-
-if ($_GET['getmaplist'] == 'true') {
- $daysAgo = $_GET['daysago'];
- //echo "$daysAgo";
- $todaysScoreMaps = getMapsPlayed($daysAgo);
- echo getMapNavigation($todaysScoreMaps);
-}
-
-if (isset($_GET['getmapidsbydate'])) {
- //TODO: SANATIZE
- $requestDate = $_GET['getmapidsbydate'];
- echo json_encode(getMapIDsByDate($requestDate));
-}
-
-// Here is that SQL for you
-// SELECT correctMapIds.mapType, maps.ID, maps.code
-// FROM maps
-// INNER JOIN
-// (
- // SELECT MIN(mapOfTheDay.mapId) AS mapId, mapOfTheDay.mapType
- // FROM `mapOfTheDay`
- // INNER JOIN
- // (
- // SELECT mapType, MIN(mapExpireTime) AS mapExpireTime
- // FROM mapOfTheDay
- // WHERE mapExpireTime > DATE_ADD(CURDATE(), INTERVAL -1 DAY)
- // GROUP BY mapType
- // ) AS expireTimes ON mapOfTheDay.mapType = expireTimes.mapType
- // AND mapOfTheDay.mapExpireTime = expireTimes.mapExpireTime
- // GROUP BY mapOfTheDay.mapType
-// ) AS correctMapIds ON maps.ID = correctMapIds.mapId
-
-//TODO: SANITIZE.
-function getMapIDsByDate($date) {
- global $mysqli;
-$sql = "SELECT MIN(mapOfTheDay.mapId) AS mapId
-FROM `mapOfTheDay`
-INNER JOIN
-(
- SELECT mapType, MIN(mapExpireTime) AS mapExpireTime
- FROM mapOfTheDay
- WHERE mapExpireTime > ?
- GROUP BY mapType
-) AS expireTimes ON mapOfTheDay.mapType = expireTimes.mapType
- AND mapOfTheDay.mapExpireTime = expireTimes.mapExpireTime
-GROUP BY mapOfTheDay.mapType";
-
-$stmt = $mysqli->prepare($sql);
-$stmt->bind_param("s", $date);
-$stmt->execute();
-
- $stmt->bind_result($mapID);
- /* fetch values */
- while ($stmt->fetch()) {
- $ids[] = $mapID;
- }
-
- return $ids;
-
-var_dump($ids);
-
-
-while ($myrow[] = $result->fetch_assoc()) {}
-
- $result = mysql_query($sql) or die(mysql_error());
- if (mysql_num_rows($result) == 0) return -1;
- global $mapNamesByType;
- $r = array();
- while($data[] = mysql_fetch_array($result)) {
- $mapID = $data['mapID'];
- $mapType = $data['mapType'];
- $map = new map($code);
- if ($map->name == '')
- $map->name = $mapNamesByType[$mapType];
- $r[$mapID] = $map;
+include_once('../includes/sqlEmbedded.php');
+
+$tmp = explode('.', $_GET['r']);
+$args = explode('_', $tmp[0]);
+$mapID = $args[0] * 1;
+$page = $args[1] * 1;
+
+if (!is_int($mapID) OR !is_int($page)) return;
+
+//Include the notification text
+$json = getScores($mapID, $page, 10);
+$json['mapid'] = $mapID;
+$json['page'] = $page;
+
+//TODO: Show notifications someplace else!
+$note = false;
+if ($_SESSION['accepted'] == 1) {
+ $userID = $_SESSION['userID'];
+ $note = getNotified($userID);
+} else {
+ if ($_SESSION['preCompletedTutorial'] == true && $_SESSION['preCompletedTutorialNotified'] == false) {
+ $_SESSION['preCompletedTutorialNotified'] = true;
+ $note = "<strong>Tutorial Completed!</strong>";
+ $note .= "<center>You've unlocked: Blue Wall Color!";
+ $note .= "<table><tr><td onclick='changeWallColor(\"#4444ff\")' style='background-color:#4444ff;' class='grid_td_rocks'></td></tr></table>";
+ $note .= '<br /><a href="javascript:showSignin();"><strong>Sign in</strong></a> to save your progress!<br />';
+ $note .= "</center>";
}
- return $myrow;
}
+if ($note !== false) $json['notificationtext'] = $note;
-
-function getMapsPlayed($daysAgo) {
- // $sql = "
- // SELECT `mapID`, `code`, `mapType`
- // FROM `mapOfTheDay`
- // INNER JOIN `maps` ON `mapID` = maps.ID
- // WHERE DATE_ADD(CURDATE(), INTERVAL -$daysAgo DAY) =
- // mapDate AND
- // `mapType` IN (1, 2, 3, 4, 5)
- // ";
-
- $sql = "SELECT correctMapIds.mapType, maps.ID as mapID, maps.code
-FROM maps
-INNER JOIN
-(
- SELECT MIN(mapOfTheDay.mapId) AS mapId, mapOfTheDay.mapType
- FROM `mapOfTheDay`
- INNER JOIN
- (
- SELECT mapType, MIN(mapExpireTime) AS mapExpireTime
- FROM mapOfTheDay
- WHERE mapExpireTime > DATE_ADD(CURDATE(), INTERVAL -$daysAgo DAY)
- GROUP BY mapType
- ) AS expireTimes ON mapOfTheDay.mapType = expireTimes.mapType
- AND mapOfTheDay.mapExpireTime = expireTimes.mapExpireTime
- GROUP BY mapOfTheDay.mapType
-) AS correctMapIds ON maps.ID = correctMapIds.mapId";
-
- $result = mysql_query($sql) or die(mysql_error());
- if (mysql_num_rows($result) == 0)
- return -1;
- global $mapNamesByType;
- $r = array();
- while($data = mysql_fetch_array($result)) {
- $code = $data['code'];
- $mapID = $data['mapID'];
- $mapType = $data['mapType'];
- $map = new map($code);
- if ($map->name == '') $map->name = $mapNamesByType[$mapType];
- $r[$mapID] = $map;
-
- }
- return $r;
-}
-
-function getMapNavigation(&$maps) {
- foreach ($maps as $mapID => &$map) {
- $r .= "<div class='mapThumbnail' onclick='displayMap($mapID)'>";
- $r .= $map->name;
- $r .= DisplayMapThumbnail($map);
- $r .= "</div>";;
- }
- return $r;
-}
-
-
+echo json_encode($json);
?> \ No newline at end of file
diff --git a/ajax/users.ajax.php b/ajax/users.ajax.php
index 7ee9cc2..9ac3754 100644
--- a/ajax/users.ajax.php
+++ b/ajax/users.ajax.php
@@ -3,7 +3,7 @@ ob_start("ob_gzhandler");
//include('../includes/mapclass.php');
//include('../includes/maps.php');
-include_once('../includes/sqli.php');
+include_once('../includes/sqlEmbedded.php');
//Remove the ending .js
$tmp = explode(".", $_GET['userid']);
diff --git a/css/page.css b/css/page.css
index ad45e8b..2f4af87 100644
--- a/css/page.css
+++ b/css/page.css
@@ -255,10 +255,6 @@ position:absolute;color:#333;left:25px;bottom:20px;
-.topbarSpacer {
- width:900px;
- height:70px;
-}
.wrapper {
width: 900px;
margin: 0 auto;
@@ -283,12 +279,18 @@ position:absolute;color:#333;left:25px;bottom:20px;
float:right;
}
+.topbarSpacer {
+ width:900px;
+ height:0px;
+}
#topbar {
font-weight:bold;
- padding: 15px 15px;
- margin: 0 auto 40px;
- text-align: center;
+ padding: 15px 0px 15px 0px;
+ padding: 0px;
+ height:50px
+ text-align:center;
position: fixed; /* for #user */
+ position: relative;
min-width: 900px;
width:100%;
background: -moz-linear-gradient(top, #555, #222);
@@ -300,22 +302,30 @@ position:absolute;color:#333;left:25px;bottom:20px;
-khtml-opacity: 0.9;
opacity: 0.9;
}
-#topbar a.nav {
+#topbarContent {
+ margin: 0 auto;
+ position: relative;
+ text-align: center;
+ width:900px;
+ height:100%;
+}
+#topbarContent a.nav {
background-color: #222;
- margin-right: 15px;
+ display: inline-block;
+ margin: 7px;
padding: 7px 10px;
border-radius: 5px;
text-decoration: none;
border: 1px solid #333;
box-shadow: 0 0 1px #444;
}
-#topbar a.nav.selected, #topbar a.nav:hover {
+#topbarContent a.nav.selected, #topbarContent a.nav:hover {
border: 1px solid #222;
background-color: #2c2c2c;
}
-#topbar #user {
+#topbarContent #user {
position: absolute;
- right: 45px;
+ right: 10px;
top: 5px;
text-align: right;
}
diff --git a/do.php b/do.php
index ae8ccc3..f85539f 100644
--- a/do.php
+++ b/do.php
@@ -72,6 +72,8 @@ if ($_GET['r'] == 'reqMemberPage') {
die($encoded);
}
+
+//TODO: DEPRECIATE!
if ($_GET['r'] == 'reqScorePage') {
$mapID = $_GET['mapid'] + 0;
$page = $_GET['reqPage'] + 0;
@@ -366,19 +368,6 @@ $json['error'][] = 'Rush-send failed';
die(json_encode($json));
-function isCurrentMap($mapID) {
- include_once('./includes/sqlEmbedded.php');
- $sql = "SELECT mapID
- FROM `mapOfTheDay`
- WHERE `mapID` = '$mapID'
- AND mapExpireTime > NOW()
- LIMIT 1
- ";
-
- $result = mysql_query($sql) or die(mysql_error());
- return (mysql_num_rows($result) != 0);
-}
-
//Very simple, confirm that all targets are reachable.
function ValidateMap($mygrid) {
$start = "0,1.";
diff --git a/humans.txt b/humans.txt
new file mode 100644
index 0000000..acb0b70
--- /dev/null
+++ b/humans.txt
@@ -0,0 +1,40 @@
+/* People Behind Pathery */
+/* see humanstxt.org */
+
+/* TEAM */
+ Founder/Creator/Lead Design: Patrick Davison
+ Nickname: Snap
+ Contact: snap [at] pathery.com
+ Twitter: @snapems
+ From: Eugene, Oregon. US
+
+ Founder:Rex Ounekeo
+ From: Texas. US
+
+ Developer: <>
+ Nickname: BlueRaja
+ From: <>
+
+ Mobile - iOS Dev: <Nath>
+
+ Mobile - iOS Dev: <Ande>
+
+/* THANKS */
+
+ Nickname: raylu
+
+ Name: Steven Gosling
+
+/* SITE */
+ Language: English
+ Standards: HTML5, CSS3
+ Components: jQuery
+ IDE: Notepad++, NetBeans, GIMP, Freesounds.org
+ Launch: March 13th 2011
+
+__________ __ .__
+\______ \_____ _/ |_| |__ ___________ ___.__.
+ | ___/\__ \\ __\ | \_/ __ \_ __ < | |
+ | | / __ \| | | Y \ ___/| | \/\___ |
+ |____| (____ /__| |___| /\___ >__| / ____|
+ \/ \/ \/ \/ \ No newline at end of file
diff --git a/includes/chats.php b/includes/chats.php
index dcd46c9..18d0810 100644
--- a/includes/chats.php
+++ b/includes/chats.php
@@ -2,7 +2,7 @@
/*
* addChat, getChat functions
*/
-include_once('sqli.php');
+include_once('sqlEmbedded.php');
define('CHAT_ROWS_TO_KEEP', 75);
diff --git a/includes/datas.php b/includes/datas.php
index c64edd6..b029375 100644
--- a/includes/datas.php
+++ b/includes/datas.php
@@ -978,4 +978,20 @@ function loadChallengeMapCode($mapIdUnsanitized)
}
return NULL;
}
+
+
+function isCurrentMap($mapID) {
+ include_once('./includes/sqlEmbedded.php');
+ $sql = "SELECT mapID
+ FROM `mapOfTheDay`
+ WHERE `mapID` = '$mapID'
+ AND mapExpireTime > NOW()
+ LIMIT 1
+ ";
+
+ $result = mysql_query($sql) or die(mysql_error());
+ return (mysql_num_rows($result) != 0);
+}
+
+
?>
diff --git a/includes/emails.php b/includes/emails.php
index 182749c..74658ad 100644
--- a/includes/emails.php
+++ b/includes/emails.php
@@ -2,7 +2,7 @@
/*
* Email methods; QueueEmail and SendQueuedEmail
*/
-include_once('sqli.php');
+include_once('sqlEmbedded.php');
//Email sending lock
define('FILE_EMAIL_LOCK', './emailLockFile');
diff --git a/includes/header.php b/includes/header.php
index c18ae2e..7d9c02d 100644
--- a/includes/header.php
+++ b/includes/header.php
@@ -155,7 +155,7 @@ function htmlFooter() {
function topbar($links) {
global $accepted, $wallColor, $wallEmblem, $request;
- echo '<div id="topbar">';
+ echo '<div id="topbar"><div id="topbarContent">';
foreach ($links as $key => $value) {
if ($request == $key) {
@@ -199,7 +199,7 @@ function topbar($links) {
<?
}
echo " </div>";
- echo "</div><div class='topbarSpacer'></div>"; //div id='user'
+ echo "</div></div><div class='topbarSpacer'></div>"; //div id='user'
}
function userDataToJS() {
diff --git a/includes/sqlEmbedded.php b/includes/sqlEmbedded.php
index b7a32b5..64fa5c5 100644
--- a/includes/sqlEmbedded.php
+++ b/includes/sqlEmbedded.php
@@ -1,6 +1,9 @@
<?php
include_once('db.inc.php');
+global $mysqli;
+$mysqli = @mysqli_connect($db_host, $db_user, $db_pass, $db_name) or die("SQLI Failed to connect to database");
+
global $mysqlid;
$mysqlid = @mysql_connect($db_host,$db_user, $db_pass) or die("Cannot connect to database.");
@mysql_select_db($db_name, $mysqlid) or die("Invalid database.");
diff --git a/includes/sqli.php b/includes/sqli.php
deleted file mode 100644
index d19069b..0000000
--- a/includes/sqli.php
+++ /dev/null
@@ -1,4 +0,0 @@
-<?php
-include_once('db.inc.php');
-$mysqli = mysqli_connect($db_host, $db_user, $db_pass, $db_name) or die("Failed to connect to database");
-?> \ No newline at end of file
diff --git a/js/mapspecs.js b/js/mapspecs.js
index 2a5bd1d..9cbd336 100644
--- a/js/mapspecs.js
+++ b/js/mapspecs.js
@@ -761,12 +761,14 @@ function useSolution(mapid, inputSolution, moves, tempWallColor, tempWallEmblem)
solution[mapid] = inputSolution;
var animateA = "showTempSolution(\""+mapid+"\", \""+inputSolution+"\", \""+moves+"\", \""+tempWallColor+"\", \""+tempWallEmblem+"\");";
var animateB = "showTempSolution(\""+mapid+"\", \""+inputSolution+"\", \""+moves+"\", false, false);";
+ //TODO: Sticky colors for the placed walls by the user would be cool.
+ //var animateC = "wallColor = false; wallEmblem = false;";
setTimeout(animateA, 50);
- setTimeout(animateB, 100);
- setTimeout(animateA, 150);
- setTimeout(animateB, 200);
+ setTimeout(animateB, 150);
setTimeout(animateA, 250);
- setTimeout(animateB, 450);
+ setTimeout(animateB, 350);
+ setTimeout(animateA, 450);
+ setTimeout(animateB, 550);
}
//Shows a solution for temporary use, see 'RestoreSolution'
function showTempSolution(mapid, tempSolution, moves, tempWallColor, tempWallEmblem) {
diff --git a/js/scores.js b/js/scores.js
index 161f1ae..b062c28 100644
--- a/js/scores.js
+++ b/js/scores.js
@@ -20,7 +20,8 @@ function scoresRequestPage(mapid, page) {
//console.log("Requesting Page", mapid, page, ajax.inUse);
// == Additionally, check for achievements.
- ajax.requestFile = "do.php?r=reqScorePage&mapid="+mapid+"&reqPage="+page;
+ //ajax.requestFile = "do.php?r=reqScorePage&mapid="+mapid+"&reqPage="+page;
+ ajax.requestFile = "a/score/"+mapid+"_"+page+".js";
ajax.onCompletion = scoresRequestPageDone; // Specify function to be executed on response.
//ajax.onLoading = '';
//ajax.onLoaded = '';
@@ -146,7 +147,10 @@ function scoresFormatPage(JO) {
var rowclass = 'scoreRow'+((i % 2)+1);
- if (u.isUser) {
+ // if (u.isUser) {
+ // rowclass = 'scoreRowSelf';
+ // }
+ if (u.ID == userObj.ID) {
rowclass = 'scoreRowSelf';
}
diff --git a/pages/admin.php b/pages/admin.php
index 24feda4..e98dc49 100644
--- a/pages/admin.php
+++ b/pages/admin.php
@@ -9,7 +9,7 @@ topbar($Links);
include_once('./includes/datas.php');
include_once('./includes/maps.php');
include_once('./includes/mapoftheday.php');
-include_once('./includes/sqli.php');
+include_once('./includes/sqlEmbedded.php');
include_once('./includes/playerStats.php');
include_once('./includes/chats.php');
diff --git a/pages/massemail.php b/pages/massemail.php
index 4bbd26b..d2634ef 100644
--- a/pages/massemail.php
+++ b/pages/massemail.php
@@ -77,7 +77,7 @@ if ($_POST['queueMassEmail'] == 'true') {
exit;
}
-include_once('./includes/sqli.php');
+include_once('./includes/sqlEmbedded.php');
$res = mysqli_query($mysqli, "SELECT count(*) as count FROM `emailQueue`");
$row = mysqli_fetch_assoc($res);
diff --git a/pages/scores.php b/pages/scores.php
index f3ce459..3a28494 100644
--- a/pages/scores.php
+++ b/pages/scores.php
@@ -1,6 +1,6 @@
<?php
htmlHeader(
- array('stats', 'challenge'), 'Scores',
+ array('stats'), 'Scores',
'Score history for Pathery',
array('scores', 'dateformat')
);
@@ -30,7 +30,10 @@ playerWallEmblem = '<?PHP echo isset($wallEmblem) ? $wallEmblem : ''; ?>';
</script>
<script>
-
+//TODO: Might want to store this time globablly.
+//March 8th 2011; first started storing maps on pathery.com
+var startOfPathery = new Date();
+startOfPathery.setTime(1299571200000);
var tomorrow = new Date();
tomorrow.setTime(tomorrow.getTime() + <? echo $timeUntilNewDailyMap; ?> * 1000);
@@ -98,29 +101,39 @@ var pointerDate;
function getMapIDs(request) {
switch (request) {
case "next":
- if (pointerTime.getTime() + (24*60*60*1000) < serverTime.getTime()) {
+ if (pointerTime.getTime() + (24*60*60*1000) <= serverTime.getTime()) {
pointerTime.setTime(pointerTime.getTime() + (24*60*60*1000));
pointerDate = pointerTime.format("yyyy-mm-dd");
} else return;
break;
case "prev":
- if (pointerTime.getTime() + (24*60*60*1000) > 1) {
+ if (pointerTime.getTime() > startOfPathery.getTime()) {
pointerTime.setTime(pointerTime.getTime() - (24*60*60*1000));
pointerDate = pointerTime.format("yyyy-mm-dd");
} else return;
break;
}
- $('#displayDate').html(pointerTime.format("dddd, mmmm dS, yyyy"));
+ var timeDisplayPrefix = '';
if (pointerTime.getTime() + (1*24*60*60*1000) > serverTime.getTime()) {
$('#mapNavRight').removeClass('mapNavActive');
$('#mapNavRight').addClass('mapNavDisabled');
+ timeDisplayPrefix = '<i title="(Server Time)">Today </i>';
} else {
$('#mapNavRight').addClass('mapNavActive');
$('#mapNavRight').removeClass('mapNavDisabled');
}
+ if (pointerTime.getTime() <= startOfPathery.getTime()) {
+ $('#mapNavLeft').removeClass('mapNavActive');
+ $('#mapNavLeft').addClass('mapNavDisabled');
+ timeDisplayPrefix = '<i title="The start!">Pathery Started </i>';
+ } else {
+ $('#mapNavLeft').addClass('mapNavActive');
+ $('#mapNavLeft').removeClass('mapNavDisabled');
+ }
+ $('#displayDate').html(timeDisplayPrefix+pointerTime.format("dddd, mmmm dS, yyyy"));
- var urlString = "ajax/scores.ajax.php?getmapidsbydate="+pointerDate;
+ var urlString = "a/mapsbydate/"+pointerDate+'.js';
updateHash();
$.ajax({
type: "GET",
@@ -152,15 +165,18 @@ function getMapIDsResponse(response) {
//Add non-existing maps
//console.log("going through json", json);
+ var lastMapID = 0;
$.each(json, function(key, mapID) {
//console.log("add: compare:", mapID, mapsInNav);
if (jQuery.inArray(mapID, mapsInNav) == -1) {
addMapToNav(mapID);
- if (goToPointer == true && pointerMapID < 0) {
- pointerMapID = mapID;
- }
+ lastMapID = mapID;
}
});
+ if (goToPointer == true && pointerMapID < 0) {
+ pointerMapID = lastMapID;
+ }
+
//Don't queue animations...
if ($('#mapNavigation').is(':animated')) {
$("#mapNavigation").show(0);
@@ -179,8 +195,7 @@ function addMapToNav(mapID) {
//$("#mapNavigation").append($newdiv1);
$("#mapNavigation").prepend($newdiv1);
- //var URLString = 'map/'+mapID+'.js';
- var URLString = 'map/'+mapID;
+ var URLString = 'a/map/'+mapID+'.js';
$.ajax({
type: "GET",