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.

Chat Box Icon Coding?

View previous topic View next topic Go down

Chat Box Icon Coding?

Post by PhoenixWillow on July 19th 2015, 9:19 pm

So, recently I partnered with somebody starting a forum. I've never been good with JavaScript, but you need it to edit the CBox. I had a friend help me find the code, and this is what I have:

Code:
$(window).load(function() {
var chatbox_script = function() {
var overrided = Chatbox.prototype.refresh;
Chatbox.prototype.refresh = function(data) {
overrided.call(this, data);
$('.chatbox-username').each(function(){
this.previousSibling&&$.trim(this.previousSibling.nodeValue)=="@"&&$(this.previousSibling).replaceWith('<img src="http://orig02.deviantart.net/811a/f/2012/037/2/8/red_star_icon_by_midnight_flame-d4oxff8.png" /> ')
})
};
};
var s=document.createElement('script');s.text="("+chatbox_script.toString()+")();";$('object[data^="/chatbox/index.forum"],iframe[src^="/chatbox/index.forum"]').each(function(){try{$(this.contentDocument||this.contentWindow.document).find("#chatbox").closest("html").find("head").first().each(function(){this.appendChild(s.cloneNode(true))})}catch(a){}})
});

What do I do to change this code so that it only isolates to one person? At the moment, it is adding stars to all administrators in the chatbox indiscriminately.
avatar
PhoenixWillow
Forumember

Female Posts : 45
Reputation : 1
Language : English
Location : England

http://skyofstones.forumotion.com/

Back to top Go down

Re: Chat Box Icon Coding?

Post by PhoenixWillow on July 19th 2015, 11:57 pm

Bump....
avatar
PhoenixWillow
Forumember

Female Posts : 45
Reputation : 1
Language : English
Location : England

http://skyofstones.forumotion.com/

Back to top Go down

Re: Chat Box Icon Coding?

Post by Chellizard on July 20th 2015, 1:05 am

I was curious for this as well. (: But I was going to ask it in my ongoing topic soon. Ah well, I suppose there's no harm in the questions being separate.

So, I also second this. I was wondering how to isolate it so Administrators, or certain GROUPS have certain symbols by their name in the chat box.
avatar
Chellizard
Forumember

Female Posts : 123
Reputation : 12
Language : English

http://superhero-rpg.com

Back to top Go down

Re: Chat Box Icon Coding?

Post by PhoenixWillow on July 21st 2015, 2:16 am

Bump....
avatar
PhoenixWillow
Forumember

Female Posts : 45
Reputation : 1
Language : English
Location : England

http://skyofstones.forumotion.com/

Back to top Go down

Re: Chat Box Icon Coding?

Post by PhoenixWillow on July 22nd 2015, 7:50 am

Bump
avatar
PhoenixWillow
Forumember

Female Posts : 45
Reputation : 1
Language : English
Location : England

http://skyofstones.forumotion.com/

Back to top Go down

Re: Chat Box Icon Coding?

Post by PhoenixWillow on July 23rd 2015, 4:45 am

Bump
avatar
PhoenixWillow
Forumember

Female Posts : 45
Reputation : 1
Language : English
Location : England

http://skyofstones.forumotion.com/

Back to top Go down

Re: Chat Box Icon Coding?

Post by SLGray on July 23rd 2015, 5:06 am

Please don't double post. Your post needs to be separated by at least 24 hours before bumping. Please use the edit button instead!


When your topic has been solved, ensure you mark the topic solved.
Never post your email in public.

avatar
SLGray
Administrator
Administrator

Male Posts : 40447
Reputation : 2728
Language : English
Location : United States

https://fmthemes.forumotion.com/

Back to top Go down

Re: Chat Box Icon Coding?

Post by PhoenixWillow on July 24th 2015, 8:39 am

...bump
avatar
PhoenixWillow
Forumember

Female Posts : 45
Reputation : 1
Language : English
Location : England

http://skyofstones.forumotion.com/

Back to top Go down

Re: Chat Box Icon Coding?

Post by PhoenixWillow on July 25th 2015, 6:02 pm

BUMP
avatar
PhoenixWillow
Forumember

Female Posts : 45
Reputation : 1
Language : English
Location : England

http://skyofstones.forumotion.com/

Back to top Go down

Re: Chat Box Icon Coding?

Post by PhoenixWillow on July 27th 2015, 5:01 am

Bump... Its been almost a week now.
avatar
PhoenixWillow
Forumember

Female Posts : 45
Reputation : 1
Language : English
Location : England

http://skyofstones.forumotion.com/

Back to top Go down

Re: Chat Box Icon Coding?

Post by Guest on July 27th 2015, 5:22 am

I'm not sure if I understand your question. What exactly are you trying to get out of this code?

Guest
Guest


Back to top Go down

Re: Chat Box Icon Coding?

Post by Eden Alexandria on July 27th 2015, 6:57 am

Put this code into your CSS:

Code:
.chatbox-username[data-user="User #"] {
  padding-left: 20px;
background: url("Icon to have on member in CBox")no-repeat left;
}

Copy/paste as needed. No Javascript necessary.
avatar
Eden Alexandria
Forumember

Female Posts : 36
Reputation : 1
Language : English

http://www.narutolegacy.com/

Back to top Go down

Re: Chat Box Icon Coding?

Post by PhoenixWillow on July 28th 2015, 1:56 am

That code doesn't work. This is for an icon next to a username, not a background behind one. All that code is doing is putting a big space next to the name, regardless of what URL you put in the space, or what user you put in it's appropriate space.
avatar
PhoenixWillow
Forumember

Female Posts : 45
Reputation : 1
Language : English
Location : England

http://skyofstones.forumotion.com/

Back to top Go down

Re: Chat Box Icon Coding?

Post by Eden Alexandria on July 28th 2015, 2:23 am

Simply lower the padding so that it is placed next to the username. For staff who have the "@" sign in the chatbox, it is usually 20px. However, in your case it is probably lower.
avatar
Eden Alexandria
Forumember

Female Posts : 36
Reputation : 1
Language : English

http://www.narutolegacy.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