News:

Bored?  Looking to kill some time?  Want to chat with other SMF users?  Join us in IRC chat or Discord

Main Menu

Rainbow Color Membergroup

Started by lazyness, February 05, 2011, 10:38:45 PM

Previous topic - Next topic

lazyness

I've found this coding, but I'm not sure where to put it. Also do I have to edit it for every member that I apply it to?

<script type="text/javascript">
/*
Multi-Colored Display Names for SMF by wildgoosespeeder
v2.2

Based from the JavaScript codes of
Two Colored Display Names by Code Dragon and Boccy109
from ProBoards
*/
var z = 0;
var e = "";
var a = document.getElementsByTagName('a');
var span = document.getElementsByTagName('span');
var memberscolors = [];

// [user id, display name, color 1, color 2, etc...]
memberscolors[z++] = ["1","Mr.Uniquez","FF0000","FF0000","000000","00FF00","00FF00","00FF00","00FF00","00FF00","00FF00","00FF00"];

for(loop = 0; loop < memberscolors.length; loop++)
{
    e = "";
    for(c = 0; c < memberscolors[loop][1].length; c++)
    {
        e += "<b><font color='#" + memberscolors[loop][(c % (memberscolors[loop].length - 2)) + 2] + "'>" + memberscolors[loop][1].charAt(c) + "</b></font>";
    }
    for(href = 0; href < a.length; href++)
    {
        if(a[href].href.match(new RegExp("action=profile;u=" + memberscolors[loop][0] + "$")) && a[href].innerHTML == memberscolors[loop][1])
        {
            a[href].innerHTML = e;
        }
    }
    for(stylecheck = 0; stylecheck < span.length; stylecheck++)
    {
        if(span[stylecheck].innerHTML == memberscolors[loop][1])
        {
            span[stylecheck].innerHTML = e;
        }
    }
}
</script>


IchBin™

What do you want it to do. It looks like it only does it for a specific member. But you could probably pass any username and ID into that function with some PHP variables for more users.
IchBin™        TinyPortal

lazyness

Quote from: IchBin™ on February 05, 2011, 11:29:11 PM
What do you want it to do. It looks like it only does it for a specific member. But you could probably pass any username and ID into that function with some PHP variables for more users.

I want to make the persons username have a sequence of colors like this:

Lazyness
User
Really Long Username

It's a sequence of colors. Not just a random selection. I guess you have to take into account spaces and such. But then again... If the modification attempted to color a SPACE then it would be a color at all and just a space.

Just ignore the fact that the selection of colors I chose to not suit the forum theme. The theme that I use is CoalBlack so it's not a problem.

IchBin™

You should be able to put that code into the index.template.php file where the other <script> tags are. Yes, you'll have to add each member who's name you want colored that way.
IchBin™        TinyPortal

★MR.TALENT★

#4
So the following code goes in the footer of the global footers and headers mod?

<script type="text/javascript">
/*
Multi-Colored Display Names for SMF by wildgoosespeeder
v2.2

Based from the JavaScript codes of
Two Colored Display Names by Code Dragon and Boccy109
from ProBoards
*/var z = 0;
var e = "";
var a = document.getElementsByTagName('a');
var span = document.getElementsByTagName('span');
var memberscolors = [];
// [user id, display name, color 1, color 2, etc...]
memberscolors[z++] = ["1","MR.TALENT","FF0000","FF0000","000000","00FF00","00FF00","00FF00","00FF00","00FF00","00FF00","00FF00"];

for(loop = 0; loop < memberscolors.length; loop++)
{   
         e = "";
         for(c = 0; c < memberscolors[loop][1].length; c++)
        {       
             e += "<b><font color='#" + memberscolors[loop][(c % (memberscolors[loop].length - 2)) + 2] + "'>" + memberscolors[loop][1].charAt(c) + "</b></font>";
        }   
          for(href = 0; href < a.length; href++)
       {       
             if(a[href].href.match(new RegExp("action=profile;u=" + memberscolors[loop][0] + "$")) && a[href].innerHTML == memberscolors[loop][1])
        {           
          a[href].innerHTML = e;       
        }   
   }   
for(stylecheck = 0; stylecheck < span.length; stylecheck++)   
      {       
       if(span[stylecheck].innerHTML == memberscolors[loop][1])
        {
            span[stylecheck].innerHTML = e;
        }
    }
}
</script>

Community Helper√
SMF 2.0 Gold √

xSpiritx

Get the Global Headers and Footer MOD and then put the code in Global Footers, and yes you have do it for each member.

★MR.TALENT★

Is there  code that goes in the footer for image as your whole username ...for example say i have a small png type image and it says my name how would i get that as my username and nothing else.? And is there a mod on how to do it or can i use a code that i can just insert into the global footers and headers??
Community Helper√
SMF 2.0 Gold √

qubbah

im tried for several time but cant be dont...

N i g h t m a r e

Cant get this to load anymore :s

Advertisement: