Fireworks only appear on the homepage of the site and the forum?

Go down

Solved Fireworks only appear on the homepage of the site and the forum?

Post by smurfavr on December 2nd 2017, 3:43 pm

How do I make fireworks appear only on the homepage of the site and the forum? I do not want to appear in the forum topics.
Code:
var bits=90; // how many bits
var speed=33; // how fast - smaller is faster
var bangs=7; // how many can be launched simultaneously (note that using too many can slow the script down)
var colours=new Array("#03f", "#f03", "#fff", "#f7efa1", "#0cf", "#f93", "#f0c", "#fff");
//                    blue    red    green  yellow    cyan    orange  pink  white
/****************************
*      Cб»™ng Дђб»“ng Blogspot  *
****************************/
var bangheight=new Array();
var intensity=new Array();
var colour=new Array();
var Xpos=new Array();
var Ypos=new Array();
var dX=new Array();
var dY=new Array();
var stars=new Array();
var decay=new Array();
var swide=800;
var shigh=600;
var boddie;
window.onload=function() { if (document.getElementById) {
  var i;
  boddie=document.createElement("div");
  boddie.style.position="fixed";
  boddie.style.top="0px";
  boddie.style.left="0px";
  boddie.style.overflow="visible";
  boddie.style.width="1px";
  boddie.style.height="1px";
  boddie.style.backgroundColor="transparent";
  document.body.appendChild(boddie);
  set_width();
  for (i=0; i<bangs; i++) {
    write_fire(i);
    launch(i);
    setInterval('stepthrough('+i+')', speed);
  }
}}
function write_fire(N) {
  var i, rlef, rdow;
  stars[N+'r']=createDiv('|', 12);
  boddie.appendChild(stars[N+'r']);
  for (i=bits*N; i<bits+bits*N; i++) {
    stars[i]=createDiv('*', 13);
    boddie.appendChild(stars[i]);
  }
}
function createDiv(char, size) {
  var div=document.createElement("div");
  div.style.font=size+"px monospace";
  div.style.position="absolute";
  div.style.backgroundColor="transparent";
  div.appendChild(document.createTextNode(char));
  return (div);
}
function launch(N) {
  colour[N]=Math.floor(Math.random()*colours.length);
  Xpos[N+"r"]=swide*0.5;
  Ypos[N+"r"]=shigh-5;
  bangheight[N]=Math.round((0.5+Math.random())*shigh*0.4);
  dX[N+"r"]=(Math.random()-0.5)*swide/bangheight[N];
  if (dX[N+"r"]>1.25) stars[N+"r"].firstChild.nodeValue="/";
  else if (dX[N+"r"]<-1.25) stars[N+"r"].firstChild.nodeValue="\";
  else stars[N+"r"].firstChild.nodeValue="|";
  stars[N+"r"].style.color=colours[colour[N]];
}
function bang(N) {
  var i, Z, A=0;
  for (i=bits*N; i<bits+bits*N; i++) {
    Z=stars[i].style;
    Z.left=Xpos[i]+"px";
    Z.top=Ypos[i]+"px";
    if (decay[i]) decay[i]--;
    else A++;
    if (decay[i]==15) Z.fontSize="10px";
    else if (decay[i]==7) Z.fontSize="2px";
    else if (decay[i]==1) Z.visibility="hidden";
    Xpos[i]+=dX[i];
    Ypos[i]+=(dY[i]+=1.25/intensity[N]);
  }
  if (A!=bits) setTimeout("bang("+N+")", speed);
}
function stepthrough(N) {
  var i, M, Z;
  var oldx=Xpos[N+"r"];
  var oldy=Ypos[N+"r"];
  Xpos[N+"r"]+=dX[N+"r"];
  Ypos[N+"r"]-=4;
  if (Ypos[N+"r"]<bangheight[N]) {
    M=Math.floor(Math.random()*3*colours.length);
    intensity[N]=5+Math.random()*4;
    for (i=N*bits; i<bits+bits*N; i++) {
      Xpos[i]=Xpos[N+"r"];
      Ypos[i]=Ypos[N+"r"];
      dY[i]=(Math.random()-0.5)*intensity[N];
      dX[i]=(Math.random()-0.5)*(intensity[N]-Math.abs(dY[i]))*1.25;
      decay[i]=25+Math.floor(Math.random()*25);
      Z=stars[i];
      if (M<colours.length) Z.style.color=colours[i%2?colour[N]:M];
      else if (M<2*colours.length) Z.style.color=colours[colour[N]];
      else Z.style.color=colours[i%colours.length];
      Z.style.fontSize="20px";
      Z.style.visibility="visible";
    }
    bang(N);
    launch(N);
  }
  stars[N+"r"].style.left=oldx+"px";
  stars[N+"r"].style.top=oldy+"px";
}
window.onresize=set_width;
function set_width() {
  var sw_min=999999;
  var sh_min=999999;
  if (document.documentElement && document.documentElement.clientWidth) {
    if (document.documentElement.clientWidth>0) sw_min=document.documentElement.clientWidth;
    if (document.documentElement.clientHeight>0) sh_min=document.documentElement.clientHeight;
  }
  if (typeof(self.innerWidth)!="undefined" && self.innerWidth) {
    if (self.innerWidth>0 && self.innerWidth<sw_min) sw_min=self.innerWidth;
    if (self.innerHeight>0 && self.innerHeight<sh_min) sh_min=self.innerHeight;
  }
  if (document.body.clientWidth) {
    if (document.body.clientWidth>0 && document.body.clientWidth<sw_min) sw_min=document.body.clientWidth;
    if (document.body.clientHeight>0 && document.body.clientHeight<sh_min) sh_min=document.body.clientHeight;
  }
  if (sw_min==999999 || sh_min==999999) {
    sw_min=800;
    sh_min=600;
  }
  swide=sw_min;
  shigh=sh_min;


Last edited by smurfavr on December 12th 2017, 4:45 pm; edited 1 time in total
avatar
smurfavr
Active Poster

Male Posts : 1693
Reputation : 17
Language : Bulgarian

http://smurfa.bulgarianforum.net/

Back to top Go down

Solved Re: Fireworks only appear on the homepage of the site and the forum?

Post by APE on December 2nd 2017, 6:13 pm

just set them in your Javascripts



avatar
APE
Administrator
Administrator

Male Posts : 12458
Reputation : 1304
Language : fluent in dork / mumbojumbo & English haha

http://chatworld.forumotion.co.uk/

Back to top Go down

Solved Re: Fireworks only appear on the homepage of the site and the forum?

Post by smurfavr on December 2nd 2017, 7:45 pm

@APE
If I put it as Javascripts, it does not work. I need to place it in the template global_footer_begin to work.
avatar
smurfavr
Active Poster

Male Posts : 1693
Reputation : 17
Language : Bulgarian

http://smurfa.bulgarianforum.net/

Back to top Go down

Solved Re: Fireworks only appear on the homepage of the site and the forum?

Post by APE on December 2nd 2017, 7:48 pm

oh if its in templates then sadly you can't change what page it shows in sorry.



avatar
APE
Administrator
Administrator

Male Posts : 12458
Reputation : 1304
Language : fluent in dork / mumbojumbo & English haha

http://chatworld.forumotion.co.uk/

Back to top Go down

Solved Re: Fireworks only appear on the homepage of the site and the forum?

Post by smurfavr on December 2nd 2017, 7:51 pm

Could you make this code work as Javascripts?
avatar
smurfavr
Active Poster

Male Posts : 1693
Reputation : 17
Language : Bulgarian

http://smurfa.bulgarianforum.net/

Back to top Go down

Solved Re: Fireworks only appear on the homepage of the site and the forum?

Post by APE on December 2nd 2017, 7:53 pm




avatar
APE
Administrator
Administrator

Male Posts : 12458
Reputation : 1304
Language : fluent in dork / mumbojumbo & English haha

http://chatworld.forumotion.co.uk/

Back to top Go down

Solved Re: Fireworks only appear on the homepage of the site and the forum?

Post by smurfavr on December 2nd 2017, 8:20 pm

I ask my code if it can be done as Javascripts.
avatar
smurfavr
Active Poster

Male Posts : 1693
Reputation : 17
Language : Bulgarian

http://smurfa.bulgarianforum.net/

Back to top Go down

Solved Re: Fireworks only appear on the homepage of the site and the forum?

Post by Van-Helsing on December 3rd 2017, 1:02 am

Hi @smurfavr.
If you place the javascript in the templates overall_header or overall_footer_end the javascript will be executed in every page of your forum. Why don't you follow Ape's instructions? Its the easiest way to to setup it. Wink
avatar
Van-Helsing
Hyperactive

Male Posts : 2413
Reputation : 113
Language : English, Greek

http://helpgr.forumgreek.com/

Back to top Go down

Solved Re: Fireworks only appear on the homepage of the site and the forum?

Post by smurfavr on December 3rd 2017, 12:00 pm

His instructions are for other decorations. I want to make my code.
avatar
smurfavr
Active Poster

Male Posts : 1693
Reputation : 17
Language : Bulgarian

http://smurfa.bulgarianforum.net/

Back to top Go down

Solved Re: Fireworks only appear on the homepage of the site and the forum?

Post by smurfavr on December 12th 2017, 1:52 pm

@smurfavr wrote:I ask my code if it can be done as Javascripts.

Up
avatar
smurfavr
Active Poster

Male Posts : 1693
Reputation : 17
Language : Bulgarian

http://smurfa.bulgarianforum.net/

Back to top Go down

Solved Re: Fireworks only appear on the homepage of the site and the forum?

Post by Neptune- on December 12th 2017, 2:27 pm

Hi,


The same kind of code from the same "provider" but :

- Works through javascript management.
- Copyright has not been removed on it.

Code:
var bits=150; // how many bits
var speed=8; // how fast - smaller is faster
var bangs=5; // how many can be launched simultaneously (note that using too many can slow the script down)
var colours=new Array("#03f", "#f03", "#0e0", "#93f", "#0cf", "#f93", "#f0c");
//                blue   red    green  purple  cyan   orange  pink

/****************************
*     Fireworks Effect    *
*(c)2004-14 mf2fm web-design*
*  http://www.mf2fm.com/rv  *
* DON'T EDIT BELOW THIS BOX *
****************************/
var bangheight=new Array();
var intensity=new Array();
var colour=new Array();
var Xpos=new Array();
var Ypos=new Array();
var dX=new Array();
var dY=new Array();
var stars=new Array();
var decay=new Array();
var swide=800;
var shigh=600;
var boddie;

if (typeof('addRVLoadEvent')!='function') function addRVLoadEvent(funky) {
  var oldonload=window.onload;
  if (typeof(oldonload)!='function') window.onload=funky;
  else window.onload=function() {
   if (oldonload) oldonload();
   funky();
  }
}

addRVLoadEvent(light_blue_touchpaper);

function light_blue_touchpaper() { if (document.getElementById) {
  var i;
  boddie=document.createElement("div");
  boddie.style.position="fixed";
  boddie.style.top="0px";
  boddie.style.left="0px";
  boddie.style.overflow="visible";
  boddie.style.width="1px";
  boddie.style.height="1px";
  boddie.style.backgroundColor="transparent";
  document.body.appendChild(boddie);
  set_width();
  for (i=0; i<bangs; i++) {
   write_fire(i);
   launch(i);
   setInterval('stepthrough('+i+')', speed);
  }
}}

function write_fire(N) {
  var i, rlef, rdow;
  stars[N+'r']=createDiv('|', 12);
  boddie.appendChild(stars[N+'r']);
  for (i=bits*N; i<bits+bits*N; i++) {
   stars[i]=createDiv('*', 13);
   boddie.appendChild(stars[i]);
  }
}

function createDiv(char, size) {
  var div=document.createElement("div");
  div.style.font=size+"px monospace";
  div.style.position="absolute";
  div.style.backgroundColor="transparent";
  div.appendChild(document.createTextNode(char));
  return (div);
}

function launch(N) {
  colour[N]=Math.floor(Math.random()*colours.length);
  Xpos[N+"r"]=swide*0.5;
  Ypos[N+"r"]=shigh-5;
  bangheight[N]=Math.round((0.5+Math.random())*shigh*0.4);
  dX[N+"r"]=(Math.random()-0.5)*swide/bangheight[N];
  if (dX[N+"r"]>1.25) stars[N+"r"].firstChild.nodeValue="/";
  else if (dX[N+"r"]<-1.25) stars[N+"r"].firstChild.nodeValue="\\";
  else stars[N+"r"].firstChild.nodeValue="|";
  stars[N+"r"].style.color=colours[colour[N]];
}

function bang(N) {
  var i, Z, A=0;
  for (i=bits*N; i<bits+bits*N; i++) {
   Z=stars[i].style;
   Z.left=Xpos[i]+"px";
   Z.top=Ypos[i]+"px";
   if (decay[i]) decay[i]--;
   else A++;
   if (decay[i]==15) Z.fontSize="7px";
   else if (decay[i]==7) Z.fontSize="2px";
   else if (decay[i]==1) Z.visibility="hidden";
   if (decay[i]>1 && Math.random()<.1) {
     Z.visibility="hidden";
     setTimeout('stars['+i+'].style.visibility="visible"', speed-1);
   }
   Xpos[i]+=dX[i];
   Ypos[i]+=(dY[i]+=1.25/intensity[N]);

  }
  if (A!=bits) setTimeout("bang("+N+")", speed);
}

function stepthrough(N) {
  var i, M, Z;
  var oldx=Xpos[N+"r"];
  var oldy=Ypos[N+"r"];
  Xpos[N+"r"]+=dX[N+"r"];
  Ypos[N+"r"]-=4;
  if (Ypos[N+"r"]<bangheight[N]) {
   M=Math.floor(Math.random()*3*colours.length);
   intensity[N]=5+Math.random()*4;
   for (i=N*bits; i<bits+bits*N; i++) {
     Xpos[i]=Xpos[N+"r"];
     Ypos[i]=Ypos[N+"r"];
     dY[i]=(Math.random()-0.5)*intensity[N];
     dX[i]=(Math.random()-0.5)*(intensity[N]-Math.abs(dY[i]))*1.25;
     decay[i]=16+Math.floor(Math.random()*16);
     Z=stars[i];
     if (M<colours.length) Z.style.color=colours[i%2?colour[N]:M];
     else if (M<2*colours.length) Z.style.color=colours[colour[N]];
     else Z.style.color=colours[i%colours.length];
     Z.style.fontSize="13px";
     Z.style.visibility="visible";
   }
   bang(N);
   launch(N);
  }
  stars[N+"r"].style.left=oldx+"px";
  stars[N+"r"].style.top=oldy+"px";
}

window.onresize=set_width;
function set_width() {
  var sw_min=999999;
  var sh_min=999999;
  if (document.documentElement && document.documentElement.clientWidth) {
   if (document.documentElement.clientWidth>0) sw_min=document.documentElement.clientWidth;
   if (document.documentElement.clientHeight>0) sh_min=document.documentElement.clientHeight;
  }
  if (typeof(self.innerWidth)!="undefined" && self.innerWidth) {
   if (self.innerWidth>0 && self.innerWidth<sw_min) sw_min=self.innerWidth;
   if (self.innerHeight>0 && self.innerHeight<sh_min) sh_min=self.innerHeight;
  }
  if (document.body.clientWidth) {
   if (document.body.clientWidth>0 && document.body.clientWidth<sw_min) sw_min=document.body.clientWidth;
   if (document.body.clientHeight>0 && document.body.clientHeight<sh_min) sh_min=document.body.clientHeight;
  }
  if (sw_min==999999 || sh_min==999999) {
   sw_min=800;
   sh_min=600;
  }
  swide=sw_min;
  shigh=sh_min;
}
avatar
Neptune-
Forumember

Male Posts : 229
Reputation : 38
Language : French (10), English (8), CSS (5), HTML (4), Javascript (4)
Location : France

https://www.galaxie-series.net/

Back to top Go down

Solved Re: Fireworks only appear on the homepage of the site and the forum?

Post by smurfavr on December 12th 2017, 3:56 pm

Thank you @Neptune-.

Is there a way to change the link to the fireworks files? I want to upload the files on my host.
avatar
smurfavr
Active Poster

Male Posts : 1693
Reputation : 17
Language : Bulgarian

http://smurfa.bulgarianforum.net/

Back to top Go down

Solved Re: Fireworks only appear on the homepage of the site and the forum?

Post by Neptune- on December 12th 2017, 4:42 pm

@smurfavr wrote:Is there a way to change the link to the fireworks files? I want to upload the files on my host.

You cannot change what does not exist Wink

That script uses no files. It's ... just a script.
avatar
Neptune-
Forumember

Male Posts : 229
Reputation : 38
Language : French (10), English (8), CSS (5), HTML (4), Javascript (4)
Location : France

https://www.galaxie-series.net/

Back to top Go down

Solved Re: Fireworks only appear on the homepage of the site and the forum?

Post by smurfavr on December 12th 2017, 4:46 pm

Ok. Thank you Neptune-.
avatar
smurfavr
Active Poster

Male Posts : 1693
Reputation : 17
Language : Bulgarian

http://smurfa.bulgarianforum.net/

Back to top Go down

Solved Re: Fireworks only appear on the homepage of the site and the forum?

Post by APE on December 12th 2017, 7:29 pm

Problem solved & topic archived.
Please read our forum rules:  ESF General Rules



avatar
APE
Administrator
Administrator

Male Posts : 12458
Reputation : 1304
Language : fluent in dork / mumbojumbo & English haha

http://chatworld.forumotion.co.uk/

Back to top Go down

Back to top


 
Permissions in this forum:
You cannot reply to topics in this forum