diff options
author | Patrick Davison <snapwilliam@gmail.com> | 2013-02-26 03:20:06 -0800 |
---|---|---|
committer | Patrick Davison <snapwilliam@gmail.com> | 2013-02-26 03:20:06 -0800 |
commit | 3cff5246a07c9fc3fcf0a3e2ab63c79349820e42 (patch) | |
tree | b3e0b734a469a3a99d78e50ccf807348d825843c | |
parent | f46a9fe7be0214cdf9a2b37fd1a93934d2dfac85 (diff) | |
download | pathery-3cff5246a07c9fc3fcf0a3e2ab63c79349820e42.tar.xz |
BUGFIX: I hate Javascript Time. CSS changes too.
-rw-r--r-- | css/stats.css | 25 | ||||
-rw-r--r-- | pages/scores.php | 57 |
2 files changed, 52 insertions, 30 deletions
diff --git a/css/stats.css b/css/stats.css index 166573d..83a8341 100644 --- a/css/stats.css +++ b/css/stats.css @@ -48,18 +48,26 @@ border-radius: 0px 25px 6px 0px; vertical-align: middle; text-align:center; - line-height: 130px; + line-height: 126px; text-decoration: none; background-color: #262631; font-size:200%; border-radius: 5px; border: 1px solid #333; + cursor: auto; +} +.mapNavActive { + cursor: auto; } .mapNavActive:hover { background-color: #343c57; } +.mapNavActive:active { + background-color: #555588; +} .mapNavDisabled { background-color: #222223; + cursor: default; } .mapNavCenter { float:left; @@ -81,6 +89,18 @@ overflow-y:hidden; } +.scoreCol { + min-height:500px; + min-width:277px; + float:left; +} +.mapCol { + min-height:500px; + float:left; + margin-left: 7px; + max-width:500px; +} + .mapThumbnail { display:inline-block; padding: 8px; @@ -168,6 +188,9 @@ td, th { .scoreActive:hover { background-color: #343c57; } +.scoreActive:active { + background-color: #555588; +} .scoreDisabled { background-color: #222223; } diff --git a/pages/scores.php b/pages/scores.php index 3a28494..03e049b 100644 --- a/pages/scores.php +++ b/pages/scores.php @@ -15,13 +15,13 @@ if (isset($_GET['date'])) { } else $dateLookup = $dateDisplay;
-$dateNextDay = date('Y-m-d', strtotime("+1 day", $dateAgo));
-
-//!! TODO:
-$timeUntilNewDailyMap = strtotime("tomorrow") - strtotime("now");
+$jsYear = date("Y");
+//The part where you face palm...
+$jsMonth = date("n") - 1;
+$jsDay = date("j");
+$jsDate = "$jsYear,$jsMonth,$jsDay";
?>
-
<script type="text/javascript" src="js/jquery.keystrokes.min.js"></script>
<script type="text/javascript">
@@ -30,21 +30,12 @@ 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 startOfPathery = new Date(2011,2,13);
-var tomorrow = new Date();
-tomorrow.setTime(tomorrow.getTime() + <? echo $timeUntilNewDailyMap; ?> * 1000);
-var serverTomorrow = '<? echo $dateNextDay; ?>';
-
-var serverTime = new Date();
-serverTime.setTime(<? echo time() * 1000; ?>);
+var serverToday = new Date(<? echo $jsDate; ?>);
var pointerTime = new Date();
-pointerTime.setTime(serverTime.getTime())
-
+pointerTime.setTime(serverToday.getTime())
setTimeout("start();", 500);
@@ -63,7 +54,17 @@ function start() { }
getMapIDs('prev');
}
-//$(window).on('hashchange', function() {
+
+function addDay(dateObj) {
+ var d = dateObj;
+ d.setDate(d.getDate()+1);
+ return d;
+}
+function minusDay(dateObj) {
+ var d = dateObj;
+ d.setDate(d.getDate()-1);
+ return d;
+}
//Contra
$(document).bind('keystrokes', {
@@ -101,20 +102,20 @@ var pointerDate; function getMapIDs(request) {
switch (request) {
case "next":
- if (pointerTime.getTime() + (24*60*60*1000) <= serverTime.getTime()) {
- pointerTime.setTime(pointerTime.getTime() + (24*60*60*1000));
+ if (pointerTime.getTime() < serverToday.getTime()) {
+ addDay(pointerTime);
pointerDate = pointerTime.format("yyyy-mm-dd");
} else return;
break;
case "prev":
if (pointerTime.getTime() > startOfPathery.getTime()) {
- pointerTime.setTime(pointerTime.getTime() - (24*60*60*1000));
+ minusDay(pointerTime);
pointerDate = pointerTime.format("yyyy-mm-dd");
} else return;
break;
}
var timeDisplayPrefix = '';
- if (pointerTime.getTime() + (1*24*60*60*1000) > serverTime.getTime()) {
+ if (pointerTime.getTime() >= serverToday.getTime()) {
$('#mapNavRight').removeClass('mapNavActive');
$('#mapNavRight').addClass('mapNavDisabled');
timeDisplayPrefix = '<i title="(Server Time)">Today </i>';
@@ -192,11 +193,9 @@ function addMapToNav(mapID) { //console.log("adding map to nav:", mapID);
var $newdiv1 = $("<div style='float:left;min-width:120px;' id='thumb_"+mapID+"'/>");
- //$("#mapNavigation").append($newdiv1);
$("#mapNavigation").prepend($newdiv1);
var URLString = 'a/map/'+mapID+'.js';
-
$.ajax({
type: "GET",
url: URLString,
@@ -242,7 +241,7 @@ function mapThumbnailHTML(map, targetWidth) { var mapClass = '';
var toolTip = 'Inactive map';
var mapDate = new Date(map.dateExpires*1000);
- if (mapDate.getTime() > serverTime.getTime()) {
+ if (mapDate.getTime() > serverToday.getTime()) {
mapClass = ' current';
toolTip = 'This map can still be played.';
}
@@ -285,8 +284,8 @@ topbar($Links); </div>
<div class='mapNavCon'>
- <div id='mapNavLeft' class='mapNavLeft mapNavActive' onclick='javascript:getMapIDs("prev");'><</div>
- <div id='mapNavRight' class='mapNavRight mapNavActive' onclick='javascript:getMapIDs("next");'>></div>
+ <a id='mapNavLeft' class='mapNavLeft mapNavActive' href='javascript:getMapIDs("prev");'><</a>
+ <a id='mapNavRight' class='mapNavRight mapNavActive' href='javascript:getMapIDs("next");'>></a>
<div class='mapNavCenter'>
<div id='mapNavigation'></div>
</div>
@@ -294,8 +293,8 @@ topbar($Links); <div style='clear:both'></div>
<div>
- <div id='scoreDisplay' style="float:left;"></div>
- <div id='mapDisplay' style='display:none; float:left;' class="col2"></div>
+ <div class='scoreCol' id='scoreDisplay'></div>
+ <div class="mapCol" id='mapDisplay' style='display:none; float:left;'></div>
</div>
|