New chat box! status report
+4
CalebLenox
MichaelReed
Matthew_Anderson
IsaacLenox
8 posters
Page 1 of 2
Page 1 of 2 • 1, 2
New chat box! status report
The new chat box is about 4\10 of the way done with the javascript part
if any1 here knows som javascript, maybe u could help
here it is(the java part, not done wit it though):
if any1 here knows som javascript, maybe u could help
here it is(the java part, not done wit it though):
- Code:
this.init = function() {
// Get the chatter type
this.chattype = jscript.page.getParameter("chattype");
// Get the chatter's name
this.chatname = jscript.page.getParameter("chatname");
// Insert greeting.
$("spnChatname").innerHTML = this.chatname;
// Set a timer to fire to update the timer at the bottom.
setTimeout(updateDateTime, 0);
// Set a timer to look for new messages on the server
// (once every 2 seconds).
setTimeout(getMessages, 2000);
} // End init().
var updateDateTime = function() {
$("pDateTime").innerHTML = new Date();
setTimeout(updateDateTime, 1000);
} // End updateDateTime().
var getMessages = function() {
new Ajax("server/chatServer." + chat.serverType, {
postBody :
Object.toQueryString(
{ "func" : "getMessages", "chatname" : chat.chatname,
"lastMessageTime" :chat.lastMessageTime }
),
onComplete : function(inResponse) {
// Parse JSON response.
var messageJSON = eval("(" + inResponse.trim() + ")");
chat.lastMessageTime = messageJSON.lastMessageTime;
var lines = new Array();
// Iterate over messages recived.
for (var i = 0; i < messageJSON.messages.length; i++) {
var nextMessage = messageJSON.messages[i];
// Construct a new ChatMessage and add to array.
var chatMessage = new ChatMessage();
chatMessage.setTimestamp(nextMessage.timestamp);
chatMessage.setChatname(nextMessage.chatname);
chatMessage.setMessage(nextMessage.message);
line.push(chatMessage);
}
// Display new message lines.
addLines(lines);
}
}).request();
// Kick off the timer again.
setTimeout(getMessages, 2000);
} // End getMessages().
var addLines = function(inLines) {
for (var i = o; i < inLines.length; i++) {
var message = inLines[i];
var styleClass = "cssChatterText";
if (message.getChatname() != chat.chatname) {
styleClass = "cssSupportText";
}
htmlOut = "<div class=\"" + styleClass + "\">" +
message.getChatname() + " : " +
message.getMessage() +
"</div>";
$("divChat").innerHTML = $("divChat").innerHTML + htmlOut;
}
} // End addLines().
this.postMessage = function(inLines) {
new Ajax("server/chatServer." + chat.serverType, {
postBody :
Object.toQueryString(
{ "func" : "postMessage", "chatname" : chat.chatname,
"messagetext" : $("postMessage").value }
)
}).request();
$("postMessage").value = "";
} // End addPostMessage().
var getChatTranscript = function() {
// Get the text of the chat.
var chatTranscript = $("divChat").innerHTML;
// Now we need to go through the text and remove the HTML components so
// we are left with nothing but text. Then, for each line, we make sure
// there's no trailing or leading whitespace, and we build up a string
// containing all the lines, separated by linebreaks.
var transcriptLines = chatTranscript.split(">");
chatTranscript = "";
for (var i = 0; i < transcriptLines.length; i++) {
if (transcriptLines[i].toLowerCase().indexOf("</div") != -1) {
transcriptLines[i] = transcriptLines[i].replace("</div", "");
transcriptLines[i] = transcriptLines[i].replace("</DIV", "");
chatTranscript += transcriptLines[i].trim() + "\r\n";
}
}
return chatTranscript;
} // End getChatTranscript().
Re: New chat box! status report
IsaacLenox wrote:The new chat box is about 4\10 of the way done with the javascript part
if any1 here knows som javascript, maybe u could help
here it is(the java part, not done wit it though):
- Code:
this.init = function() {
// Get the chatter type
this.chattype = jscript.page.getParameter("chattype");
// Get the chatter's name
this.chatname = jscript.page.getParameter("chatname");
// Insert greeting.
$("spnChatname").innerHTML = this.chatname;
// Set a timer to fire to update the timer at the bottom.
setTimeout(updateDateTime, 0);
// Set a timer to look for new messages on the server
// (once every 2 seconds).
setTimeout(getMessages, 2000);
} // End init().
var updateDateTime = function() {
$("pDateTime").innerHTML = new Date();
setTimeout(updateDateTime, 1000);
} // End updateDateTime().
var getMessages = function() {
new Ajax("server/chatServer." + chat.serverType, {
postBody :
Object.toQueryString(
{ "func" : "getMessages", "chatname" : chat.chatname,
"lastMessageTime" :chat.lastMessageTime }
),
onComplete : function(inResponse) {
// Parse JSON response.
var messageJSON = eval("(" + inResponse.trim() + ")");
chat.lastMessageTime = messageJSON.lastMessageTime;
var lines = new Array();
// Iterate over messages recived.
for (var i = 0; i < messageJSON.messages.length; i++) {
var nextMessage = messageJSON.messages[i];
// Construct a new ChatMessage and add to array.
var chatMessage = new ChatMessage();
chatMessage.setTimestamp(nextMessage.timestamp);
chatMessage.setChatname(nextMessage.chatname);
chatMessage.setMessage(nextMessage.message);
line.push(chatMessage);
}
// Display new message lines.
addLines(lines);
}
}).request();
// Kick off the timer again.
setTimeout(getMessages, 2000);
} // End getMessages().
var addLines = function(inLines) {
for (var i = o; i < inLines.length; i++) {
var message = inLines[i];
var styleClass = "cssChatterText";
if (message.getChatname() != chat.chatname) {
styleClass = "cssSupportText";
}
htmlOut = "<div class=\"" + styleClass + "\">" +
message.getChatname() + " : " +
message.getMessage() +
"</div>";
$("divChat").innerHTML = $("divChat").innerHTML + htmlOut;
}
} // End addLines().
this.postMessage = function(inLines) {
new Ajax("server/chatServer." + chat.serverType, {
postBody :
Object.toQueryString(
{ "func" : "postMessage", "chatname" : chat.chatname,
"messagetext" : $("postMessage").value }
)
}).request();
$("postMessage").value = "";
} // End addPostMessage().
var getChatTranscript = function() {
// Get the text of the chat.
var chatTranscript = $("divChat").innerHTML;
// Now we need to go through the text and remove the HTML components so
// we are left with nothing but text. Then, for each line, we make sure
// there's no trailing or leading whitespace, and we build up a string
// containing all the lines, separated by linebreaks.
var transcriptLines = chatTranscript.split(">");
chatTranscript = "";
for (var i = 0; i < transcriptLines.length; i++) {
if (transcriptLines[i].toLowerCase().indexOf("</div") != -1) {
transcriptLines[i] = transcriptLines[i].replace("</div", "");
transcriptLines[i] = transcriptLines[i].replace("</DIV", "");
chatTranscript += transcriptLines[i].trim() + "\r\n";
}
}
return chatTranscript;
} // End getChatTranscript().
AHHH IT'S BEAST IZAK!!!
Matthew_Anderson- Admin
- Posts : 137
Join date : 2008-10-01
Location : What's a location
Re: New chat box! status report
cool!
was i supposed to understand that???
was i supposed to understand that???
MichaelReed- Adv Poster
- Posts : 261
Join date : 2008-09-29
Age : 29
Location : Earth, or whatever this place is called....
Re: New chat box! status report
MichaelReed wrote:cool!
was i supposed to understand that???
if u read a adv javascripting book and understood it and did everything in it, or took a adv javascript class, then yes, but if not then no.
so i suspect no, am i correct?
Re: New chat box! status report
Ummmm... isaac i see some mistakes in that .... i know its not finished yet but its (not to be mean) pretty sloppy.
CalebLenox- V.I.P
- Posts : 94
Join date : 2008-09-26
Age : 31
Location : IN
Re: New chat box! status report
but it's not done yet so when it is it will probably rock, depending on what he's gonna change.
JoshOngley- New Poster
- Posts : 10
Join date : 2008-09-28
Age : 28
Location : on 200 dollar bills
Re: New chat box! status report
well yeah cuz it'z izak of courz it will rock!
i like z's
i like z's
Matthew_Anderson- Admin
- Posts : 137
Join date : 2008-10-01
Location : What's a location
Re: New chat box! status report
[chatbox ] insert here [/chatbox ]
...that's all I got
...that's all I got
KevinAnderson- Admin
- Posts : 187
Join date : 2008-10-01
Age : 31
Location : Hyrule
Re: New chat box! status report
Cool! I can't wait to use it, the old one isn't too good ...
DannyRuesch- Adv Poster
- Posts : 134
Join date : 2008-09-29
Location : Somewhere over the rainbow...
Re: New chat box! status report
DannyRuesch wrote:Cool! I can't wait to use it, the old one isn't too good ...
yez it iz!!!
Matthew_Anderson- Admin
- Posts : 137
Join date : 2008-10-01
Location : What's a location
Re: New chat box! status report
It's good and it gets the job done, but there is always room for improvement.
KevinAnderson- Admin
- Posts : 187
Join date : 2008-10-01
Age : 31
Location : Hyrule
Re: New chat box! status report
improvement is wat izak beasts @!!!!!
MichaelReed- Adv Poster
- Posts : 261
Join date : 2008-09-29
Age : 29
Location : Earth, or whatever this place is called....
:D i am lost!
lol....i dunno what any of that stuff is suppose to mean...lol. and i think that the other chat ma jiger is AWESOMENSS! what heck is worng with it? lol. heehee! i dont get all yall computer nerds....lol JKJKJKJK! really i am JUST TEASING! ok?lol. *haha?* lol
natalie- Poster
- Posts : 71
Join date : 2008-10-02
Location : PLUTO!!(it is a planet yall, i know these things!)
Re: New chat box! status report
Actually they are nerds...
KevinAnderson- Admin
- Posts : 187
Join date : 2008-10-01
Age : 31
Location : Hyrule
Re: New chat box! status report
yeah srry izak but you r a nerd
Matthew_Anderson- Admin
- Posts : 137
Join date : 2008-10-01
Location : What's a location
Re: New chat box! status report
it tru, but u a cool nerd all da way!!!!!!!!!!
MichaelReed- Adv Poster
- Posts : 261
Join date : 2008-09-29
Age : 29
Location : Earth, or whatever this place is called....
Re: New chat box! status report
haha sry izach..lol. dont be sad get glad! lol! heeheeheeheehehehe oh and your game was perty neateo even though i didnt understand it! lol1 haha!
natalie- Poster
- Posts : 71
Join date : 2008-10-02
Location : PLUTO!!(it is a planet yall, i know these things!)
Re: New chat box! status report
the funnestest thing 2 do is 2 fall!!!
ya isaac should keep working on it!!!
ya isaac should keep working on it!!!
MichaelReed- Adv Poster
- Posts : 261
Join date : 2008-09-29
Age : 29
Location : Earth, or whatever this place is called....
Re: New chat box! status report
im working on a python script so that you can look around with the mouse
Re: New chat box! status report
kewlurz!!!!! that will b so cool!!!! then u need 2 make stuff ta do!!!
MichaelReed- Adv Poster
- Posts : 261
Join date : 2008-09-29
Age : 29
Location : Earth, or whatever this place is called....
Re: New chat box! status report
i would be so lost if i tried to do any of the stuff yall are doing...lol. i am barely gettin thru computer class! ackkkkkkkkk! heehee! no jokin!
natalie- Poster
- Posts : 71
Join date : 2008-10-02
Location : PLUTO!!(it is a planet yall, i know these things!)
Re: New chat box! status report
I'm not having trouble with comp sci class but I think I really messed up my zoo somehow...
BTW, Is anyone here going to the 'My Heart in a Suitcase' thingy? I am even though I'm not in the class...
BTW, Is anyone here going to the 'My Heart in a Suitcase' thingy? I am even though I'm not in the class...
KevinAnderson- Admin
- Posts : 187
Join date : 2008-10-01
Age : 31
Location : Hyrule
Re: New chat box! status report
?????
ur doi nit and ur not in the class???
u have lotsa time on ur hands!!!! lol
and no, i iz not havin trouble in the comp sci class
ur doi nit and ur not in the class???
u have lotsa time on ur hands!!!! lol
and no, i iz not havin trouble in the comp sci class
MichaelReed- Adv Poster
- Posts : 261
Join date : 2008-09-29
Age : 29
Location : Earth, or whatever this place is called....
Page 1 of 2 • 1, 2
Page 1 of 2
Permissions in this forum:
You cannot reply to topics in this forum
|
|