Username in color problem

Go down

Solved Username in color problem

Post by BlackScorpion on Fri Aug 22, 2014 10:00 pm

This was working fine until i touched something in the group management panel, went back and redid it over and it still does not work.  

http://help.forumotion.com/t129844-username-in-multiple-colors

Now it doesn't work, were their any changes made to the Javascript or the editor that could have changed something and make it stop working?

this is the script i'm using:

$(function(){
$('a[href="/uXXX]').not(function(){return $("img",this)[0]}).html('<strong><font color="#000000">Go</font><font color="#ff9600">Power</font><font color="#0000">Sports</font></strong>');
});

http://gokartbazaar.com

Thanks


Last edited by BlackScorpion on Sat Aug 23, 2014 9:32 pm; edited 1 time in total
avatar
BlackScorpion
Graphic Designer
Graphic Designer

Male Posts : 5720
Reputation : 792
Language : English
Location : USA

http://help.forumotion.com

Back to top Go down

Solved Re: Username in color problem

Post by Ange Tuteur on Fri Aug 22, 2014 11:43 pm

Hi BlackScorpion,

From the code it looks like you're missing a double quote in a[href=""]. I made it more simple to edit though. Smile

Write : multiColor(id, html);

id : The user id of the member you wish to modify
html : The replacement HTML

Here is the code with one setup :
Code:
$(function(){
  multiColor(733, '<strong><font color="#000000">Go</font><font color="#ff9600">Power</font><font color="#0000">Sports</font></strong>'); // member username
  
  function multiColor(id, html){$('a[href="/u'+id+'"]').not(function(){return $("img",this)[0]}).html(html)}
});
avatar
Ange Tuteur
Forumaster

Male Posts : 13195
Reputation : 2910
Language : EN10, FR5, JA5
Location : Macungie, PA

https://github.com/SethClydesdale

Back to top Go down

Solved Re: Username in color problem

Post by BlackScorpion on Sat Aug 23, 2014 8:58 pm

this would replace the current javascript, correct? I would enter the members id here [href="/u'+id+'"] such as [href="/u'+u1+'"]

S can you provide me an example say for me "BlackScorpion ID u1"
thanks for the help Ange
avatar
BlackScorpion
Graphic Designer
Graphic Designer

Male Posts : 5720
Reputation : 792
Language : English
Location : USA

http://help.forumotion.com

Back to top Go down

Solved Re: Username in color problem

Post by Ange Tuteur on Sat Aug 23, 2014 9:13 pm

Yep, it'll replace your current script.  +id+ is data passed through the multiColor() function.

So it's more simple and takes less space up, you can just copy and paste :
Code:
multiColor(733, '<strong><font color="#000000">Go</font><font color="#ff9600">Power</font><font color="#0000">Sports</font></strong>');

After the first multicolored username, to color another user. Just fill out the fields :

733 => new user id
old html => new html

Here, I added you as the first color :
Code:
$(function(){
 multiColor(1, '<strong><font color="#000000">Black</font><font color="#ff9600">Scorpion</font></strong>'); // BlackScorpion
 multiColor(733, '<strong><font color="#000000">Go</font><font color="#ff9600">Power</font><font color="#0000">Sports</font></strong>'); // GoPowerSports
 
 function multiColor(id, html){$('a[href="/u'+id+'"]').not(function(){return $("img",this)[0]}).html(html)}
});
avatar
Ange Tuteur
Forumaster

Male Posts : 13195
Reputation : 2910
Language : EN10, FR5, JA5
Location : Macungie, PA

https://github.com/SethClydesdale

Back to top Go down

Solved Re: Username in color problem

Post by BlackScorpion on Sat Aug 23, 2014 9:31 pm

Got it now much easier.. Thanks Your the best. Now maybe you can update the tutorial Wink . Just kidding!
avatar
BlackScorpion
Graphic Designer
Graphic Designer

Male Posts : 5720
Reputation : 792
Language : English
Location : USA

http://help.forumotion.com

Back to top Go down

Solved Re: Username in color problem

Post by Ange Tuteur on Sat Aug 23, 2014 9:37 pm

You're welcome BlackScorpion. Smile

Topic archived

You are right, I'll most likely update the tuto with this code since it is easier. Wink
avatar
Ange Tuteur
Forumaster

Male Posts : 13195
Reputation : 2910
Language : EN10, FR5, JA5
Location : Macungie, PA

https://github.com/SethClydesdale

Back to top Go down

Back to top


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