Go Back   vb.org Archive > vBulletin 4 Discussion > vB4 General Discussions
Prev Previous Post   Next Post Next
  #1  
Old 10-15-2011, 02:53 PM
Ath3na Ath3na is offline
 
Join Date: Sep 2011
Posts: 18
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default Add Fireworks to my forum.

Hi all,

I hope someone can point me in the right direction. This is all new to me so sorry if this is the wrong place.

I have been looking for some nice Firework Addon / Pluggin but there do not seem to be any available for VB 4.x.x

I have seen some nice ones here

http://www.javascript-fx.com/submits.../fw_multi.html

There script is:

/**
* You may use this code for free on any web page provided that
* these comment lines and the following credit remain in the code.
* Cross Browser Fireworks from http://www.javascript-fx.com
*/
/*************************************************/
if(!window.JSFX) JSFX=new Object();

if(!JSFX.createLayer)
{/*** Include Library Code ***/

var ns4 = document.layers;
var ie4 = document.all;
JSFX.objNo=0;

JSFX.getObjId = function(){return "JSFX_obj" + JSFX.objNo++;};

JSFX.createLayer = function(theHtml)
{
var layerId = JSFX.getObjId();

document.write(ns4 ? "<LAYER NAME='"+layerId+"'>"+theHtml+"</LAYER>" :
"<DIV id='"+layerId+"' style='position:absolute'>"+theHtml+"</DIV>" );

var el = document.getElementById ? document.getElementById(layerId) :
document.all ? document.all[layerId] :
document.layers[layerId];

if(ns4)
el.style=el;

return el;
}
JSFX.fxLayer = function(theHtml)
{
if(theHtml == null) return;
this.el = JSFX.createLayer(theHtml);
}
var proto = JSFX.fxLayer.prototype

proto.moveTo = function(x,y){this.el.style.left = x;this.el.style.top=y;}
proto.setBgColor = function(color) { this.el.style.backgroundColor = color; }
proto.clip = function(x1,y1, x2,y2){ this.el.style.clip="rect("+y1+" "+x2+" "+y2+" "+x1+")"; }
if(ns4){
proto.clip = function(x1,y1, x2,y2){
this.el.style.clip.top =y1;this.el.style.clip.left =x1;
this.el.style.clip.bottom=y2;this.el.style.clip.ri ght =x2;
}
proto.setBgColor=function(color) { this.el.bgColor = color; }
}
if(window.opera)
proto.setBgColor = function(color) { this.el.style.color = color==null?'transparent':color; }

if(window.innerWidth)
{
gX=function(){return innerWidth;};
gY=function(){return innerHeight;};
}
else
{
gX=function(){return document.body.clientWidth;};
gY=function(){return document.body.clientHeight;};
}

/*** Example extend class ***/
JSFX.fxLayer2 = function(theHtml)
{
this.superC = JSFX.fxLayer;
this.superC(theHtml + "C");
}
JSFX.fxLayer2.prototype = new JSFX.fxLayer;
}/*** End Library Code ***/

/*************************************************/

/*** Class Firework extends FxLayer ***/
JSFX.Firework = function(fwImages)
{
window[ this.id = JSFX.getObjId() ] = this;
this.imgId = "i" + this.id;
this.fwImages = fwImages;
this.numImages = fwImages.length;
this.superC = JSFX.fxLayer;
this.superC("<img src='"+fwImages[0].src+"' name='"+this.imgId+"'>");

this.img = document.layers ? this.el.document.images[0] : document.images[this.imgId];
this.step = 0;
this.timerId = -1;
this.x = 0;
this.y = 0;
this.dx = 0;
this.dy = 0;
this.ay = 0.2;
this.state = "OFF";
}
JSFX.Firework.prototype = new JSFX.fxLayer;

