SMF For Free Support Forum

SMF For Free Support => SMF For Free Codes and Support => Topic started by: Agent Moose on July 28, 2007, 08:39:00 pm

Title: [Code] Membergroup Color
Post by: Agent Moose on July 28, 2007, 08:39:00 pm
Add this to your headers if you don't have it...
Code: [Select]
<script src="/jquery.js"></script>
Footers:
Code: [Select]
<script>
function color_group_name() {
//Created by Agent Moose (smcodes.smfforfree3.com)
var group = new Array()
group[group.length] = ["Newbie","orange"]
group[group.length] = ["MEMBER GROUP","COLOR"]

for(f=0;f<group.length;f++){
$("div.smalltext").each(function() {
if(this.innerHTML.match(group[f][0])){
this.innerHTML = this.innerHTML.replace(group[f][0],"<font color='" + group[f][1] + "'>" + group[f][0] + "</font>");
};});};}
color_group_name();
</script>

What this code does is let you add color to the Membergroup name that showes up in the post.  It doesn't change the color of the username, just the little membergroup that showes under there username.

MEMBER GROUP = The Name of the member group.
COLOR = The color it will be.

Preview (http://codepreview.smfforfree3.com/index.php/topic,2.0.html)
Title: Re: Membergroup Color
Post by: rileyks on July 29, 2007, 01:10:57 pm
Great Job!  I like alot!  I added just enough for all my different staff.  Question - can you add to them?  Some of the colors depending on the stylesheet colors in the posts make them very light...lol.
Title: Re: Membergroup Color
Post by: LaundryLady on July 29, 2007, 03:42:51 pm
Good Question, can we use the hex colors( for example #00000)?
Title: Re: Membergroup Color
Post by: Agent Moose on July 29, 2007, 06:36:52 pm
Yes, you can use HEX
Title: Re: Membergroup Color
Post by: rileyks on July 29, 2007, 11:02:28 pm
Cool!  Will have to play with it some more tomorrow then...lol.  Thanks!!!!
Title: Re: Membergroup Color
Post by: Laugh-nd-kid on July 30, 2007, 03:38:24 am
good ole code.
Title: Re: Membergroup Color
Post by: rileyks on July 30, 2007, 02:52:43 pm
Yep...that worked great!  tyvm all!
Title: Re: [Code] Membergroup Color
Post by: OhioLawyer on October 21, 2008, 09:38:52 am
hmmm it didn't do anything.  And I don't see any difference in the test link you provided either.  What is wrong?

wiiunite.smfforfree3.com
Title: Re: [Code] Membergroup Color
Post by: - Lawrence - on October 21, 2008, 10:56:52 am
I don't see any change either, maybe I have javascript disabled, I don't know.
Title: Re: [Code] Membergroup Color
Post by: Shimmy Shabby on October 22, 2008, 04:46:26 pm
I don't see any change either, maybe I have javascript disabled, I don't know.
May i see the code you used please?
Title: Re: [Code] Membergroup Color
Post by: Mythe on July 31, 2011, 12:53:09 pm
Can i make it [/b]
Title: Re: [Code] Membergroup Color
Post by: simply sibyl on August 06, 2011, 10:42:12 am
Can i make it [/b]

Some edits CAN be done to the code but it has to be html, not bbcode.

Replace the code with:


Code: [Select]
<script>
function color_group_name() {
//Created by Agent Moose (smcodes.smfforfree3.com)
var group = new Array()
group[group.length] = ["Newbie","orange"]
group[group.length] = ["MEMBER GROUP","COLOR"]

for(f=0;f<group.length;f++){
$("div.smalltext").each(function() {
if(this.innerHTML.match(group[f][0])){
this.innerHTML = this.innerHTML.replace(group[f][0],"<strong><font color='" + group[f][1] + "'>" + group[f][0] + "</font></strong>");
};});};}
color_group_name();
</script>