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.

Avatars in chatbox are way too big

View previous topic View next topic Go down

Solved Avatars in chatbox are way too big

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

Hi, i'm using the codes in this topic http://help.forumotion.com/t139284-codes-to-personalize-your-chatbox#cb-icon and i'm trying to add avatars to my chat box like this :
http://i38.servimg.com/u/f38/19/12/53/85/chat410.png" />
but when i add the codes it appears like this:

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://illiweb.com/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
Forumember

Posts : 628
Reputation : 18
Language : English

Back to top Go down

Solved Re: Avatars in chatbox are way too big

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

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

Guest
Guest


Back to top Go down

Solved Re: Avatars in chatbox are way too big

Post by Kirbs on 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
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 on 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
Support Moderator
Support Moderator

Male Posts : 5140
Reputation : 478
Language : English
Location : USA

http://broadcastingduo.forumotion.com/

Back to top Go down

Solved Re: Avatars in chatbox are way too big

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

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

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 on September 2nd 2015, 8:12 pm

Your welcome anytime Wink.


-Brandon


Remember to mark your topic when a solution is found.

brandon_g
Support Moderator
Support Moderator

Male Posts : 5140
Reputation : 478
Language : English
Location : USA

http://broadcastingduo.forumotion.com/

Back to top Go down

Solved Re: Avatars in chatbox are way too big

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

Topic solved and archived



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


SLGray
Administrator
Administrator

Male Posts : 35622
Reputation : 2372
Language : English
Location : United States

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