daily pastebin goal
7%
SHARE
TWEET

Untitled

a guest Mar 19th, 2019 56 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.  <script type="text/javascript">
  2. // <![CDATA[
  3. var colours=new Array("#a6f", "#60f", "#60f", "#a6f", "#ccc"); // colours for top, right, bottom and left borders and background of bubbles
  4. var bubbles=66; // maximum number of bubbles on screen
  5. var over_or_under="over"; // set to "over" for bubbles to always be on top, or "under" to allow them to float behind other objects
  6.  
  7. /****************************
  8. * JavaScript Bubble Cursor  *
  9. *(c)2010-13 mf2fm web-design*
  10. *  http://www.mf2fm.com/rv  *
  11. * DON'T EDIT BELOW THIS BOX *
  12. ****************************/
  13. var x=ox=400;
  14. var y=oy=300;
  15. var swide=800;
  16. var shigh=600;
  17. var sleft=sdown=0;
  18. var bubb=new Array();
  19. var bubbx=new Array();
  20. var bubby=new Array();
  21. var bubbs=new Array();
  22. var sploosh=false;
  23.  
  24. function addLoadEvent(funky) {
  25.   var oldonload=window.onload;
  26.   if (typeof(oldonload)!='function') window.onload=funky;
  27.   else window.onload=function() {
  28.     if (oldonload) oldonload();
  29.     funky();
  30.   }
  31. }
  32.  
  33. addLoadEvent(buble);
  34.  
  35. function buble() { if (document.getElementById) {
  36.   var i, rats, div;
  37.   for (i=0; i<bubbles; i++) {
  38.     rats=createDiv("3px", "3px");
  39.     rats.style.visibility="hidden";
  40.     rats.style.zIndex=(over_or_under=="over")?"1001":"0";
  41.  
  42.     div=createDiv("auto", "auto");
  43.     rats.appendChild(div);
  44.     div=div.style;
  45.     div.top="1px";
  46.     div.left="0px";
  47.     div.bottom="1px";
  48.     div.right="0px";
  49.     div.borderLeft="1px solid "+colours[3];
  50.     div.borderRight="1px solid "+colours[1];
  51.  
  52.     div=createDiv("auto", "auto");
  53.     rats.appendChild(div);
  54.     div=div.style;
  55.     div.top="0px";
  56.     div.left="1px";
  57.     div.right="1px";
  58.     div.bottom="0px"
  59.     div.borderTop="1px solid "+colours[0];
  60.     div.borderBottom="1px solid "+colours[2];
  61.  
  62.     div=createDiv("auto", "auto");
  63.     rats.appendChild(div);
  64.     div=div.style;
  65.     div.left="1px";
  66.     div.right="1px";
  67.     div.bottom="1px";
  68.     div.top="1px";
  69.     div.backgroundColor=colours[4];
  70.     if (navigator.appName=="Microsoft Internet Explorer") div.filter="alpha(opacity=50)";
  71.     else div.opacity=0.5;
  72.     document.body.appendChild(rats);
  73.     bubb[i]=rats.style;
  74.   }
  75.   set_scroll();
  76.   set_width();
  77.   bubble();
  78. }}
  79.  
  80. function bubble() {
  81.   var c;
  82.   if (Math.abs(x-ox)>1 || Math.abs(y-oy)>1) {
  83.     ox=x;
  84.     oy=y;
  85.     for (c=0; c<bubbles; c++) if (!bubby[c]) {
  86.       bubb[c].left=(bubbx[c]=x)+"px";
  87.       bubb[c].top=(bubby[c]=y-3)+"px";
  88.       bubb[c].width="3px";
  89.       bubb[c].height="3px"
  90.       bubb[c].visibility="visible";
  91.       bubbs[c]=3;
  92.       break;
  93.     }
  94.   }
  95.   for (c=0; c<bubbles; c++) if (bubby[c]) update_bubb(c);
  96.   setTimeout("bubble()", 40);
  97. }
  98.  
  99. document.onmousedown=splash;
  100. document.onmouseup=function(){clearTimeout(sploosh);};
  101.  
  102. function splash() {
  103.   ox=-1;
  104.   oy=-1;
  105.   sploosh=setTimeout('splash()', 100);
  106. }
  107.  
  108. function update_bubb(i) {
  109.   if (bubby[i]) {
  110.     bubby[i]-=bubbs[i]/2+i%2;
  111.     bubbx[i]+=(i%5-2)/5;
  112.     if (bubby[i]>sdown && bubbx[i]>sleft && bubbx[i]<sleft+swide+bubbs[i]) {
  113.       if (Math.random()<bubbs[i]/shigh*2 && bubbs[i]++<8) {
  114.         bubb[i].width=bubbs[i]+"px";
  115.         bubb[i].height=bubbs[i]+"px";
  116.       }
  117.       bubb[i].top=bubby[i]+"px";
  118.       bubb[i].left=bubbx[i]+"px";
  119.     }
  120.     else {
  121.       bubb[i].visibility="hidden";
  122.       bubby[i]=0;
  123.       return;
  124.     }
  125.   }
  126. }
  127.  
  128. document.onmousemove=mouse;
  129. function mouse(e) {
  130.   if (e) {
  131.     y=e.pageY;
  132.     x=e.pageX;
  133.   }
  134.   else {
  135.     set_scroll();
  136.     y=event.y+sdown;
  137.     x=event.x+sleft;
  138.   }
  139. }
  140.  
  141. window.onresize=set_width;
  142. function set_width() {
  143.   var sw_min=999999;
  144.   var sh_min=999999;
  145.   if (document.documentElement && document.documentElement.clientWidth) {
  146.     if (document.documentElement.clientWidth>0) sw_min=document.documentElement.clientWidth;
  147.     if (document.documentElement.clientHeight>0) sh_min=document.documentElement.clientHeight;
  148.   }
  149.   if (typeof(self.innerWidth)=='number' && self.innerWidth) {
  150.     if (self.innerWidth>0 && self.innerWidth<sw_min) sw_min=self.innerWidth;
  151.     if (self.innerHeight>0 && self.innerHeight<sh_min) sh_min=self.innerHeight;
  152.   }
  153.   if (document.body.clientWidth) {
  154.     if (document.body.clientWidth>0 && document.body.clientWidth<sw_min) sw_min=document.body.clientWidth;
  155.     if (document.body.clientHeight>0 && document.body.clientHeight<sh_min) sh_min=document.body.clientHeight;
  156.   }
  157.   if (sw_min==999999 || sh_min==999999) {
  158.     sw_min=800;
  159.     sh_min=600;
  160.   }
  161.   swide=sw_min;
  162.   shigh=sh_min;
  163. }
  164.  
  165. window.onscroll=set_scroll;
  166. function set_scroll() {
  167.   if (typeof(self.pageYOffset)=='number') {
  168.     sdown=self.pageYOffset;
  169.     sleft=self.pageXOffset;
  170.   }
  171.   else if (document.body && (document.body.scrollTop || document.body.scrollLeft)) {
  172.     sdown=document.body.scrollTop;
  173.     sleft=document.body.scrollLeft;
  174.   }
  175.   else if (document.documentElement && (document.documentElement.scrollTop || document.documentElement.scrollLeft)) {
  176.     sleft=document.documentElement.scrollLeft;
  177.     sdown=document.documentElement.scrollTop;
  178.   }
  179.   else {
  180.     sdown=0;
  181.     sleft=0;
  182.   }
  183. }
  184.  
  185. function createDiv(height, width) {
  186.   var div=document.createElement("div");
  187.   div.style.position="absolute";
  188.   div.style.height=height;
  189.   div.style.width=width;
  190.   div.style.overflow="hidden";
  191.   div.style.backgroundColor="transparent";
  192.   return (div);
  193. }
  194. // ]]>
  195. </script>
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top