New chat box! status report

Page 1 of 2 1, 2  Next

Go down

New chat box! status report

Post  IsaacLenox on Fri Oct 10, 2008 1:55 pm

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().
avatar
IsaacLenox
Webmaster
Webmaster

Posts : 100
Join date : 2008-09-24

View user profile http://hope2you.forumotion.com

Back to top Go down

Re: New chat box! status report

Post  Matthew_Anderson on Fri Oct 10, 2008 1:57 pm

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!!! affraid affraid affraid

_________________
avatar
Matthew_Anderson
Admin
Admin

Posts : 137
Join date : 2008-10-01
Location : What's a location

View user profile

Back to top Go down

Re: New chat box! status report

Post  MichaelReed on Fri Oct 10, 2008 1:58 pm

cool!

was i supposed to understand that??? Embarassed Embarassed Embarassed
avatar
MichaelReed
Adv Poster
Adv Poster

Posts : 261
Join date : 2008-09-29
Age : 24
Location : Earth, or whatever this place is called....

View user profile

Back to top Go down

Re: New chat box! status report

Post  IsaacLenox on Fri Oct 10, 2008 2:20 pm

MichaelReed wrote:cool!

was i supposed to understand that??? Embarassed Embarassed Embarassed

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?
avatar
IsaacLenox
Webmaster
Webmaster

Posts : 100
Join date : 2008-09-24

View user profile http://hope2you.forumotion.com

Back to top Go down

Re: New chat box! status report

Post  CalebLenox on Fri Oct 10, 2008 6:23 pm

Ummmm... isaac i see some mistakes in that Wink .... i know its not finished yet but its (not to be mean) pretty sloppy. Smile

_________________
If you have any questions just pm me Smile
avatar
CalebLenox
V.I.P

Posts : 94
Join date : 2008-09-26
Age : 25
Location : IN

View user profile

Back to top Go down

Re: New chat box! status report

Post  JoshOngley on Mon Oct 13, 2008 8:33 pm

but it's not done yet so when it is it will probably rock, depending on what he's gonna change.

_________________
Chuck Norris likes flying monkeys and GUITAR HERO.
avatar
JoshOngley
New Poster
New Poster

Posts : 10
Join date : 2008-09-28
Age : 23
Location : on 200 dollar bills

View user profile

Back to top Go down

Re: New chat box! status report

Post  Matthew_Anderson on Tue Oct 14, 2008 2:04 pm

well yeah cuz it'z izak of courz it will rock!

i like z's Smile Very Happy Smile

_________________
avatar
Matthew_Anderson
Admin
Admin

Posts : 137
Join date : 2008-10-01
Location : What's a location

View user profile

Back to top Go down

Re: New chat box! status report

Post  KevinAnderson on Tue Oct 14, 2008 3:13 pm

[chatbox ] insert here [/chatbox ]

...that's all I got

_________________
Stay frosty,
Kevin (aka FrostyWampa)
---------------------------------------------
Be alert - the world needs more lerts
Did you know that if all the smokers were laid end to end around the world, three quarters of them would drown?
Above all else: Sky.
-----------------------------------------
KevinAnderson wrote:

Quoting yourself is for losers
avatar
KevinAnderson
Admin
Admin

Posts : 187
Join date : 2008-10-01
Age : 25
Location : Hyrule

View user profile

Back to top Go down

Re: New chat box! status report

Post  IsaacLenox on Tue Oct 14, 2008 6:54 pm

lol, tyvm mat Very Happy Very Happy Very Happy
avatar
IsaacLenox
Webmaster
Webmaster

Posts : 100
Join date : 2008-09-24

View user profile http://hope2you.forumotion.com

Back to top Go down

Re: New chat box! status report

Post  DannyRuesch on Fri Oct 17, 2008 3:14 pm

Cool! I can't wait to use it, the old one isn't too good ...
avatar
DannyRuesch
Adv Poster
Adv Poster

Posts : 134
Join date : 2008-09-29
Location : Somewhere over the rainbow...

View user profile

Back to top Go down

Re: New chat box! status report

Post  Matthew_Anderson on Tue Oct 21, 2008 2:00 pm

DannyRuesch wrote:Cool! I can't wait to use it, the old one isn't too good ...

yez it iz!!!

_________________
avatar
Matthew_Anderson
Admin
Admin

Posts : 137
Join date : 2008-10-01
Location : What's a location

View user profile

Back to top Go down

Re: New chat box! status report

Post  KevinAnderson on Tue Oct 21, 2008 2:50 pm

It's good and it gets the job done, but there is always room for improvement.

_________________
Stay frosty,
Kevin (aka FrostyWampa)
---------------------------------------------
Be alert - the world needs more lerts
Did you know that if all the smokers were laid end to end around the world, three quarters of them would drown?
Above all else: Sky.
-----------------------------------------
KevinAnderson wrote:

Quoting yourself is for losers
avatar
KevinAnderson
Admin
Admin

Posts : 187
Join date : 2008-10-01
Age : 25
Location : Hyrule

View user profile

Back to top Go down

Re: New chat box! status report

Post  MichaelReed on Tue Oct 21, 2008 4:12 pm

improvement is wat izak beasts @!!!!! Razz Razz Razz
avatar
MichaelReed
Adv Poster
Adv Poster

Posts : 261
Join date : 2008-09-29
Age : 24
Location : Earth, or whatever this place is called....

