The forum of the forums
Would you like to react to this message? Create an account in a few clicks or log in to continue.

Java Script in all pages

4 posters

Go down

Solved Java Script in all pages

Post by tusc September 16th 2008, 11:57 am

I want to put this script in all the pages of the forum. I don't really care if it shows up in the Portal or not, but the problem is, whatever i try it doesn't work. Altough the code works in the first page of the forum.

The forum is here championship.4rumer.com
The code from the first page in the message content is:

Code:
<script type="text/javascript">
if(!window.JSFX)JSFX=new Object();

var LinkFadeInStep=20;
var LinkFadeOutStep=5;
var LinkEndColor="0000FF"

var LinkStartColor="FFFFFF";
var LinkFadeRunning=false;

document.onmouseover = theOnOver;
document.onmouseout  = theOnOut;
if(document.captureEvents)
    document.captureEvents(Event.MOUSEOVER | Event.MOUSEOUT);


function hex2dec(hex){return(parseInt(hex,16));}
function dec2hex(dec){return (dec < 16 ? "0" : "") + dec.toString(16);}
function getColor(start, end, percent)
{

   var r1=hex2dec(start.slice(0,2));
   var g1=hex2dec(start.slice(2,4));
   var b1=hex2dec(start.slice(4,6));

   var r2=hex2dec(end.slice(0,2));
   var g2=hex2dec(end.slice(2,4));
   var b2=hex2dec(end.slice(4,6));

   var pc=percent/100;

   var r=Math.floor(r1+(pc*(r2-r1)) + .5);
   var g=Math.floor(g1+(pc*(g2-g1)) + .5);
   var b=Math.floor(b1+(pc*(b2-b1)) + .5);

   return("#" + dec2hex(r) + dec2hex(g) + dec2hex(b));
}

JSFX.getCurrentElementColor = function(el)
{
   var result = LinkStartColor;

   if (el.currentStyle)
      result = (el.currentStyle.color);
   else if (document.defaultView)
      result = (document.defaultView.getComputedStyle(el,'').getPropertyValue('color'));
   else if(el.style.color) //Opera
      result = el.style.color;

   if(result.charAt(0) == "#")      //color is of type #rrggbb
      result = result.slice(1, 8);
   else if(result.charAt(0) == "r") //color is of type rgb(r, g, b)
   {
      var v1 = result.slice(result.indexOf("(")+1, result.indexOf(")") );
      var v2 = v1.split(",");
      result = (dec2hex(parseInt(v2[0])) + dec2hex(parseInt(v2[1])) + dec2hex(parseInt(v2[2])));
   }

   return result;
}
JSFX.findTagIE = function(el)
{
      while (el && el.tagName != 'A')
            el = el.parentElement;
   return(el);
}
JSFX.findTagNS= function(el)
{
      while (el && el.nodeName != 'A')
            el = el.parentNode;
   return(el);
}
function theOnOver(e)
{
   var lnk;
   if(window.event)
      lnk=JSFX.findTagIE(event.srcElement);
   else
      lnk=JSFX.findTagNS(e.target);

   if(lnk)
      JSFX.linkFadeUp(lnk);
}
JSFX.linkFadeUp = function(lnk)
{
   if(lnk.state == null)
   {
      lnk.state = "OFF";
      lnk.index = 0;
      lnk.startColor = JSFX.getCurrentElementColor(lnk);
      lnk.endColor = LinkEndColor;
   }

   if(lnk.state == "OFF")
   {
      lnk.state = "FADE_UP";
      JSFX.startLinkFader();
   }
   else if( lnk.state == "FADE_UP_DOWN"
      || lnk.state == "FADE_DOWN")
   {
      lnk.state = "FADE_UP";
   }
}
function theOnOut(e)
{
   var lnk;
   if(window.event)
      lnk=JSFX.findTagIE(event.srcElement);
   else
      lnk=JSFX.findTagNS(e.target);

   if(lnk)
      JSFX.linkFadeDown(lnk);
}
JSFX.linkFadeDown = function(lnk)
{
   if(lnk.state=="ON")
   {
      lnk.state="FADE_DOWN";
      JSFX.startLinkFader();
   }
   else if(lnk.state == "FADE_UP")
   {
      lnk.state="FADE_UP_DOWN";
   }
}
JSFX.startLinkFader = function()
{
   if(!LinkFadeRunning)
      JSFX.LinkFadeAnimation();
}

