Username in color problem

Go down

Solved Username in color problem

Post by BlackScorpion on Sat 23 Aug - 4:00

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.  

https://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 Sun 24 Aug - 3:32; edited 1 time in total
avatar
BlackScorpion
Graphic Designer
Graphic Designer

Male Posts : 5782
Reputation : 808
Language : English
Location : USA

https://help.forumotion.com

Back to top Go down

Solved Re: Username in color problem

Post by Ange Tuteur on Sat 23 Aug - 5:43

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 : 13202
Reputation : 2918
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 Sun 24 Aug - 2:58

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 : 5782
Reputation : 808
Language : English
Location : USA

https://help.forumotion.com

Back to top Go down

Solved Re: Username in color problem

Post by Ange Tuteur on Sun 24 Aug - 3:13

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 : 13202
Reputation : 2918
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 Sun 24 Aug - 3:31

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 : 5782
Reputation : 808
Language : English
Location : USA

https://help.forumotion.com

Back to top Go down

Solved Re: Username in color problem

Post by Ange Tuteur on Sun 24 Aug - 3:37

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 : 13202
Reputation : 2918
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