MyBB Community Forums

Full Version: Will this code work for a MyBB forum and my website?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi all here is my site, http://www.skating-camp.com/ and here is my forum http://www.skating-camp.com/forums/ . This code is for falling snowflakes. How can I post this on my site and on my MyBB forum???

Please help. Smile Smile Smile

Thank you in advance
TIm

self.snow = new Object;
snow.amount = mod_snow_count;
snow.flake  = [
"http://www.slaed.net/forum/uploads/post-896-1166093572.gif"
];

// snow.rand( int maximum );
snow.rand = function( x ){
    return Math.round( Math.random() * x );
}

snow.data = {'x':[],'y':[],'spd':[],'stp':[],'cstp':[]}

self.IsNS = ( document.layers ) ? true : false ;
if( self.IsNS ){
    for( snow.counter = 0; snow.counter < snow.amount; snow.counter++ ){
        document.write("<layer name='sn" + snow.counter + "' left=0 top=0><img src="+snow.flake[ snow.rand( snow.flake.length-1 ) ]+"></layer>");
    }
}
else{
    for( snow.counter = 0; snow.counter < snow.amount; snow.counter++ ){
        document.write("<img id='si" + snow.counter + "' src='"+snow.flake[ snow.rand( snow.flake.length-1 ) ]+"' style='position:absolute;'>");
    }
}
for( snow.counter = 0; snow.counter < snow.amount; snow.counter++ ){
    snow.data['y'][ snow.counter ] = snow.rand( screen.availHeight );
    snow.data['x'][ snow.counter ] = snow.rand( screen.availWidth );
    snow.data['spd'][ snow.counter ] = Math.random()*3+2;
    snow.data['cstp'][ snow.counter ] = 0;
    snow.data['stp'][ snow.counter ] = Math.random()*0.1+0.05;
}
debug = true;
snow.fall = function(){
    var hscrll = window.pageYOffset || document.documentElement.scrollTop;
    var wscrll = window.pageXOffset || document.documentElement.scrollLeft;
    for( snow.counter = 0; snow.counter < snow.amount; snow.counter++ ){
        var obj = document.getElementById( "si" + snow.counter ) || document.layers['sn' + snow.counter];

        snow.data['y'][ snow.counter ] += snow.data['spd'][snow.counter] * Math.sin( 90 * Math.PI / 180 );
        snow.data['x'][ snow.counter ] += snow.data['spd'][snow.counter] * Math.cos( snow.data['cstp'][ snow.counter ] );
        if( snow.data['y'][ snow.counter ] + obj.offsetHeight +60 > screen.availHeight ){
            snow.data['y'][ snow.counter ] = -60;
            snow.data['x'][ snow.counter ] = snow.rand( screen.availWidth );
            snow.data['spd'][ snow.counter ] = Math.random()*5+2;
        }
        if( snow.data['x'][ snow.counter ] + obj.offsetWidth +60 > screen.availWidth ){
            snow.data['y'][ snow.counter ] = snow.rand( screen.availHeight );
            snow.data['x'][ snow.counter ] = -60;
            snow.data['spd'][ snow.counter ] = Math.random()*5+2;
        }
        if( self.IsNS ){
            obj.left = snow.data['x'][snow.counter] + wscrll;
            obj.top  = snow.data['y'][snow.counter] + hscrll;
        }
        else{
            obj.style.left = String( snow.data['x'][snow.counter] + wscrll ) + "px";
            obj.style.top  = String( snow.data['y'][snow.counter] + hscrll ) + "px";
        }
        snow.data['cstp'][ snow.counter ] += snow.data['stp'][ snow.counter ];
    }
    setTimeout( "snow.fall()", 10 );
}
snow.fall();