summaryrefslogtreecommitdiffstats
path: root/pages
diff options
context:
space:
mode:
authorBlueRaja <BlueRaja.admin@gmail.com>2013-03-07 05:05:28 -0600
committerBlueRaja <BlueRaja.admin@gmail.com>2013-03-07 05:05:28 -0600
commit81e9645b8b036d9040bd1d02617b029b294809de (patch)
tree1ac415d112b11a8de8a11fbc5ea16691ef368dd4 /pages
parentc62d777cd17e72dd7068547d2e8aa47354387f1e (diff)
parentecb87bd22022a140df7e0d1843494ff065d55c1c (diff)
downloadpathery-81e9645b8b036d9040bd1d02617b029b294809de.tar.xz
Merge branch 'master' of git.raylu.net:pathery
Diffstat (limited to 'pages')
-rw-r--r--pages/chat.php32
-rw-r--r--pages/mapeditor.php42
2 files changed, 63 insertions, 11 deletions
diff --git a/pages/chat.php b/pages/chat.php
index d2198c7..ee36262 100644
--- a/pages/chat.php
+++ b/pages/chat.php
@@ -141,7 +141,7 @@ function getChatDone(data) {
firstGetChat = false;
}
document.title = lastDisplay+': '+lastMessage.substring(0, 10)+'... Pathery Chat';
- if (!document.getElementById('chatMute').checked) {
+ if (chatIsMuted == 'true') {
soundManager.setVolume('charm', 20);
soundManager.setPan('charm', -60)
soundManager.setPosition('charm',150);
@@ -156,6 +156,8 @@ function chatReplaceAndEncode(chat) {
chat = chat.replace(/\~\~(\S(.*?\S)?)\~\~/gm, "<s>$1</s>");
chat = chat.replace(/\*(\S(.*?\S)?)\*/gm, "<i>$1</i>");
+ chat = replaceSmileys(chat);
+
//Surround all URLs with a <a> link
var URLexp = /(\b(https?|ftp|file):\/\/[-A-Z0-9+&@#\/%?=~_|!:,.;]*[-A-Z0-9+&@#\/%=~_|])/ig;
chat = chat.replace(URLexp, "<a href='redirect?to=$1' target='_blank'>$1</a>");
@@ -169,6 +171,15 @@ function chatReplaceAndEncode(chat) {
return chat;
}
+function replaceSmileys(chat) {
+ chat = chat.replace(/:\)/g, '<img class="chatSmiley" src="images/smileys/Smiling.png" />');
+ chat = chat.replace(/\(:/g, '<img class="chatSmiley" src="images/smileys/Smiling.png" />');
+ //chat = chat.replace(/:\//g, '<img class="chatSmiley" src="images/smileys/Uncertain.png" />');
+ chat = chat.replace(/:\(/g, '<img class="chatSmiley" src="images/smileys/Unhappy.png" />');
+ chat = chat.replace(/\&lt;3/g, '<img class="chatSmiley" src="images/smileys/Heart.png" />');
+ return chat;
+}
+
function prepChat(chat) {
chat = chat.join('|:|');
chat = chat.replace(/\&/g,'%26')
@@ -223,7 +234,20 @@ function htmlEncode(value){
}
}
-function setChatMute(value) {
+
+<?
+$chatMute = (isset($_COOKIE['pref_chatMute']) && $_COOKIE['pref_chatMute'] == "true");
+$chatMute = ($chatMute) ? 'true' : 'false';
+?>
+var chatIsMuted = '<? echo $chatMute; ?>';
+function setChatMute() {
+ var value = chatIsMuted;
+
+ $('#chatMute').removeClass("chatMute_"+value);
+ if (value == 'true') value = 'false';
+ else value = 'true';
+ chatIsMuted = value;
+ $('#chatMute').addClass("chatMute_"+value);
savePref('chatMute', value);
}
@@ -240,10 +264,8 @@ function setChatMute(value) {
<input type="hidden" name="stuff" value="1724">
<?
- $chatMute = '';
- if (isset($_COOKIE['pref_chatMute']) && $_COOKIE['pref_chatMute'] == "true") $chatMute = "checked='checked' ";
echo "
- <input title='Mute sound?' onClick='setChatMute(this.checked)' type='checkbox' id='chatMute' class='chatMute' $chatMute/>";
+ <a title='Mute sound?' class='chatMute_$chatMute' href='javascript:setChatMute()' id='chatMute'/></a>";
?>
<input class='chatButton' type="button" class="send" id='chatSendBtn' value='Send' onClick="sendChat();">
diff --git a/pages/mapeditor.php b/pages/mapeditor.php
index 87fef32..0d6cf94 100644
--- a/pages/mapeditor.php
+++ b/pages/mapeditor.php
@@ -51,13 +51,28 @@ testMap.name = 'Testmap';
testMap.walls = 5;
setTimeout("reloadMap();", 500);
+setTimeout("start();", 500);
function start() {
- $('#testMapDisplay').html(mapAsHTML(testMap));
+ //$('#testMapDisplay').html(mapAsHTML(testMap));
+
+ $(window).mousedown(function(){
+ mouseIsDown = true;
+
+ });
+
+ $(window).mouseup(function(){
+ mouseIsDown = false;
+ });
+
}
+var mouseIsDown = false;
-var grid_clickOverride = true;
-function mapClick(obj) {
+var mapHasChanged = false;
+function mapEditOver(obj) {
+ if (mouseIsDown == true) mapEditClick(obj);
+}
+function mapEditClick(obj) {
console.log("Map Click");
tmp = obj.id.split(',');
@@ -69,9 +84,19 @@ function mapClick(obj) {
testMap.tiles[y][x] = Array(palleteType, palleteValue);
y++;
$(obj).attr('class', 'mapcell '+palleteType+palleteValue);
- loadPlayableMap();
+ mapHasChanged = true;
+}
+
+getMapTimer();
+function getMapTimer() {
+ setTimeout("getMapTimer()", 3000);
+ if (mapHasChanged) {
+ loadPlayableMap();
+ mapHasChanged = false;
+ }
}
+
var palleteType = 's';
var palleteValue = '';
function paletteSelect(type, value) {
@@ -120,8 +145,12 @@ function reloadMap() {
loadPlayableMap();
}
+var isLoadingMap = false;
function loadPlayableMap() {
+ if (isLoadingMap == true) return;
+ isLoadingMap = true;
+
var URLString = 'mapeditor?mapByMap='+JSON.stringify(testMap);
$.ajax({
type: "GET",
@@ -135,6 +164,7 @@ function loadPlayableMap() {
playableMap.ID = -1;
$('#playableMapDisplay').html(mapAsHTML(playableMap, 960));
$('#playableMapCodeDisplay').val(playableMap.code);
+ isLoadingMap = false;
}
});
}
@@ -268,10 +298,10 @@ function constructTiles(width, height, baseMap) {
</div></form>
<div style='clear:both;'></div>
- <div class="divide"></div>
+ <div class="divide"><strong>Playable Map</strong></div>
<div style='clear:both;'></div>
<div class='wrapper'>
- <input id='playableMapCodeDisplay' size="100" type="text" value="" class="forminput"/>
+ MapCode: <input id='playableMapCodeDisplay' size="100" type="text" value="" class="forminput"/>
</div>
<div id='playableMapDisplay' style='float:left;'>
Returned map goes here.