View user profile

Back to top Go down

:D i am lost!

Post  natalie on Sun Oct 26, 2008 12:03 am

lol....i dunno what any of that stuff is suppose to mean...lol. Suspect and i think that the other chat ma jiger is AWESOMENSS! cheers what heck is worng with it? scratch lol. heehee! i dont get all yall computer nerds....lol JKJKJKJK! really i am JUST TEASING! ok?lol. Laughing *haha?* lol

natalie
Poster
Poster

Posts : 71
Join date : 2008-10-02
Location : PLUTO!!(it is a planet yall, i know these things!)

View user profile

Back to top Go down

Re: New chat box! status report

Post  KevinAnderson on Tue Oct 28, 2008 1:18 pm

Actually they are nerds...

Wink

_________________
Stay frosty,
Kevin (aka FrostyWampa)
---------------------------------------------
Be alert - the world needs more lerts
Did you know that if all the smokers were laid end to end around the world, three quarters of them would drown?
Above all else: Sky.
-----------------------------------------
KevinAnderson wrote:

Quoting yourself is for losers
avatar
KevinAnderson
Admin
Admin

Posts : 187
Join date : 2008-10-01
Age : 25
Location : Hyrule

View user profile

Back to top Go down

Re: New chat box! status report

Post  Matthew_Anderson on Tue Oct 28, 2008 1:29 pm

yeah srry izak but you r a nerd Wink Razz pirat

_________________
avatar
Matthew_Anderson
Admin
Admin

Posts : 137
Join date : 2008-10-01
Location : What's a location

View user profile

Back to top Go down

Re: New chat box! status report

Post  IsaacLenox on Wed Oct 29, 2008 10:31 am

grrrr..r...r.r..r.r..rrr....
jk

















avatar
IsaacLenox
Webmaster
Webmaster

Posts : 100
Join date : 2008-09-24

View user profile http://hope2you.forumotion.com

Back to top Go down

Re: New chat box! status report

Post  MichaelReed on Wed Oct 29, 2008 10:32 am

it tru, but u a cool nerd all da way!!!!!!!!!! geek geek geek
avatar
MichaelReed
Adv Poster
Adv Poster

Posts : 261
Join date : 2008-09-29
Age : 24
Location : Earth, or whatever this place is called....

View user profile

Back to top Go down

Re: New chat box! status report

Post  natalie on Wed Oct 29, 2008 4:58 pm

haha sry izach..lol. dont be sad get glad! lol! heeheeheeheehehehe Surprised oh and your game was perty neateo even though i didnt understand it! lol1 Wink I love you pig haha!

natalie
Poster
Poster

Posts : 71
Join date : 2008-10-02
Location : PLUTO!!(it is a planet yall, i know these things!)

View user profile

Back to top Go down

Re: New chat box! status report

Post  MichaelReed on Thu Oct 30, 2008 9:33 pm

the funnestest thing 2 do is 2 fall!!!
ya isaac should keep working on it!!!
avatar
MichaelReed
Adv Poster
Adv Poster

Posts : 261
Join date : 2008-09-29
Age : 24
Location : Earth, or whatever this place is called....

View user profile

Back to top Go down

Re: New chat box! status report

Post  IsaacLenox on Thu Oct 30, 2008 9:48 pm

im working on a python script so that you can look around with the mouse

_________________



i made my sig and avi with gimp Smile xD
Dreamz is my user name on alot of things
avatar
IsaacLenox
Webmaster
Webmaster

Posts : 100
Join date : 2008-09-24

View user profile http://hope2you.forumotion.com

Back to top Go down

Re: New chat box! status report

Post  MichaelReed on Thu Oct 30, 2008 10:22 pm

kewlurz!!!!! that will b so cool!!!! then u need 2 make stuff ta do!!!
avatar
MichaelReed
Adv Poster
Adv Poster

Posts : 261
Join date : 2008-09-29
Age : 24
Location : Earth, or whatever this place is called....

View user profile

Back to top Go down

Re: New chat box! status report

Post  natalie on Wed Nov 05, 2008 2:06 am

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
Poster

Posts : 71
Join date : 2008-10-02
Location : PLUTO!!(it is a planet yall, i know these things!)

View user profile

Back to top Go down

Re: New chat box! status report

Post  KevinAnderson on Wed Nov 05, 2008 2:41 pm

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...

_________________
Stay frosty,
Kevin (aka FrostyWampa)
---------------------------------------------
Be alert - the world needs more lerts
Did you know that if all the smokers were laid end to end around the world, three quarters of them would drown?
Above all else: Sky.
-----------------------------------------
KevinAnderson wrote:

Quoting yourself is for losers
avatar
KevinAnderson
Admin
Admin

Posts : 187
Join date : 2008-10-01
Age : 25
Location : Hyrule

View user profile

Back to top Go down

Re: New chat box! status report

Post  MichaelReed on Fri Nov 07, 2008 2:29 pm

?????
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
avatar
MichaelReed
Adv Poster
Adv Poster

Posts : 261
Join date : 2008-09-29
Age : 24
Location : Earth, or whatever this place is called....

View user profile

Back to top Go down

Re: New chat box! status report

Post  Sponsored content


Sponsored content


Back to top Go down

Page 1 of 2 1, 2  Next

Back to top

- Similar topics

 
Permissions in this forum:
You cannot reply to topics in this forum