summaryrefslogtreecommitdiffstats
path: root/pages/home.php
diff options
context:
space:
mode:
authorPatrick Davison <snapwilliam@gmail.com>2012-04-17 16:18:58 -0700
committerPatrick Davison <snapwilliam@gmail.com>2012-04-17 16:18:58 -0700
commit2423be0ef89645690786060ef2318525c29bedeb (patch)
treec717a91f89cf69506297bedf00ab5bfcb3915187 /pages/home.php
parentd61d75979ee9b98cd35fdc89b01ce9e9ae0ee3f3 (diff)
downloadpathery-2423be0ef89645690786060ef2318525c29bedeb.tar.xz
Meta description & Clock
Also added an update button to scores
Diffstat (limited to 'pages/home.php')
-rw-r--r--pages/home.php53
1 files changed, 32 insertions, 21 deletions
diff --git a/pages/home.php b/pages/home.php
index fb1d434..71bcd33 100644
--- a/pages/home.php
+++ b/pages/home.php
@@ -1,5 +1,5 @@
<?php
-htmlHeader(array('stats'), 'Pathery');
+htmlHeader(array('stats'), 'Pathery', 'Compete to create the longest maze possible. 4 New maps every day at 9 PM Pacific');
include_once ('./includes/maps.php');
include_once ('./includes/mapoftheday.php');
@@ -98,17 +98,13 @@ topbar($Links);
?>
<div class="wrapper">
-<strong>If you notice any issues, please press the Refresh button on your browser.</strong>
-<p><strong>M</strong>any improvements including Achievements have been added!
-<br />Please <a href='about'>email me or contact me</a> if you have suggestions!
-</p>
- <?
- if ($_SESSION['accepted'] == 1) {
- if (tutorialComplete($userID) == false) {
- echo "<center><a href='tutorial'>Complete the tutorial</a> to unlock a blue wall color:";
- echo "<table><tr><td style='background-color:#4444ff;' class='grid_td_rocks'></td></tr></table></center><br />";
- }
+
+<?
+if ($_SESSION['accepted'] == 1) {
+ if (tutorialComplete($userID) == false) {
+ echo "<center><a href='tutorial'>Complete the tutorial</a> to unlock a blue wall color:";
+ echo "<table><tr><td style='background-color:#4444ff;' class='grid_td_rocks'></td></tr></table></center><br />";
}
}
@@ -156,7 +152,7 @@ function displayMaze($motd, $mapType) {
//data for the topscores
$topscores = topScores($motd['id'], 30);
- $topscorediv = "<div id='$mapID,dspScore'>\n$topscores\n</div>";
+ $topscorediv = "<center><a href='javascript:updateScoresReq($mapID);'>Update</a></center> <div id='$mapID,dspScore'>\n$topscores\n</div>";
$userID = $_SESSION['userID'];
if ($_SESSION['accepted'] == 1) {
@@ -213,21 +209,32 @@ $timerem = strtotime("tomorrow") - strtotime("now");
</div>
<script type="text/javascript">
var countdownInt = self.setInterval(countdown, 1000);
- var tomorrow = new Date().getTime() + <? echo $timerem; ?> * 1000;
+ var tomorrow = new Date();
+ //We're counting down to "tomorrow"
+ tomorrow.setTime(tomorrow.getTime() + <? echo $timerem; ?> * 1000);
function countdown() {
var now = new Date();
- var timerem = new Date(tomorrow - now + now.getTimezoneOffset() * 60 * 1000);
- if (timerem < 1000)
+ now.setTime(now.getTime());
+ //Find the difference in seconds between now and tomorrow.
+ var timerem = tomorrow.getTime() - now.getTime();
+
+ timerem = timerem / 1000;
+ if (timerem < 1)
window.clearInterval(countdownInt);
- var hours = addZero(timerem.getHours());
- var minutes = addZero(timerem.getMinutes());
- var seconds = addZero(timerem.getSeconds());
+ var hours = addZero(timerem/3600);
+ timerem = timerem%3600;
+
+ var minutes = addZero(timerem/60);
+ timerem = timerem%60;
+
+ var seconds = addZero(timerem);
var stamp = hours + ":" + minutes + ":" + seconds;
document.getElementById("countdown").innerHTML = stamp;
}
function addZero(num) {
+ num = Math.floor(num);
var numStr = num + '';
if (numStr.length < 2)
numStr = "0" + numStr;
@@ -249,9 +256,6 @@ function showStats(type) {
for (var i = 1; i <= 4; i++) {
var elem = document.getElementById("yms-" + i);
elem.className = elem.className.replace('shown-maps', 'hidden-maps');
- // var elem = document.getElementById("yms-" + i);
- // if (elem.className.indexOf('hidden-maps') < 0)
- // elem.className += 'hidden-maps';
elem = document.getElementById("dl-" + i);
elem.className = elem.className.replace('selected', '');
}
@@ -260,6 +264,13 @@ function showStats(type) {
elem = document.getElementById("dl-" + type);
if (elem.className.indexOf('selected') < 0)
elem.className += 'selected';
+
+ var x = 0;
+ for(var mapid in jsonmapdata) {
+ x++;
+ if (x == type)
+ updateScoresReq(mapid);
+ }
}
showStats(1);
</script>