All pastes #181784 Raw Edit

SirFire

public javascript v1 · immutable
#181784 ·published 2006-09-25 11:59 UTC
rendered paste body
<html><head><!--This file retrieved from the JS-Examples archiveshttp://www.js-examples.com1000s of free ready to use scripts, tutorials, forums.Author: Tomer Shiran - http://www.js-examples.com/Modified: SirFire - http://www.devhat.net/--><SCRIPT><!--  Activate Cloaking Device// used to track position in message   var i = 0; // used to cycle thru messages                                             var TextNumber = 0;// array of messages                           var TextInput = new Object();// used to load manipulate message             var HelpText="";                              // used to load message   var Text = "";  // length of timeout (smaller is faster)                                     var Speed=30;// added to end of each message to create a pause   var WaitSpace="                                                                    "// used to position text in ver 2.0   var addPadding="\r\n";// Each element of TextInput represents a single message.TextInput[0] = "* Reader has joined #netfan";  TextInput[1] = "** Your host is guru";TextInput[2] = "*** MOTD: Wait, guru?! host?!";TextInput[3] = "<guru> Welcome to my comic everyone!";TextInput[4] = "<guru> You will learn about PUDDING! and how it is made!";TextInput[5] = "<guru> First you need a cup of milk";TextInput[6] = "* cupofmilk has joined #netfan";TextInput[7] = "<cupofmilk> You called?";TextInput[8] = "* Heatsink has joined #netfan";TextInput[9] = "<Heatsink> CLICHE!";TextInput[10] = "* Heatsink has left #netfan";TextInput[11] = "<guru> Hey! get out of here!";TextInput[12] = "<guru> You also need two cups of pudding..";TextInput[13] = "<guru> But its special pudding! Taken from the pond of pudding lake!";TextInput[14] = "<guru> .. hello? pudding?";TextInput[15] = "* twocuppudding has joined #netfan";TextInput[16] = "<twocuppudding> Reporting for duty!";TextInput[17] = "* Heatsink has joined #netfan";TextInput[18] = "<Heatsink> CLICHE!";TextInput[19] = "* Heatsink has left #netfan";TextInput[20] = "<guru> ARRRRGH HOW DO YOU EXPECT ME TO DO MY COMIC!";TextInput[21] = "<guru> ..whatever..don't stare at me like that...STOP IT!";TextInput[22] = "<guru> So you take the cup of milk, and two cups of pudding..  and you mix it with the orange juice!";TextInput[23] = "<cupofmilk> Huh?!";TextInput[24] = "<twocuppudding> Saaay what?";TextInput[25] = "<guru> Oh don't tell me you two are still at war with orange juice..";TextInput[26] = "<cupofmilk> that we are..";TextInput[27] = "<guru> Then the pudding can't be made, period!";TextInput[28] = "<twocuppudding> With all due repsect cheif guru, I am pudding. Therefore there already is pudding.";TextInput[29] = "<guru> SILENCE!";TextInput[30] = "<guru> Since you two are at war with orange juice, there can be no pudding!";TextInput[31] = "<twocuppudding> Well.. If you say so..";TextInput[32] = "* twocuppudding is now at war with Milk";TextInput[33] = "* twocuppudding has left #netfan";TextInput[34] = "<cupofmilk> Err What?";TextInput[35] = "<guru> You can't speak, Milk doesn't exist anymore..";TextInput[36] = "* cupofmilk has left #netfan";TextInput[37] = "<guru> No more milk? No more pudding? THINK OF THE KIDS!";TextInput[38] = "* reader has left #netfan";TextInput[39] = "** I'll miss pudding :(";TextInput[40] = "*** Remember, Go at war, and loose your milk :o";TotalTextInput = 40; // (0, 1, 2, 3, 4, 5, 6, 7)// Positioning and speed vary between versions.var Version =  navigator.appVersion;  if (Version.substring(0, 1)==3)   {   Speed=200;   addPadding="";   }for (var addPause = 0; addPause <= TotalTextInput; addPause++)    {TextInput[addPause]=addPadding+TextInput[addPause]+WaitSpace;}var TimerIdvar TimerSet=false;// Called by the Start button.function startMessage()    {   if (!TimerSet)      {      TimerSet=true;      teletype();      }   }// Gets and displays character from rollMessage() . // Variable Speed controls length of timeout and thus the speed of typing.function teletype()    {   Text=rollMessage();   TimerId = setTimeout("teletype()", Speed)   document.forms[0].elements[0].value=Text;   scrolltobottom();   //content.getElementById('first');   //elem.scrollTop = elem.scrollHeight;   //first.moveStart("character", 4000);   //document.forms[0].elements[0].selstart=Text.length;   }// Pulls one character at a time from string and returns (as Text) to function teletype() for displaying.function rollMessage ()    {   Wait_yn=false;   i++;   var CheckSpace = HelpText.substring(i-1, i);   CheckSpace = "" + CheckSpace;   if (CheckSpace == " ")       {i++;}   if (i >= HelpText.length+1)       {      //i=0;       if (TextNumber < TotalTextInput)          {TextNumber++;}       else {TextNumber = 0;}       initMessage();      }   Text = HelpText.substring(0, i);   return (Text);   }function scrollToBottom() { tb = content.getElementById('first'); tb.scrollTop = tb.scrollHeight; }// Called from onLoad in BODY tag & resetDisplay().function titleDisplay()   {   document.forms[0].elements[0].value="\r\n             Click start";   initMessage();   }// Sets Text & HelpText equal to messages for use in rollMessage ().function initMessage()    {   Text = Text + TextInput[TextNumber];   HelpText = Text;   }// Called by Stop button.function stopMessage()    {   TimerSet=false;    clearTimeout (TimerId);    }// Called by Reset button.function resetDisplay()   {   TimerSet=false;    clearTimeout (TimerId);   TextNumber=0;   i=0;   titleDisplay();      }// Deactivate Cloaking --></SCRIPT><style type="text/css">.content {height:100px;width:550px;overflow-y:scroll;padding:2px;border:1px solid black;float:left}</style></head><body><CENTER><STRONG>Netfan Webcomic</STRONG></CENTER><BR><BR><FORM><TEXTAREA class="content" id="first" onChange="scrollToBottom();" ROWS=15 COLS=55 wrap=yes></TEXTAREA><BR><BR><TABLE BORDER=0 WIDTH=300><TD align="center"><INPUT TYPE="button" VALUE="Start" onClick="startMessage()"><TD align="center"><INPUT TYPE="button" VALUE="Reset" onClick="resetDisplay()"><TD align="center"><INPUT TYPE="button" VALUE="Stop" onClick="stopMessage()"></TABLE><script>titleDisplay();</script></FORM><BR></body></html>