rDrama/files/assets/event/js/neko.js

36 lines
13 KiB
JavaScript
Raw Normal View History

// NEKO FOR JAVASCRIPT
// THIS SCRIPT CODE IS (C) 2004 GREGORY BELL, ALL RIGHTS RESERVED.
// ANYONE IS GRANTED THE RIGHT TO EXECUTE THIS PROGRAM BY LINKING TO IT
// IN THEIR WEB PAGE.
//
// THIS RIGHT DOES NOT EXTEND TO TAKING THE CODE AND HOSTING IT ON A DIFFERENT
// SERVER.
//
// I WORKED HARD TO MAKE THIS AND WOULD LIKE TO KEEP IT, SO PLEASE HAVE FUN
// BUT DON'T STEAL IT!
//
// THANK YOU
//
//⠀⠀⠘⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⡜⠀⠀⠀
//⠀⠀⠀⠑⡀⠀⠀⠀⠀⠀ ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⡔⠁⠀⠀⠀
//⠀⠀⠀⠀⠈⠢⢄⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣀⠴⠊⠀⠀⠀⠀⠀
//⠀⠀⠀⠀⠀⠀⠀⢸⠀⠀⠀⢀⣀⣀⣀⣀⣀⡀⠤⠄⠒⠈⠀⠀⠀⠀⠀⠀⠀⠀
//⠀⠀⠀⠀⠀⠀⠀⠘⣀⠄⠊⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
//⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⡠⠔⠒⠒⠒⠒⠒⠢⠤⣀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
//⠀⠀⠀⠀⠀⠀⠀⡰⠉⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⠑⢄⡀⠀⠀⠀⠀⠀⠀⠀
//⠀⠀⠀⠀⠀⠀⡸⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⡀⠀⠀⠀⠀⠙⠄⠀⠀⠀⠀⠀⠀
//⠀⠀⠀⠀⠀⢀⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠃⠀⢠⠂⠀⠀⠘⡄⠀⠀⠀⠀⠀
//⠀⠀⠀⠀⠀⢸⠀⠀⠀⠀⠀⠀⠀⠀⠈⢤⡀⢂⠀⢨⠀⢀⡠⠈⢣⠀⠀⠀⠀⠀
//⠀⠀⠀⠀⠀⢀⢀⡖⠒⠶⠤⠭⢽⣟⣗⠲⠖⠺⣖⣴⣆⡤⠤⠤⠼⡄⠀⠀⠀⠀
//⠀⠀⠀⠀⠀⠘⡈⠃⠀⠀⠀⠘⣺⡟⢻⠻⡆⠀⡏⠀⡸⣿⢿⢞⠄⡇⠀⠀⠀⠀
//⠀⠀⠀⠀⠀⠀⢣⡀⠤⡀⡀⡔⠉⣏⡿⠛⠓⠊⠁⠀⢎⠛⡗⡗⢳⡏⠀⠀⠀⠀
//⠀⠀⠀⠀⠀⠀⠀⢱⠀⠨⡇⠃⠀⢻⠁⡔⢡⠒⢀⠀⠀⡅⢹⣿⢨⠇⠀⠀⠀⠀
//⠀⠀⠀⠀⠀⠀⠀⢸⠀⠠⢼⠀⠀⡎⡜⠒⢀⠭⡖⡤⢭⣱⢸⢙⠆⠀⠀⠀⠀⠀
//⠀⠀⠀⠀⠀⠀⠀⡸⠀⠀⠸⢁⡀⠿⠈⠂⣿⣿⣿⣿⣿⡏⡍⡏⠀⠀⠀⠀⠀⠀
//⠀⠀⠀⠀⠀⠀⢀⠇⠀⠀⠀⠀⠸⢢⣫⢀⠘⣿⣿⡿⠏⣼⡏⠀⠀⠀⠀⠀⠀⠀
//⠀⠀⠀⠀⣀⣠⠊⠀⣀⠎⠁⠀⠀⠀⠙⠳⢴⡦⡴⢶⣞⣁⣀⣀⡀⠀⠀⠀⠀⠀
//⠀⠐⠒⠉⠀⠀⠀⠀⠀⠀⠀⠀⠀⠠⠀⢀⠤⠀⠀⠀⠀⠀⠀⠀⠈⠉⠀⠀⠀
//
function gE(e,i){if(l){var o=(i=i||self).document.layers;if(o[e])return o[e];for(var s=0;s<o.length;)t=gE(e,o[s++]);return t}return d.all?d.all[e]:d.getElementById(e)}function sE(e){l?e.visibility="show":e.style.visibility="visible"}function hE(e){l?e.visibility="hide":e.style.visibility="hidden"}function sZ(e,t){l?e.zIndex=t:e.style.zIndex=t}function sX(e,t){l?e.left=t:op?e.style.pixelLeft=t:e.style.left=t+px}function sY(e,t){l?e.top=t:op?e.style.pixelTop=t:e.style.top=t+px}function sW(e,t){l?e.clip.width=t:op?e.style.pixelWidth=t:e.style.width=t+px}function sH(e,t){l?e.clip.height=t:op?e.style.pixelHeight=t:e.style.height=t+px}function sC(e,t,i,o,s){l?(X=e.clip,X.top=t,X.right=i,X.bottom=o,X.left=s):e.style.clip="rect("+t+px+" "+i+px+" "+o+px+" "+s+px+")"}function wH(e,t){l&&(Y=e.document,Y.open(),Y.write(t),Y.close()),e.innerHTML&&(e.innerHTML=t)}function cE(i){l?(d.layers[i]=new Layer(0),eval("document."+i+"=d.layers[i]")):void 0!==d.createElement&&(X="<div id='"+i+'\' style="position:absolute">&nbsp;</div>',Y=d.createElement("DIV"),Y?(Y.innerHTML=X,d.body.appendChild(Y)):void 0!==d.body.insertAdjacentHTML&&d.body.insertAdjacentHTML("BeforeEnd",X))}function byName(e,t){for(var i=0;i<e.length;i++)if(e[i].name==t)return e[i];return null}function createLayer(e,t,i,o,s,a){cE(e);var r=gE(e);return sC(r,0,o,s,0),sE(r),sX(r,t),r.myx=t,sY(r,i),r.myy=i,wH(r,a),sZ(r,1e3),r}function Neko(x,y,active,imagedirectory){this.findHome=function(){this.homeX=eval(this.homeXfn),this.homeY=eval(this.homeYfn)},x||(x=0),y||(y=0),parseInt(x)!=x?(this.homeXfn=x,this.homeYfn=y,this.findHome(),x=this.homeX,y=this.homeY):(x=parseInt(x),y=parseInt(y)),active||(active=!1),!imagedirectory&&window.NekoType&&(imagedirectory=window.NekoType),imagedirectory||(imagedirectory="i"),window.remoteimages||(imagedirectory="test/"+imagedirectory),this.directory=imagedirectory;var aPreLoad=new Array("alert","still","nrun1","nrun2","nerun1","nerun2","erun1","erun2","serun1","serun2","srun1","srun2","swrun1","swrun2","wrun1","wrun2","nwrun1","nwrun2","yawn","sleep1","sleep2","itch1","itch2","nscratch1","nscratch2","escratch1","escratch2","sscratch1","sscratch2","wscratch1","wscratch2");this.aGifs=new Array;for(var i=0;i<aPreLoad.length;i++){var imgTemp=new Image;imgTemp.src=this.directory+"/"+aPreLoad[i]+".gif",this.aGifs[aPreLoad[i]]=imgTemp}this.whichNeko=aNekos.length,aNekos[aNekos.length]=this,this.a_resting=new Array("",'this.SetBehavior("wakingup")',"this.chooseIdle()","8","1","still"),this.a_itching=new Array("",'this.SetBehavior("wakingup")','this.SetBehavior("resting")',"6",".5","itch2","itch1"),this.a_scratching=new Array("",'this.SetBehavior("wakingup")','this.SetBehavior("resting")',"4","2","scratch1","scratch2"),this.a_yawning=new Array("",'this.SetBehavior("wakingup")','this.SetBehavior("resting2")',"5","1","yawn"),this.a_resting2=new Array("",'this.SetBehavior("wakingup")','this.SetBehavior("sleeping")',"9","1","still"),this.a_wakingup=new Array('this.SetBehavior("resting")',"",'this.SetBehavior("chasing")',"1","1","alert","still"),this.a_chasing=new Array('this.SetBehavior("resting")',"","","0","1","run1","run2"),this.a_sleeping=new Array("",'this.SetBehavior("wakingup")',"","0","1","sleep1","sleep1","sleep1","sleep2","sleep2","sleep2"),this.behaviorRepetition=0,this.loopTimes=0;var strLayer="layerNeko"+this.whichNeko,strImage="imageNeko"+this.whichNeko,strImageSrc=this.directory+"/still.gif",strNekoObj="aNekos["+this.whichNeko+"]",strContent="<a ondblclick='document.location.href=\"\"' href='' onmouseover='"+strNekoObj+".message();return true' onmouseout='window.status = \"\"' onclick='"+strNekoObj+".active = !"+strNekoObj+".active;return false;' onfocus='this.blur()'><img border='0' name='"+strImage+"' src='"+strImageSrc+"'></a>";this.layer=createLayer(strLayer,x,y,32,32,strContent),this.layer.Neko=this,this.homeX=this.layer.myx,this.homeY=this.layer.myy,this.doc=this.layer.document,this.doc||(this.doc=document),this.image=byName(this.doc.images,strImage),this.image.Neko=this,window.delay&&window.delay>0?this.delay=window.delay+Math.floor(nDela