JSFX.LinkFadeAnimation = function()
{
   LinkFadeRunning = false;
   for(i=0 ; i<document.links.length ; i++)
   {
      var lnk = document.links[i];
      if(lnk.state)
      {
         if(lnk.state == "FADE_UP")
         {
            lnk.index+=LinkFadeInStep;
            if(lnk.index > 100)
               lnk.index = 100;
            lnk.style.color=getColor(lnk.startColor, lnk.endColor, lnk.index);

            if(lnk.index == 100)
               lnk.state="ON";
            else
               LinkFadeRunning = true;
         }
         else if(lnk.state == "FADE_UP_DOWN")
         {
            lnk.index+=LinkFadeOutStep;
            if(lnk.index>100)
               lnk.index = 100;
            lnk.style.color=getColor(lnk.startColor, lnk.endColor, lnk.index);

            if(lnk.index == 100)
               lnk.state="FADE_DOWN";
            LinkFadeRunning = true;
         }
         else if(lnk.state == "FADE_DOWN")
         {
            lnk.index-=LinkFadeOutStep;
            if(lnk.index<0)
               lnk.index = 0;
            lnk.style.color=getColor(lnk.startColor, lnk.endColor, lnk.index);
   
            if(lnk.index == 0)
               lnk.state="OFF";
            else
               LinkFadeRunning = true;
         }
      }
   }
   
   if(LinkFadeRunning)
      setTimeout("JSFX.LinkFadeAnimation()", 40);
}
</script>

and i have tried to put this

Code:
<script language=Javascript type=text/javascript src=http://plajavip.evonet.ro/java/fader.js></script>

in the General Configuration an the Forum description, but it erases automatically all the " from the src="http://plajavip.evonet.ro/java/fader.js".

I also tried to make a new widget containing the entire code and put it on, but i won't work either way.

Any help would be really apreciated.


Last edited by tusc on September 19th 2008, 1:35 pm; edited 1 time in total
tusc
tusc
New Member

Male Posts : 4
Reputation : 0
Language : English
Location : Suceava / Romania

http://championship.4rumer.com

Back to top Go down

Solved Re: Java Script in all pages

Post by tusc September 18th 2008, 10:24 pm

LE: also tried with Script Generator. That didn't work either, ....anyone?
tusc
tusc
New Member

Male Posts : 4
Reputation : 0
Language : English
Location : Suceava / Romania

http://championship.4rumer.com

Back to top Go down

Solved Re: Java Script in all pages

Post by Christos September 18th 2008, 11:22 pm

Hey,

Make a Widget on your Forum with HTML on it and try it again. Tell me then if it works!

Regards,


Christos
Christos
Christos
Active Poster

Male Posts : 1238
Reputation : 37
Language : English,French,Greek,Luxembourgish
Location : Luxembourg

http://misery.in-goo.com

Back to top Go down

Solved Re: Java Script in all pages

Post by tusc September 19th 2008, 1:34 pm

your post gave me an idee of what i was doing wrong, i tried earlyer with widgets but i forgot one thing: to writhe ALL the HTML code, i only had put the script code not the body, head, etc tags.

thanks for the tip Christos

Cheers

Solved.
tusc
tusc
New Member

Male Posts : 4
Reputation : 0
Language : English
Location : Suceava / Romania

http://championship.4rumer.com

Back to top Go down

Solved Re: Java Script in all pages

Post by Disaster92 September 19th 2008, 2:18 pm

what can you make with java script? can i see your forum to see what it is??
Disaster92
Disaster92
Forumember

Male Posts : 129
Reputation : 0
Language : Norwegian

Back to top Go down

Solved Re: Java Script in all pages

Post by tusc September 19th 2008, 10:09 pm

the link is in the first post, and the script is a colour fader script for links, you'll see what it does when you enter
tusc
tusc
New Member

Male Posts : 4
Reputation : 0
Language : English
Location : Suceava / Romania

http://championship.4rumer.com

Back to top Go down

Solved Re: Java Script in all pages

Post by RCMZ September 19th 2008, 10:52 pm

cant see it, the page doesnt load, just a white page.
avatar
RCMZ
Forumember

Posts : 283
Reputation : 0
Language : English

http://mytestforum.activebb.net/portal.htm

Back to top Go down

Solved Re: Java Script in all pages

Post by Guest September 20th 2008, 1:35 am

Since this topic appears to be solved, as indicated by the solved tag, I will lock this thread.
Java Script in all pages Pink%5E_%5Earial%5E_%5E2%5E_%5E2%5E_%5EThread+Locked%5E_%5E
avatar
Guest
Guest


Back to top Go down

Back to top

- Similar topics

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