The forum of the forums
Would you like to react to this message? Create an account in a few clicks or log in to continue.

Avatars in chatbox are way too big

3 posters

Go down

Solved Avatars in chatbox are way too big

Post by Kirbs September 2nd 2015, 7:19 pm

Hi, i'm using the codes in this topic https://help.forumotion.com/t139284-codes-to-personalize-your-chatbox#cb-icon and i'm trying to add avatars to my chat box like this :
Avatars in chatbox are way too big <a href=https://i.servimg.com/u/f38/19/12/53/85/chat410.png" />
but when i add the codes it appears like this:
Avatars in chatbox are way too big T6Tt2zQ
I just want the avatars on the online list gone and the avatars next to the messages to be sized 30x30

I'm using these codes from the topic:
in the CSS:
Code:

#chatbox .cb-avatar { background: transparent !important; box-shadow: none !important; }
body #chatbox .cb-avatar { border: none !important; /*retirer la bordure*/ }
#chatbox .cb-avatar > img{ border-radius: 50% !important; }

#chatbox .user-msg .user, #chatbox .user-msg .msg {
    display: inline;
}
#chatbox_members .cb-avatar > img {
  height:30px;width:30px;
  vertical-align: middle;
}



in the JS (set to home page only):
Code:
$(window).load(function() {
  var chatbox_script = function() {
 
    var default_avatar = 'http://2img.net/i/fa/invision/pp-blank-thumb-38px.png';
    var ava_in_member_list = true;
    var ava_in_indirect_message = true;
 
    var avatars = {};
    var d;
    var set_avatar = function(pseudo, elem_to_prepend){
      var avatar = avatars[pseudo];
      var el = $(this);
      elem_to_prepend.find('.cb-avatar').remove();
      elem_to_prepend.prepend('<span class="cb-avatar"><img src="'+(avatar||default_avatar)+'"></span>&nbsp;');
      if(!avatar) {
        if(!d) {
          d = $.get('/memberlist?change_version=prosilver').done(function(c){
            $('.avatar-mini img', c).each(function(){
              avatars[$(this).parent().text().substr(1)]= $(this).attr('src')
            })
          })
        }
        d.done(function(){
          var avatar = avatars[pseudo];
          elem_to_prepend.find('.cb-avatar img').attr('src', avatar||default_avatar)
        })
      }
    };
    var overrided = Chatbox.prototype.refresh;
    Chatbox.prototype.refresh = function(data) {
      var next_scroll = false;
      if (data.messages && data.messages.length) {
        $.each(data.messages, function(_,m){
          if(ava_in_indirect_message)
            m.msgColor+='\' data-username=\''+$('<div/>').text(m.username).html();
          if(m.user && m.user.avatar)
            avatars[m.username] = m.user.avatar
        });
        next_scroll = !this.messages || this.messages.length != data.messages.length;
      }
      overrided.call(this, data);
      d = null;
      ava_in_member_list && $('#chatbox_members .chatbox-username').each(function(){
        set_avatar($(this).text(), $(this).parent());
      });
      ava_in_indirect_message && $('#chatbox p > .msg').wrap('<span class="user-msg indirect-user-msg" />').each(function(){
        set_avatar($(this).children().attr('data-username'), $(this).parent());
      });
      if(next_scroll) $("#chatbox")[0].scrollTop = $("#chatbox").prop('scrollHeight') * 2
    };
  };
  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){}})
});

link to forum: http://pendulumsduelacademy.forumotion.com/


Last edited by Kirbs on September 2nd 2015, 8:08 pm; edited 1 time in total
Kirbs
Kirbs
Forumember

Posts : 628
Reputation : 18
Language : English

Back to top Go down

Solved Re: Avatars in chatbox are way too big

Post by Guest September 2nd 2015, 7:46 pm

Try removing those codes and it should(Or might) work.
avatar
Guest
Guest


Back to top Go down

Solved Re: Avatars in chatbox are way too big

Post by Kirbs September 2nd 2015, 7:51 pm

But those are the codes that are posted on the tutorial topic, and the ones actually adding the avatars o.O i think you got me wrong ;o i want the avatars in there i just want them removed from the online list on the chatbox, and make them small like many other forums have them in the messages in the chatbox
Kirbs
Kirbs
Forumember

Posts : 628
Reputation : 18
Language : English

Back to top Go down

Solved Re: Avatars in chatbox are way too big

Post by brandon_g September 2nd 2015, 7:57 pm

Hello,


Have you tried the 'show avatars' option in the chatbox area of the ACP? If so, they should automatically appear with no code(s) nessecary.


Hope this helps,

-Brandon


Last edited by brandon_g on September 2nd 2015, 8:12 pm; edited 1 time in total
brandon_g
brandon_g
Manager
Manager

Male Posts : 10106
Reputation : 923
Language : English
Location : USA

https://www.broadcastingduo.com

Back to top Go down

Solved Re: Avatars in chatbox are way too big

Post by Kirbs September 2nd 2015, 8:08 pm

Dear god how did i miss that... thanks a lot mate
Kirbs
Kirbs
Forumember

Posts : 628
Reputation : 18
Language : English

Back to top Go down

Solved Re: Avatars in chatbox are way too big

Post by brandon_g September 2nd 2015, 8:12 pm

Your welcome anytime Wink.


-Brandon


Avatars in chatbox are way too big Brando10
Remember to mark your topic Avatars in chatbox are way too big Solved15 when a solution is found.
General Rules | Tips & Tricks | FAQ | Forgot Founder Password?

Avatars in chatbox are way too big Scre1476
Team Leader
Review Section Rules | Request A Review | Sticker Points
brandon_g
brandon_g
Manager
Manager

Male Posts : 10106
Reputation : 923
Language : English
Location : USA

https://www.broadcastingduo.com

Back to top Go down

Solved Re: Avatars in chatbox are way too big

Post by SLGray September 2nd 2015, 8:37 pm

Topic solved and archived



Avatars in chatbox are way too big Slgray10

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

Male Posts : 51463
Reputation : 3519
Language : English
Location : United States

https://forumsclub.com/gc/128-link-directory/

Back to top Go down

Back to top


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