PHP Web Host - Quality Web Hosting For All PHP Applications Sign up for PayPal and start accepting credit card payments instantly
  Login or Register
 • Home • Downloads • Your Account • Forums • 

View next topic
View previous topic


Google
 
Web RavenPHPScripts (This Site)
Post new topic   Reply to topic
Author Message
unicornio
Involved
Involved


Joined: Aug 13, 2009
Posts: 432

PostPosted: Thu Apr 08, 2010 4:57 pm Reply with quote Back to top

Hi people.

I would like to suggest a nice fader for the nest version.

copy and paste and make a file called fader.js

Code:
var fadeTo = "00FF00";


var fiBy = 6;


var foBy = 10;


var speed = 10;


var ignoreClass = "ignore";


var opera, ie, dom, x = 0, oc, fader, ocs = new Array();

if (navigator.userAgent.indexOf("Opera") != -1) opera = true
else if (document.all && !opera) ie = true
else if (!document.all && document.getElementById) dom = true;

function convertRGB(z)
   {
      var newfcS = "", splitter = "";
      splitter = z.split(",");
      splitter[0] = parseInt(splitter[0].substring(4, splitter[0].length));
      splitter[1] = parseInt(splitter[1]);
      splitter[2] = parseInt(splitter[2].substring(0, splitter[2].length-1));
      for (var q = 0; q < 3; q++)
         {
            splitter[q] = splitter[q].toString(16);
            if (splitter[q].length == 1) splitter[q] = "0" + splitter[q];
            newfcS += splitter[q];
         }
      return newfcS;
   }

function currentColour(index)
   {
      var temp, cc;
      if (opera) cc = document.links[index].style.color
      else if (ie) cc = document.links[index].currentStyle.color
      else if (dom) cc = document.defaultView.getComputedStyle(document.links[index], '').getPropertyValue("color");
      if (cc.length == 4 && cc.substring(0, 1) == "#")
         {
            temp = "";
            for (var a = 0; a < 3; a++)
               temp += cc.substring(a+1, a+2) + cc.substring(a+1, a+2);
            cc = temp;
         }
      else if (cc.indexOf("rgb") != -1) cc = convertRGB(cc)
      else if (cc.length == 7) cc = cc.substring(1, 7)
      else cc = fadeTo;
      return cc;
   }


function convert2Dec(hex)
   {   
      var rgb = new Array();
      for (var u = 0; u < 3; u++)
         rgb[u] = parseInt(hex.substring(u*2, u*2+2), 16);
      return rgb;
   }

function newRGB(f, n, d)
   {
      var change;
      if (d == 1) change = fiBy
      else change = foBy;
      for (var g = 0; g < 3; g++)
         {
            if (n[g] > f[g] && n[g] - change >= 0) n[g] -= change;
            if (n[g] < f[g] && n[g] + change <= 255) n[g] += change;
         }
      return n;
   }

function fade(index, d)
   {
      var fc, nc, temp = new Array(), finished = false;
      nc = convert2Dec(currentColour(index));
      if (d == 1) fc = convert2Dec(fadeTo)
      else fc = convert2Dec(ocs[x]);
      temp = convert2Dec(currentColour(index));
      nc = newRGB(fc, nc, d);
      if ((nc[0] == temp[0]) && (nc[1] == temp[1]) && (nc[2] == temp[2]))
         finished = true;
      if (!finished) document.links[x].style.color = "rgb(" + nc[0] + "," + nc[1] + "," + nc[2] + ")"
      else clearInterval(fader);
   }

function findLink(over)
   {
      if (document.layers) return;
      if (fader)
         {
            clearInterval(fader);
            document.links[x].style.color = "#" + ocs[x];
         }
      if (over && !this.id) this.id = over;
      x = 0;
      while (!(this.id == document.links[x].id) && (x < document.links.length))
         x++;
      if (this.id == document.links[x].id)
         {
            oc = currentColour(x);
            fader = setInterval("fade(" + x  + ", 1)", speed);
         }
   }

function clearFade()
   {
      if (document.layers) return;
      if (fader) clearInterval(fader);
      fader = setInterval("fade(" + x + ", 0)", speed);
   }

function init()
   {
      for (var i = 0; i < document.links.length; i++)
         {
            ocs[i] = currentColour(i);
            var currentOver = document.links[i].onmouseover;
            var currentOut = document.links[i].onmouseout;
            var ignoreIt = document.links[i].className == ignoreClass;
            if (!ignoreIt) document.links[i].id = "link" + i;
            if (!currentOver && !currentOut && !ignoreIt)
               {
                  document.links[i].onmouseover = findLink;
                  document.links[i].onmouseout = clearFade;
               }
         }      
}

if (opera || ie || dom) window.onload = init;



You need to modify javascript.php

Copy and paste this code inside javascript.php in order to call fader.js

Code:
echo "<script type=\"text/javascript\" src=\"scripts/fader.js\"> </script>"


I think it is not so important but it will fade smoothly. You will love it.

What do you think about it?

Very Happy
View user's profile Send private message
kguske
Site Admin


Joined: Jun 04, 2004
Posts: 6044

PostPosted: Thu Apr 08, 2010 8:05 pm Reply with quote Back to top

How about a link to the source site for this script?

Also, you do not need to modify javascript.php since version 2.4.0. For instructions on how, see
Only registered users can see links on this board!
Get registered or login to the forums!
View user's profile Send private message
spasticdonkey
RavenNuke(tm) Development Team


Joined: Dec 02, 2006
Posts: 1364
Location: Texas, USA

PostPosted: Thu Apr 08, 2010 8:55 pm Reply with quote Back to top

did you ever get a link to the demo/sample on the wiki?
kguske wrote:
No need to peel your eyes for long, spasticdonkey! Smile

Only registered users can see links on this board!
Get registered or login to the forums!
is a file that includes examples of how to create addons that require CSS and / or JS at the following levels:

- site HEAD section: nukeINFO(tm) (admin PHP info function)
- site BODY section: nukeSTATS(tm) featuring Google Analytics
- module HEAD section: nukeGAMES(tm) featuring jQuery Sudoku by Chip Camden

The only change required is to rnconfig.php if you want to use Google Analytics. This could be added as a database configuration if we move in the direction of a more flexible configuration file. But for purposes of demonstrating RN's dynamic CSS / JS load process for addons, this should suffice. It even includes samples of how to develop addons that work with RN's dynamic CSS / JS load and with other Nuke flavors that don't support that.

After vetting this, if there are no major issues, I'll update the wiki to refer to this, too.
View user's profile Send private message
Display posts from previous:       
Post new topic   Reply to topic

View next topic
View previous topic
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
Forums ©
 

All logos and trademarks in this site are property of their respective owner.
The comments are property of their posters, all the rest © 2002-2011 by Raven

You can syndicate our news using the file xml

CSE HTML Validator Helped Clean up This Page! [Valid RSS] valid RSS 2.0 Valid robots.txt Stop Spam Harvesters, Join Project Honey Pot

Website engines core code is © copyright by PHP-Nuke but has been heavily patched and modified by myself and others.
PHP-Nuke is a free software released under the GNU/GPL.


:: fisubice phpbb2 style by Daz :: PHP-Nuke theme by www.nukemods.com ::
:: fisubice Theme Modified by the RavenNuke™ Team ::

:: W3C CSS Compliance Validation :: W3C HTML 4.01 Transitional Compliance Validation ::

zerosum