JSFX.Firework.prototype.getMaxDy = function()
{
var ydiff = gY() - 130;
var dy = 1;
var dist = 0;
var ay = this.ay;
while(dist<ydiff)
{
dist += dy;
dy+=ay;
}
return -dy;
}
JSFX.Firework.prototype.setFrame = function()
{
// this.img.src=this.fwName+"/"+this.step+".gif";
this.img.src=this.fwImages[ this.step ].src;
}
JSFX.Firework.prototype.animate = function()
{

if(this.state=="OFF")
{

this.step = 0;
this.x = -200;
this.y = -200;
this.moveTo(this.x, this.y);
this.setFrame();
if(Math.random() > .95)
{
this.x = (gX()-200)*Math.random();
this.y = (gY()-200)*Math.random();
this.moveTo(this.x, this.y);
this.state = "EXPLODE";
}
}
else if(this.state == "EXPLODE")
{
this.step++;
if(this.step < this.numImages)
this.setFrame();
else
this.state="OFF";
}
}
/*** END Class Firework***/

/*** Class FireworkDisplay extends Object ***/
JSFX.FireworkDisplay = function(n, fwImages, numImages)
{
window[ this.id = JSFX.getObjId() ] = this;
this.timerId = -1;
this.fireworks = new Array();
this.imgArray = new Array();
this.loadCount=0;
this.loadImages(fwImages, numImages);

for(var i=0 ; i<n ; i++)
this.fireworks[this.fireworks.length] = new JSFX.Firework(this.imgArray);
}
JSFX.FireworkDisplay.prototype.loadImages = function(fwName, numImages)
{
for(var i=0 ; i<numImages ; i++)
{
this.imgArray[i] = new Image();
this.imgArray[i].obj = this;
this.imgArray[i].onload = window[this.id].imageLoaded;
this.imgArray[i].src = fwName+"/"+i+".gif";
}
}
JSFX.FireworkDisplay.prototype.imageLoaded = function()
{
this.obj.loadCount++;
}

JSFX.FireworkDisplay.prototype.animate = function()
{
status = this.loadCount;
if(this.loadCount < this.imgArray.length)
return;

for(var i=0 ; i<this.fireworks.length ; i++)
this.fireworks[i].animate();
}
JSFX.FireworkDisplay.prototype.start = function()
{
if(this.timerId == -1)
{
this.state = "OFF";
this.timerId = setInterval("window."+this.id+".animate()", 40);
}

}
JSFX.FireworkDisplay.prototype.stop = function()
{
if(this.timerId != -1)
{
clearInterval(this.timerId);
this.timerId = -1;
for(var i=0 ; i<this.fireworks.length ; i++)
{
this.fireworks[i].moveTo(-100, -100);
this.fireworks[i].step = 0;;
this.fireworks[i].state = "OFF";
}
}
}
/*** END Class FireworkDisplay***/

JSFX.FWStart = function()
{
if(JSFX.FWLoad)JSFX.FWLoad();
myFW1.start();
myFW2.start();
myFW3.start();
myFW4.start();
}
myFW1 = new JSFX.FireworkDisplay(5, "fw05", 21);
myFW2 = new JSFX.FireworkDisplay(5, "fw08", 26);
myFW3 = new JSFX.FireworkDisplay(5, "fw11", 30);
myFW4 = new JSFX.FireworkDisplay(5, "fw13", 15);
JSFX.FWLoad=window.onload;
window.onload=JSFX.FWStart;

There are also 13 folders called fw01 to fw13 that contain the gifs.

I have tried uploading the folders to my forum root and adding the script to my headinclude but it doesn't work.

Any idea what I am doing wrong?

Anyone know a place where I can get an alternative firework pluggin, surely this must of been done many times already.

Thanks in advance
Reply With Quote
 

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 02:15 PM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.03653 seconds
  • Memory Usage 2,376KB
  • Queries Executed 12 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (2)bbcode_code
  • (2)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (5)post_thanks_box
  • (5)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (5)post_thanks_postbit_info
  • (5)postbit
  • (5)postbit_onlinestatus
  • (5)postbit_wrapper
  • (1)showthread_list
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_threadedmode.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_postinfo_query
  • fetch_postinfo
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids_threaded
  • showthread_threaded_construct_link
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete