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.

2 Color Code

View previous topic View next topic Go down

2 Color Code

Post by Kaizer Lee on December 1st 2012, 5:12 am

I found the topic in the 2-color thing http://help.forumotion.com/t113316-two-colors-in-one-username and I tried LG's and Lily's input, but only Lily's input worked for me.

Anyway, this is LG's input with my revision for the white color:

Code:
window.insertChatBoxNew = insertChatBox;
$(function(){
 var color = function(html) {
  var name = html.replace(/<[^>]+>/g, '');
  return html.replace(name, name.replace(/^([^\s]+)/, '<span style="color:#ffffff">$1</span>');
 };
 $('a[href="/u1"]').each(function(i,e){
  this.innerHTML = #ffffff( this.innerHTML );
 });
 var cb = document.getElementById('frame_chatbox');
 if(cb) {
    cb.name = 'chatbox';
    $('a[href="/u1"]', document.chatbox.document.getElementById('chatbox')).each(function() {
      this.innerHTML = #ffffff( this.innerHTML );
    });
  }
});

Did I do the code right? Anyway, onto the other main question, is it possible to expand this code so that it'll also reach the Profile? And would it involve including a #profile in the code in the jquery part? If anyone knows how to expand the code, please do tell and post the code because it'll be greatly appreciated Smile.

I've tried a variety but seeming as though LG's code won't work, I had to use Lily's code.

Edit: When I meant variety, I've been experimenting with Lily's code but none of what I did is working, so yeah, help would be really appreciated.

Kaizer Lee
Active Poster

Female Posts : 1064
Reputation : 54
Language : English, Tagalog, Spanish and Chinese
Location : Philippines

http://www.medievalchaos.net/forum

Back to top Go down

Re: 2 Color Code

Post by Kaizer Lee on December 2nd 2012, 9:35 am

Bump.

Kaizer Lee
Active Poster

Female Posts : 1064
Reputation : 54
Language : English, Tagalog, Spanish and Chinese
Location : Philippines

http://www.medievalchaos.net/forum

Back to top Go down

Re: 2 Color Code

Post by LGforum on December 2nd 2012, 1:51 pm

The two instances of this: #ffffff( in the code is incorrect, it must stay as color(
Where you added the #ffffff the first time is correct though ( inside the span tags).

So there is just the two instances where you need to change '#ffffff' back into 'color'.

LGforum
Hyperactive

Male Posts : 2254
Reputation : 254
Language : English
Location : UK

http://www.avacweb.com/

Back to top Go down

Re: 2 Color Code

Post by Kaizer Lee on December 2nd 2012, 2:15 pm

The code you inputted doesn't work.

Code:
window.insertChatBoxNew = insertChatBox;
$(function(){
 var color = function(html) {
  var name = html.replace(/<[^>]+>/g, '');
  return html.replace(name, name.replace(/^([^\s]+)/, '<span style="color:#ffffff">$1</span>');
 };
 $('a[href="/u1"]').each(function(i,e){
  this.innerHTML = color( this.innerHTML );
 });
 var cb = document.getElementById('frame_chatbox');
 if(cb) {
    cb.name = 'chatbox';
    $('a[href="/u1"]', document.chatbox.document.getElementById('chatbox')).each(function() {
      this.innerHTML = color( this.innerHTML );
    });
  }
});


I used the original one and just changed the first color code to #ffffff. I use phpbb2, would that require a different code and also, do you know how to expand it to the profiles as well? Since when I use the code, it's only available through posts and that top poster thing; moreover, I already tried everything I could and it would always leave me a blank result, rather, the codes I tried didn't work. I tried adding another variable in the templates as well as the CSS and Javascript, yet the codes won't work. Let me see if I can retrieve the codes I did.

Edit: Everything got deleted thanks to my little sister >_>... sorry >.>

Kaizer Lee
Active Poster

Female Posts : 1064
Reputation : 54
Language : English, Tagalog, Spanish and Chinese
Location : Philippines

http://www.medievalchaos.net/forum

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