diff options
author | Patrick Davison <snapwilliam@gmail.com> | 2013-02-17 03:06:24 -0800 |
---|---|---|
committer | Patrick Davison <snapwilliam@gmail.com> | 2013-02-17 03:06:24 -0800 |
commit | e6ecd5ae507731050d7281f2a2a192849f41912b (patch) | |
tree | 07956b8f2725935dd5fd6078a1c2f95d64bf5b40 | |
parent | aecf8ced62fd1e8594239566d62f5cc71e8fd27c (diff) | |
download | pathery-e6ecd5ae507731050d7281f2a2a192849f41912b.tar.xz |
Now using Jquery everywhere.
Moved displayMap to mapSpecs.
Using displayMap @ Home.
Cleaned up scores page.
-rw-r--r-- | includes/header.php | 8 | ||||
-rw-r--r-- | js/mapspecs.js | 27 | ||||
-rw-r--r-- | js/scores.js | 3 | ||||
-rw-r--r-- | pages/home.php | 20 | ||||
-rw-r--r-- | pages/scores.php | 88 |
5 files changed, 58 insertions, 88 deletions
diff --git a/includes/header.php b/includes/header.php index 11a99db..1888392 100644 --- a/includes/header.php +++ b/includes/header.php @@ -9,7 +9,7 @@ function htmlHeader($css = array(), $title = 'Pathery', $desc = '', $scripts = a <title><? echo $title; ?></title>
<link href="css/page.css?v=011013" rel="stylesheet" type="text/css" />
- <link href="css/maps.css?v=121212" rel="stylesheet" type="text/css" />
+ <link href="css/maps.css?v=122612" rel="stylesheet" type="text/css" />
<?php
foreach ($css as $c) {
echo " <link href=\"css/$c.css\" rel=\"stylesheet\" type=\"text/css\" />\n";
@@ -19,8 +19,10 @@ function htmlHeader($css = array(), $title = 'Pathery', $desc = '', $scripts = a foreach ($scripts as $s) echo "<script src='js/$s.js?v=122612'></script>";
?>
<script src="js/ajax.js" async="async"></script>
- <script src="js/mapspecs.js?v=121212"></script>
- <script src="js/globe.js?v=122312"></script>
+ <script src="js/mapspecs.js?v=122612"></script>
+ <script src="js/globe.js?v=122612"></script>
+
+ <script src="//ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>
<script>
(function(c,a){window.mixpanel=a;var b,d,h,e;b=c.createElement("script");b.type="text/javascript";b.async=!0;b.src=("https:"===c.location.protocol?"https:":"http:")+'//cdn.mxpnl.com/libs/mixpanel-2.1.min.js';d=c.getElementsByTagName("script")[0];d.parentNode.insertBefore(b,d);a._i=[];a.init=function(b,c,f){function d(a,b){var c=b.split(".");2==c.length&&(a=a[c[0]],b=c[1]);a[b]=function(){a.push([b].concat(Array.prototype.slice.call(arguments,0)))}}var g=a;"undefined"!==typeof f?
diff --git a/js/mapspecs.js b/js/mapspecs.js index 3aa123f..6bf7185 100644 --- a/js/mapspecs.js +++ b/js/mapspecs.js @@ -799,13 +799,34 @@ function restoreSolution(mapid) { showTempSolution(mapid, mapdata[mapid].savedSolution, 0, false, false);
}
+function displayMap(mapid, divID, goalSize, solution, moves, challengeMap) {
+
+ var stringURL = 'map/'+mapid+".js";
+ if (challengeMap == true) stringURL = 'challenge/'+mapid+".js";
+ $.ajax({
+ type: "GET",
+ url: 'map/'+mapid+".js",
+ dataType: 'json',
+ cache: true,
+ data: '',
+ //TODO: Better fail option?
+ fail: (function() { console.log("FAIL Map Download"); }),
+ complete: function(data) {
+ $("#"+divID).html(mapAsHTML(decryptJSON(data.responseText), goalSize)).fadeIn('slow');
+ mapdata[mapid].savedSolution = solution;
+ restoreSolution(mapid);
+ }
+ });
+ console.log("dispMapExt");
+}
+
//Map as object. If target width is NULL or False, default width is used.
function mapAsHTML(map, targetWidth, demo) {
- console.log("loading MapHTML for ", map);
+ //console.log("loading MapHTML for ", map);
map.mapid = map.ID;
- console.log("MapID:", map.mapid);
- console.log("MapObj", map);
+ //console.log("MapID:", map.mapid);
+ //console.log("MapObj", map);
mapdata[map.ID] = map;
//595
diff --git a/js/scores.js b/js/scores.js index 7c97a2d..161f1ae 100644 --- a/js/scores.js +++ b/js/scores.js @@ -108,10 +108,9 @@ function scoresPreparePage (mapid, page) { var scoresShowNavSideBtns = false;
function scoresFormatPage(JO) {
- // console.log("Formating page");
var p = "<table class='score'>";
- console.log("jo object", JO);
+ //console.log("jo object", JO);
var navi = '';
if (JO.pageCount > 1) {
navi = "<tr><th colspan='3' style='text-align:center;'>"+formatPageNavi(JO, "scoresShowPage", JO.mapid)+"</th></tr>";
diff --git a/pages/home.php b/pages/home.php index 31ea756..544b3fe 100644 --- a/pages/home.php +++ b/pages/home.php @@ -219,37 +219,23 @@ function displayMaze($motd, $mapType) { $r = "<div id=\"yms-$mapType\" class='hidden-maps'>";
$r .= " <div class='wrapper'>";
-
$r .= " <div style='text-align: center;'>";
$r .= " <div style='display:inline-block;margin: 0 auto;text-align: left;'>";
$r .= " <a href='javascript:requestSol(\"$mapID\");'><strong>Load your best solution</strong></a><br />";
- //TMP
-
- $mapObj = new map(getMapCode($mapID), $mapID);
- $mapJSON = json_encode($mapObj);
- $r .= "<div id='innerMapDsp_$mapID'>";
- $r .= "</div>";
+ $r .= "<div id='innerMapDsp_$mapID'>\n";
+ $r .= "</div>\n";
$r .= "<script>";
- $r .= "document.getElementById('innerMapDsp_$mapID').innerHTML = mapAsHTML(decryptJSON('$mapJSON'));";
+ $r .= "displayMap($mapID, 'innerMapDsp_$mapID', false, '$mysolution', '$mymoves');";
$r .= "</script>";
-
-
//$r .= DisplayMap($map, $mapID);
$r .= " </div></div>";
-
$r .= " <div style='padding-top: 20px;'>";
$r .= $topscorediv;
$r .= ' </div>';
-
$r .= ' </div>';
$r .= '</div>';
-
- $mapSolDiv = "<script>
- loadSol(\"$mapID:$mysolution\", \"$mymoves\");
- </script>";
- $r .= $mapSolDiv;
//Clear our floatingness
$r .= '<div style="clear: both"></div>';
diff --git a/pages/scores.php b/pages/scores.php index 118dfa7..cf33b49 100644 --- a/pages/scores.php +++ b/pages/scores.php @@ -5,51 +5,23 @@ htmlHeader( array('scores', 'dateformat')
);
-include_once('./includes/maps.php');
-//include('./includes/mapoftheday.php');
-include_once('./includes/datas.php');
-include_once('./includes/mapclass.php');
-include_once('./includes/constants.php');
-
-include_once ('./includes/sqlEmbedded.php');
-
-$time_start = microtime(true);
-$time_end = microtime(true);
-
-//TESTCODE
-
-$time = $time_end - $time_start;
-if ($_GET['debug'] == true) echo "StatContent Rechieve: $time seconds\n";
-
-
//The date to display
$dateDisplay = date('Y-m-d', strtotime("-1 days"));
//This is only used in a strtotime function, so this should be safe.
if (isset($_GET['date'])) {
$dateLookup = $_GET['date'];
- if (!strtotime($dateLookup))
- $dateLookup = $dateDisplay;
-} else
- $dateLookup = $dateDisplay;
-
-$daysAgo = day_diff($dateLookup, date('Y-m-d'));
-$dateAgo = strtotime("-$daysAgo days");
+ if (!strtotime($dateLookup)) $dateLookup = $dateDisplay;
+} else $dateLookup = $dateDisplay;
-$dateAsStr = date('l, F jS, Y', $dateAgo);
$dateNextDay = date('Y-m-d', strtotime("+1 day", $dateAgo));
-$datePrevDay = date('Y-m-d', strtotime("-1 day", $dateAgo));
-
-//No cheater cheaters
-if ($daysAgo < 1)
- die("You must specify a date previous to today.");
//!! TODO:
$timeUntilNewDailyMap = strtotime("tomorrow") - strtotime("now");
?>
-<script src="//ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>
+
<script type="text/javascript" src="js/jquery.keystrokes.min.js"></script>
<script type="text/javascript">
@@ -98,19 +70,6 @@ keys: ['arrow up', 'arrow up', 'arrow down', 'arrow down', 'arrow left', 'arrow alert('You unlocked awesomeness!');
});
-function displayMap(mapID, divID, goalSize) {
- $("#mapDisplay").fadeOut('fast');
- $.ajax({
- type: "GET",
- url: 'map/'+mapID+".js",
- cache: true,
- data: '',
- //TODO: Better fail option?
- fail: (function() { console.log("FAIL Map Download"); }),
- complete: function(data) {$("#"+divID).html(mapAsHTML(decryptJSON(data.responseText), goalSize)).fadeIn('slow');}
- });
-}
-
function displayMapScores(mapID) {
pointerMapID = mapID;
updateHash();
@@ -123,6 +82,7 @@ function displayMapScores(mapID) { newDiv.prependTo('#scoreDisplay');
}
scoresShowPage(1, mapID);
+ $("#mapDisplay").fadeOut('fast');
displayMap(mapID, "mapDisplay", 595);
}
@@ -136,10 +96,7 @@ function updateHash() { }
var pointerDate;
-function getMapIDs(request) {
- console.log("getMapIDs exe", request);
-
- pointerDate = request;
+function getMapIDs(request) {
switch (request) {
case "next":
if (pointerTime.getTime() + (24*60*60*1000) > serverTime.getTime()) {
@@ -159,8 +116,6 @@ function getMapIDs(request) { pointerDate = pointerTime.format("yyyy-mm-dd");
break;
}
-
- console.log("setting showdate");
$('#displayDate').html(pointerTime.format("dddd, mmmm ddS, yyyy"));
var urlString = "ajax/scores.ajax.php?getmapidsbydate="+pointerDate;
@@ -283,31 +238,38 @@ function mapThumbnailHTML(map, targetWidth) { <body>
<?php
+echo soundManager2();
topbar($Links);
?>
<div class="wrapper">
-<div style='font-size: 105%;text-align:center;padding-bottom:7px;' id='displayDate'>
-Loading...
-</div>
+ <div style='font-size: 105%;text-align:center;padding-bottom:7px;' id='displayDate'>
+ Loading...
+ </div>
-<div id="daynav">
-<div class='mapNavCon'>
- <div class='mapNavLeft mapNavBtn' onclick='javascript:getMapIDs("prev");'><</div>
- <div class='mapNavRight mapNavBtn' onclick='javascript:getMapIDs("next");'>></div>
- <div class='mapNavCenter'>
- <div id='mapNavigation'>
- Loading...
+ <div class='mapNavCon'>
+ <div class='mapNavLeft mapNavBtn' onclick='javascript:getMapIDs("prev");'><</div>
+ <div class='mapNavRight mapNavBtn' onclick='javascript:getMapIDs("next");'>></div>
+ <div class='mapNavCenter'>
+ <div id='mapNavigation'></div>
</div>
</div>
+
+ <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>
+
+
+ <div style='clear:both'></div>
</div>
-<div style='clear:both'></div>
-<?
+<!--
<script src="sounds/script/soundmanager.js"></script>
<script type="text/javascript">soundManagerInit();</script>
-
+-->
<?php
htmlFooter();
?>
\ No newline at end of file |