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.

Profile Username Color Change

View previous topic View next topic Go down

Solved Profile Username Color Change

Post by Ace 1 on September 9th 2015, 12:49 am

How (if possible) can someone change a person's username color on their profile. I know how to change it with profile links, but not on their profile.

I tried this JS code, but it doesn't work on the user's profile, only if their name is mentioned in a post.

Code:
$(document).ready(function() {
  var c = document.getElementsByClassName('content clearfix');
    for (i=0; i<c.length; i++) {   
      c[i].innerHTML = c[i].innerHTML.replace(/Ace/g,'<b><span class="rainbow">Ace</span></b>');    }});

I want to change the highlighted texts to another color.

Ace 1
Forumember

Male Posts : 693
Reputation : 38
Language : my css ready java yo scripts boi
Location : Druid Hill Park smoking indo

http://genocideclan.forumotion.com

Back to top Go down

Solved Re: Profile Username Color Change

Post by KpuCk0 on September 9th 2015, 2:23 am

Am I wrong? Or you really ask about that? It's easy, just add them to group, which is with your color choice.Sorry, If I get it wrong. Smile

Cheers! thumleft


Design Team Leader


Rules of the Graphic Design Section || Becoming a Designer || Graphic Requests

Never tell your password to anyone!
No help without your forum URL!
No support via PM!

KpuCk0
Graphic Designer
Graphic Designer

Male Posts : 746
Reputation : 150
Language : Bulgarian, English
Location : Bulgaria

http://www.lfszone.com

Back to top Go down

Solved Re: Profile Username Color Change

Post by Just Call me Vlad on September 9th 2015, 4:10 am

It's really easy... you do it too Ace... .-.

a[href="/u#"], a[href="/u#"] span, a[href="/u#"] span strong { color: #(Hex Color Code)}

Just Call me Vlad
New Member

Posts : 9
Reputation : 1
Language : English!

http://pb2forumotion.com

Back to top Go down

Solved Re: Profile Username Color Change

Post by Ange Tuteur on September 9th 2015, 10:35 am

Hi @Ace 1,

The following script should do the trick.

Placement : In all the pages
Code:
/\/u\d+/.test(window.location.href) && $(function() {
  var users = {
    'Ange Tuteur' : '<span style="color:red">Ange Tuteur</span>',
    'User A' : '<i>A</i>',
    'User B' : '<b>B</b>'
  },
  i,
  nodes = [$('h1.page-title')[0], $('.h3')[0]];

  for (i in users) {
    $(nodes).html($(nodes).html().replace(new RegExp(i), users[i]));
  }
});

At the top is an object title "users" that contains the username, and the content that's to replace it. The name should be written exactly like it was by the user. If any questions let me know.

Ange Tuteur
Forumaster

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

http://fmdesign.forumotion.com

Back to top Go down

Solved Re: Profile Username Color Change

Post by Ace 1 on September 9th 2015, 8:11 pm

@Ange Tuteur.

Thanks this works.

Do you know the node that would change this?


Ace 1
Forumember

Male Posts : 693
Reputation : 38
Language : my css ready java yo scripts boi
Location : Druid Hill Park smoking indo

http://genocideclan.forumotion.com

Back to top Go down

Solved Re: Profile Username Color Change

Post by Ange Tuteur on September 9th 2015, 11:55 pm

Change the script to this :
Code:
/\/u\d+/.test(window.location.href) && $(function() {
  var users = {
    'Ange Tuteur' : '<span style="color:red">Ange Tuteur</span>',
    'User A' : '<i>A</i>',
    'User B' : '<b>B</b>'
  },
  i,
  nodes = [$('h1.page-title')[0], $('.h3')[0], $('#cp-main h1')[0]];

  for (i in users) {
    $(nodes).html($(nodes).html().replace(new RegExp(i), users[i]));
  }
});

or add the following to the nodes array. Wink
Code:
$('#cp-main h1')[0]

Ange Tuteur
Forumaster

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

http://fmdesign.forumotion.com

Back to top Go down

Solved Re: Profile Username Color Change

Post by Ace 1 on September 11th 2015, 1:22 pm

Thanks.

Solved.

Ace 1
Forumember

Male Posts : 693
Reputation : 38
Language : my css ready java yo scripts boi
Location : Druid Hill Park smoking indo

http://genocideclan.forumotion.com

Back to top Go down

Solved Re: Profile Username Color Change

Post by Ange Tuteur on September 11th 2015, 1:30 pm

You're welcome ^^

Topic archived

Have a good day. Smile

Ange Tuteur
Forumaster

Male Posts : 13021
Reputation : 2683
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