The forum of the forums
Welcome to the Official Support Forum of Forumotion!

To take full advantage of everything offered by our forum, please log in if you are already a member, or join our community if you've not yet.



Create a free forum like this one.

Username in multiple colors

View previous topic View next topic Go down

Username in multiple colors

Post by Ange Tuteur on January 17th 2014, 2:21 pm



Username in multiple colors


This tutorial will allow you to put more colors in the username of a member.


Here are the steps :

1. ) Create a new Javascript

Administration Panel > Modules > Javascript codes management > Create a new Javascript

Remember to tick 'in all the pages'

Copy and paste the following code :

Code:
$(function(){
  multiColor(XX, 'MY HTML CODE');
  
  function multiColor(id, html){$('a[href="/u'+id+'"]').not(function(){return $("img",this)[0]}).html(html)}
});


2. ) Insert the details of a member into the code

- Replace the 2 "XX" in your code with the ID of a member. This ID can be found on the profile in the address bar after "/u".

Here is an example if we would put Ange Tuteur.



3. ) Put some color into the code

Once you have chosen your colors, you can insert it into your JS code.

Here is an example with my username Ange Tuteur in blue and green.

I have added this code in place of "MY HTML CODE"

Code:
<strong><font color="#32A4D5">Ange</font> <font color="#7BB92B">Tuteur</font></strong>



Now simply insert the desired color codes :

Code:
$(function(){
  multiColor(88576, '<strong><font color="#32A4D5">Ange</font> <font color="#7BB92B">Tuteur</font></strong>');
  
  function multiColor(id, html){$('a[href="/u'+id+'"]').not(function(){return $("img",this)[0]}).html(html)}
});

Then all you need to do is submit and you're done. Smile


If you want to put several usernames in the same color, or different colors you can do the following in your Javascript code :

Simply copy and paste your final code, then modify the information about the member and colors.


The resulting code :
Code:
$(function(){
  multiColor(88576, '<strong><font color="#32A4D5">Ange</font> <font color="#7BB92B">Tuteur</font></strong>');
  multiColor(46681, '<strong><font color="#32A4D5">Black</font> <font color="#7BB92B">Scorpion</font></strong>');
  
  function multiColor(id, html){$('a[href="/u'+id+'"]').not(function(){return $("img",this)[0]}).html(html)}
});


Ange Tuteur
Forumaster

Male Posts : 13021
Reputation : 2681
Language : EN10, FR5
Location : Pennsylvania

http://fmdesign.forumotion.com

Back to top Go down

View previous topic View next topic Back to top


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