home *** CD-ROM | disk | FTP | other *** search
/ com!online 2002 September / comonline0902.bin / software / InternetDesignerPro / vs_swpak.exe / F28751_mausverf.js < prev    next >
Encoding:
JavaScript  |  1999-06-28  |  3.0 KB  |  85 lines

  1. /***************************************************************************
  2. This script is made by and copyrighted to Gismo from - www.gismo.at
  3. Fuck all losers and lamers for steals this script!
  4. ****************************************************************************/
  5.  
  6. var isNS = (navigator.appName == "Netscape");
  7. layerRef = (isNS) ? "document" : "document.all";
  8. styleRef = (isNS) ? "" : ".style";
  9.  
  10. var queue = new Array();
  11.  
  12. var NUM_OF_TRAIL_PARTS = 5
  13.  
  14. for (x=1; x < 6; x++) {     ///////////////Image Preload
  15.     eval("trailSpriteFrame" + x + " = new Image(28,36);");
  16.     eval("trailSpriteFrame" + x + ".src = 'sep" + x + ".gif';");
  17. }
  18.  
  19.  
  20. ////////////////////////////////////////////////The trail Object
  21.  
  22. function trailSpriteObj(anID) {
  23.     this.trailSpriteID = "trailSprite" + anID; //as before 
  24.     this.imgRef = "trailSprite" + anID + "img"; //reference to the sprites image name
  25.     this.currentFrame = 1; //the varible for looking after the frame
  26.     this.animateTrailSprite = animateTrailSprite; //declare the objects method cycle
  27. }
  28.  
  29. function animateTrailSprite() {
  30.     if (this.currentFrame <6 ) {    //if there are animation frames left, the change sprites the current frame
  31.         if (isNS) {                 //Detect the browser and perform coresponding image switch
  32.             eval("document." + this.trailSpriteID +".document['"+ this.imgRef + "'].src  =  trailSpriteFrame" + this.currentFrame + ".src");
  33.         } else {
  34.             eval("document['" + this.imgRef + "'].src  =  trailSpriteFrame" + this.currentFrame + ".src");
  35.         }
  36.         this.currentFrame ++;         //and increase the objects current frame 
  37.     } else {                         //the current frame has reached its limit so hide the sprite
  38.         eval(layerRef + '.' + this.trailSpriteID +  styleRef + '.visibility = "hidden"');
  39.     }    
  40. }
  41.  
  42. /////////////////////////////////////////////////////////////////
  43.  
  44. function processAnim() {
  45.     for(x=0; x < NUM_OF_TRAIL_PARTS; x++)
  46.             queue[x].animateTrailSprite();
  47. }
  48.  
  49. function processMouse(e) {
  50.     currentObj = shuffleQueue();
  51.     if (isNS) {
  52.         eval("document." + currentObj + ".left = e.pageX - 10 ;");
  53.         eval("document." + currentObj + ".top = e.pageY + 10;");
  54.     } else {
  55.         eval("document.all." + currentObj + ".style.pixelLeft = event.clientX + document.body.scrollLeft - 10 ;");
  56.         eval("document.all." + currentObj + ".style.pixelTop = event.clientY + document.body.scrollTop + 10;");
  57.     }
  58. }
  59.  
  60. function shuffleQueue() {
  61.     lastItemPos = queue.length - 1;
  62.     lastItem = queue[lastItemPos];
  63.     for (i = lastItemPos; i>0; i--) 
  64.         queue[i] = queue[i-1];
  65.     queue[0] = lastItem;
  66.     
  67.     queue[0].currentFrame = 1;    //reset the objects frame number & make the sprite visible again
  68.     eval(layerRef + '.' + queue[0].trailSpriteID +  styleRef + '.visibility = "visible"');    
  69.  
  70.     return     queue[0].trailSpriteID;
  71. }
  72.  
  73. function init() {
  74.     
  75.     for(x=0; x<NUM_OF_TRAIL_PARTS; x++)     //fill array with trail objects
  76.         queue[x] = new trailSpriteObj(x+1) ;
  77.     
  78.     if (isNS) { document.captureEvents(Event.MOUSEMOVE); }
  79.     document.onmousemove = processMouse;
  80.  
  81.     setInterval("processAnim();",50);
  82. }    
  83.  
  84. window.onload = init;
  85.