diff options
-rw-r--r-- | ajax_chat.php | 16 | ||||
-rw-r--r-- | includes/playerStats.php | 2 | ||||
-rw-r--r-- | pages/chat.php | 40 |
3 files changed, 34 insertions, 24 deletions
diff --git a/ajax_chat.php b/ajax_chat.php index 37521de..04a6fd4 100644 --- a/ajax_chat.php +++ b/ajax_chat.php @@ -20,13 +20,14 @@ if ($_REQUEST['messages']) { if ($_REQUEST['getChatFromID']) {
+ $getChatID = $_REQUEST['getChatFromID'];
if ($sent) {
//Wait .2 seconds
usleep(200000);
//echo "yesSent";
for( $i = 1; $i < 3; $i++) {
//echo "loop";
- $data = getChat($_REQUEST['getChatFromID']);
+ $data = getChat($getChatID);
if ($data !== false) {
//$data['debug'][] = "Count times: $i";
//$data['debug'][] = "Count value:".count($data);
@@ -38,17 +39,20 @@ if ($_REQUEST['getChatFromID']) { }
}
//echo "reachedEnd";
- $json = prepareChatData(getChat($_REQUEST['getChatFromID']));
+ $json = prepareChatData(getChat($getChatID));
echo $json;
exit;
}
function prepareChatData($data) {
- foreach($data as &$user) {
- //$user['message'] = $user['message'].'write-append';
- $user['secondsSince'] = strtotime($user['dateSent']) - strtotime("now");
+ if ($data) {
+ foreach($data as &$user) {
+ //$user['message'] = $user['message'].'write-append';
+ $user['secondsSince'] = strtotime($user['dateSent']) - strtotime("now");
+ }
+ return json_encode($data);
}
- return json_encode($data);
+ return $data;
}
diff --git a/includes/playerStats.php b/includes/playerStats.php index ec9a616..b64fb8d 100644 --- a/includes/playerStats.php +++ b/includes/playerStats.php @@ -1,5 +1,5 @@ <?php -define('CP_EARLIEST_DATE', '2012-01-01'); +define('CP_EARLIEST_DATE', '2012-03-19'); define('CP_MIN_WORTH', 10); define('CP_MAX_WORTH_SIMPLE', 100); define('CP_MAX_WORTH_NORMAL', 150); diff --git a/pages/chat.php b/pages/chat.php index 11bb935..0096304 100644 --- a/pages/chat.php +++ b/pages/chat.php @@ -49,17 +49,24 @@ topbar($Links); width:330px;
}
+.chatInputMessage {
+ font-family:Comic Sans MS, Comic Sans MS5, cursive;
+ border: 1px solid gray;
+ width: 700px;
+ margin: 4px;
+}
+.chatButton {
+ margin: 4px;
+}
#chatContainer {
- border:1px solid red;
- width:600px;
+ width:800px;
margin:0 auto;
height:400px;
overflow:auto;
}
.chatContainer2 {
- border:1px solid yellow;
- width:610px;
+ width:810px;
margin:0 auto;
height:450px;
overflow:auto;
@@ -89,25 +96,23 @@ function getChatTimer() { getChat();
}
-
-getChat();
function getChatDone(data) {
var items = [];
var p; //our prep string
var newChats = false;
- //console.log('datalength', data.length);
+ ////console.log('datalength', data.length);
if (data.length < 3 || data == 'false')
return;
- console.log("START BUILD");
+ //console.log("START BUILD");
- console.log("JSON TO PARSE", data);
+ //console.log("JSON TO PARSE", data);
json = jQuery.parseJSON(data);
- console.log("JSON PREPED");
+ //console.log("JSON PREPED");
$.each(json, function(key, user) {
@@ -116,7 +121,7 @@ function getChatDone(data) { //var timestamp = postDate.format("ddd h:MM TT");
var timestamp = postDate.format("h:MM:ss");
- console.log("INSIDE BUILD START");
+ //console.log("INSIDE BUILD START");
p = '';
p = p+ " <span class='chatTimestamp'>["+timestamp+"]</span>";
p = p+ " <div class='grid_td' style='float:left; width:35px; height:35px; background:"+user.wallColor+" url(images/marks/"+user.wallEmblem+");'>";
@@ -138,7 +143,7 @@ function getChatDone(data) { newChats = true;
});
- console.log("BUILD DONE");
+ //console.log("BUILD DONE");
if (newChats) {
var new_chatDiv = $('<div/>', {
@@ -148,11 +153,11 @@ function getChatDone(data) { });
new_chatDiv.prependTo('#chatContainer').slideDown('fast');
}
- console.log('(END) lastID', lastID);
+ //console.log('(END) lastID', lastID);
}
function getChat(message) {
- console.log('LASTID:', lastID);
+ //console.log('LASTID:', lastID);
var dataString = 'getChatFromID='+lastID;
if (chatBuffer.length > 0) {
dataString += '&send=true&messages='+chatBuffer.join('|:|');
@@ -198,13 +203,14 @@ function htmlEncode(value){ </script>
-<h3>this page will overflow...</h3>
+<h3>Pathery Chat - BETA</h3>
<div class='chatContainer2'>
<form id='sendChat' onsubmit="return false">
<input type="hidden" name="stuff" value="1724">
- <input type="text" name="message" id="message" value="" maxlength="255" autocomplete="off" >
- <input type="button" class="send" id='chatSendBtn' value='Send' onClick="sendChat();">
+ <input class='chatButton' type="button" class="send" id='chatSendBtn' value='Send' onClick="sendChat();">
+ <input class='chatInputMessage' type="text" name="message" id="message" value="" maxlength="255" autocomplete="off" >
+
</form>
<div id='chatContainer'>
|