diff options
author | Patrick Davison <snapwilliam@gmail.com> | 2013-02-09 14:16:37 -0800 |
---|---|---|
committer | Patrick Davison <snapwilliam@gmail.com> | 2013-02-09 14:16:37 -0800 |
commit | 9462f29413dc1320b3899f7fbbbb75be64fbaede (patch) | |
tree | 0f534c8ef712d519aea7ed6e919f0277af654088 /pages | |
parent | 357e548fef7f73338e8c3e7415f2407c7dbb7ac7 (diff) | |
download | pathery-9462f29413dc1320b3899f7fbbbb75be64fbaede.tar.xz |
Huge changes; started deprecation of PHP's displayMap()
New JS function 'mapAsHTML(mapAsObject)'
getScores() will now return solutions if the map has expired.
Homepage now uses mapAsHTML.
Removed some padding on scoreboard.
scoresFormatPage() supports solutions if available. (This can be row-specific)
And tons of CSS - deprecating old CSS.
Diffstat (limited to 'pages')
-rw-r--r-- | pages/home.php | 26 | ||||
-rw-r--r-- | pages/scores.php | 135 |
2 files changed, 129 insertions, 32 deletions
diff --git a/pages/home.php b/pages/home.php index 7898a3c..f8841b5 100644 --- a/pages/home.php +++ b/pages/home.php @@ -1,6 +1,7 @@ <?php
include_once ('./includes/maps.php');
+include_once ('./includes/mapclass.php');
include_once ('./includes/mapoftheday.php');
include_once ('./includes/sqlEmbedded.php');
include_once ('./includes/datas.php');
@@ -115,12 +116,10 @@ $adContent = " <div class="wrapper">
-<center>12/12/12 - We're introducing a new map & mechanic!
-I'd like to hear what you think about it!
-<br />Send me a line at the <a href="feedback">Feedback Page</a>.
-<br />Wir führen eine neue Map und einen neün Mechanismus ein!
-Ich wüsste gern, was du davon hältst!
-Schick mir einfach eine Zeile auf der <a href="feedback">Feedback-Seite</a>.
+<center>
+Tutorial, FAQ, and Challenge maps are broken. ^_^.
+<br />Still working on <a href='scores'>The Scores Page</a>.
+<br />Leave feedback in <a href='chat'>The Chat</a> as per usual.
</center>
<br />
@@ -228,7 +227,20 @@ function displayMaze($motd, $mapType) { $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 />";
- $r .= DisplayMap($map, $mapID);
+ //TMP
+
+ $mapObj = new map(getMapCode($mapID), $mapID);
+ $mapJSON = json_encode($mapObj);
+
+ $r .= "<div id='innerMapDsp_$mapID'>";
+ $r .= "</div>";
+ $r .= "<script>";
+ $r .= "document.getElementById('innerMapDsp_$mapID').innerHTML = mapAsHTML(decryptJSON('$mapJSON'));";
+ $r .= "</script>";
+
+
+
+ //$r .= DisplayMap($map, $mapID);
$r .= " </div></div>";
$r .= " <div style='padding-top: 20px;'>";
diff --git a/pages/scores.php b/pages/scores.php index 2a82efd..43bc7dc 100644 --- a/pages/scores.php +++ b/pages/scores.php @@ -51,6 +51,11 @@ if ($daysAgo < 1) <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">
+playerWallColor = '<?PHP echo isset($wallColor) ? $wallColor : ''; ?>';
+playerWallEmblem = '<?PHP echo isset($wallEmblem) ? $wallEmblem : ''; ?>';
+</script>
+
<script>
@@ -83,11 +88,13 @@ $("#load_basic").click(function(){ function displayMap(mapID) {
- var urlString = 'ajax/scores.ajax.php?getmap=true&mapID='+mapID;
+ //var urlString = 'ajax/scores.ajax.php?getmap=true&mapID='+mapID;
+ var urlString = 'map/'+mapID;
$("#mapDisplay").fadeOut('fast');
//.html(ajax_load)
- $("#mapDisplay").load(urlString, null, function() {$("#mapDisplay").fadeIn('slow');});
- urlString = 'do.php?r=reqScorePage&reqPage=1&mapID='+mapID;
+
+ //$("#mapDisplay").load(urlString, null, function() {$("#mapDisplay").fadeIn('slow');});
+ //urlString = 'do.php?r=reqScorePage&reqPage=1&mapID='+mapID;
//$("#scoreDisplay").html(ajax_load).load(urlString);
if (!$('#'+mapID+',dspScore').length) {
@@ -100,12 +107,12 @@ function displayMap(mapID) { }
scoresShowPage(mapID, 1);
- // $.ajax({
- // type: "GET",
- // url: "ajax/chat.ajax.php",
- // data: dataString,
- // success: function(data) {getChatDone(data);}
- // });
+ $.ajax({
+ type: "GET",
+ url: 'map/'+mapID,
+ data: '',
+ success: function(data) {$("#mapDisplay").html(mapAsHTML(decryptJSON(data), 595)).fadeIn('slow');}
+ });
// var newDiv = $('<div/>', {
// 'id': mapID+',dspScore',
// 'class': 'my-new-list',
@@ -113,6 +120,18 @@ function displayMap(mapID) { // html: ''
// });
}
+
+//TODO:
+function getMapOnce(mapid) {
+ if (typeof(mapdata[mapid]) != 'object') {
+ return mapdata[mapid];
+ }
+}
+
+// function request_path_done() {
+ // var JO = decryptJSON(ajax.response);
+// }
+
function getMaplist(request) {
// daysAgo++
switch (request) {
@@ -137,7 +156,7 @@ function getMaplist(request) { $("#mapNavigation").load(urlString, null, function() {$("#mapNavigation").show('slow');});
}
-
+//TODO
function handleJSONResponse(data) {
json = jQuery.parseJSON(data);
// $.each(json, function(key, user) {
@@ -145,6 +164,68 @@ function handleJSONResponse(data) { // }
}
+
+// var global = getCSSRule('.global');
+
+//TODO: Playing around with this:
+//setPlayerSettings(playerWallEmblem, playerWallColor);
+//function setPlayerSettings(wallEmblem, wallColor) {
+ //css(".playable .o:hover", "background-color", playerWallColor);
+ //css(".playable .o:hover", "background-image", "url(http://www.mazetd.4xg.net/images/marks/"+wallEmblem+")");
+//}
+// function css(selector, property, value) {
+ // for (var i=0; i<document.styleSheets.length;i++) {//Loop through all styles
+ // //Try add rule
+ // try { document.styleSheets[i].insertRule(selector+ ' {'+property+':'+value+'}', document.styleSheets[i].cssRules.length);
+ // } catch(err) {try { document.styleSheets[i].addRule(selector, property+':'+value);} catch(err) {}}//IE
+ // }
+// }
+
+
+
+
+
+//alert("I'm working on this page right now - this IS beta");
+
+var mymap = {"ID":502,"teleports":0,"checkpoints":4,"width":"15","height":"9","walls":"13","name":"","flags":null,"dateCreated":null,"dateExpires":null,"isBlind":false,"isMultiPath":false,"code":null,"tiles":[[["s",""],["o"],["o"],["o"],["r",""],["o"],["o"],["o"],["o"],["o"],["o"],["r",""],["o"],["o"],["f",""]],[["s",""],["r",""],["o"],["r",""],["o"],["o"],["o"],["c",3],["r",""],["c",2],["o"],["o"],["o"],["o"],["f",""]],[["s",""],["o"],["o"],["o"],["o"],["o"],["o"],["o"],["r",""],["o"],["o"],["o"],["o"],["o"],["f",""]],[["s",""],["o"],["o"],["o"],["o"],["o"],["o"],["o"],["o"],["o"],["o"],["o"],["o"],["o"],["f",""]],[["s",""],["o"],["o"],["r",""],["o"],["o"],["o"],["o"],["r",""],["o"],["r",""],["o"],["o"],["o"],["f",""]],[["s",""],["o"],["r",""],["r",""],["o"],["o"],["r",""],["r",""],["o"],["o"],["o"],["o"],["o"],["o"],["f",""]],[["s",""],["o"],["o"],["c",4],["r",""],["r",""],["o"],["c",""],["o"],["o"],["o"],["o"],["o"],["o"],["f",""]],[["s",""],["o"],["o"],["o"],["o"],["o"],["o"],["o"],["r",""],["o"],["o"],["o"],["o"],["o"],["f",""]],[["s",""],["o"],["o"],["o"],["o"],["o"],["o"],["o"],["o"],["o"],["o"],["o"],["o"],["o"],["f",""]]]};
+
+var Tile = {"Wall" : "w",
+"Empty" : "o",
+"Start" : "o",
+"Finish" : "o",
+"Checkpoint" : "o",
+"TileRock" : "o",
+"TeleportIn" : "o",
+"TeleportOut" : "o",
+"Unbuildable" : "o",
+"SinglePath" : "o"};
+
+
+function mapThumbnailHTML(map) {
+ var r = '<table class="map">';
+ for (var y in map.tiles) {
+ r += '<tr>';
+ for (var x in map.tiles[y]) {
+ var type = map.tiles[y][x][0];
+ var value = map.tiles[y][x][1];
+ if (!value) value = '';
+ r += "<td class='"+type+value+"'>";
+ r += '</td>';
+ }
+ r += '</tr>';
+ }
+ r += '</table>';
+
+ //return r;
+
+ //alert(r);
+
+ //$("#tmp").html(r).show('slow');;
+ //$("#tmp").html(mapAsHTML(map,100)).show('slow');;
+}
+
+
+
</script>
@@ -161,6 +242,10 @@ $todaysScoreMaps = getMapsPlayed($daysAgo); <div class="wrapper">
+<div id='tmp'>
+Work in progress
+</div>
+
<div id='#displayDate' style='text-align:center;padding-bottom:7px;'>
<h2 title='Maps that were played during this day'><? echo $dateAsStr; ?></h2>
</div>
@@ -283,24 +368,24 @@ if ($specialMapName != '') -function showStats(type) {
+//function showStats(type) {
//super usefulll
//var anchor = window.location.hash.substring(1);
- for (var i = 1; i <= 4; i++) {
- var elem = document.getElementById("yms-" + i);
- if (elem.className.indexOf('hidden-stats') < 0)
- elem.className += 'hidden-stats';
- elem = document.getElementById("dl-" + i);
- elem.className = elem.className.replace('selected', '');
- }
- elem = document.getElementById("yms-" + type);
- elem.className = elem.className.replace('hidden-stats', '');
- elem = document.getElementById("dl-" + type);
- if (elem.className.indexOf('selected') < 0)
- elem.className += 'selected';
-}
-showStats(1);
+ // for (var i = 1; i <= 4; i++) {
+ // var elem = document.getElementById("yms-" + i);
+ // if (elem.className.indexOf('hidden-stats') < 0)
+ // elem.className += 'hidden-stats';
+ // elem = document.getElementById("dl-" + i);
+ // elem.className = elem.className.replace('selected', '');
+ // }
+ // elem = document.getElementById("yms-" + type);
+ // elem.className = elem.className.replace('hidden-stats', '');
+ // elem = document.getElementById("dl-" + type);
+ // if (elem.className.indexOf('selected') < 0)
+ // elem.className += 'selected';
+// }
+// showStats(1);
</script>
<script src="sounds/script/soundmanager.js"></script>
|