Chat notification lines showing when adding avatar in memberlist? Hitskin_logo Hitskin.com

This is a Hitskin.com skin preview
Install the skinReturn to the skin page

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.

    Chat notification lines showing when adding avatar in memberlist?

    avatar
    Guest
    Guest


    Chat notification lines showing when adding avatar in memberlist? Empty Chat notification lines showing when adding avatar in memberlist?

    Post by Guest September 7th 2015, 10:53 pm

    Hello, recently I've been having a few issues with the code in my chatbox. 

    Currently, I've used the codes from @Buttercup (I believe) to personalize my chat, but a few errors in certain codes have caused some scripts to stop working. I was wondering if anyone could resolve this problem. 

    When I use the code to make the avatars display in the memberlist, the code to make these notifications disappear began to show again.

    Example: http://prntscr.com/8drwqf

    But when I remove the code for the avatars to be shown in the memberlist, the notifications disappear and the code functions once again.

    Example: http://prntscr.com/8drymm

    I hope someone could resolve this problem, as it's getting quite annoying. 

    Thanks! :rose: 

    Tagging: @Ange Tuteur @Buttercup

    EDIT:

    These are the 2 scripts I am using at the moment:

    This is the one to remove the little notifications in the chat.

    Code:
    $(window).load(function() {
      var chatbox_script = function() {
        $('#chatbox > p > .msg > span').filter('[style="color:green"],[style="color:red"]').closest('p').remove();
        var overrided = Chatbox.prototype.refresh;
        Chatbox.prototype.refresh = function(data) {
          if (data.messages && data.messages.length) {
            data.messages = $.grep(data.messages, function(v) {
              return v.userId != -10 || $.inArray(v.msgColor, ["red", "green"]) == -1;
            });
          }
          overrided.call(this, data);
        };
      };

      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){}})
    });

    and

    This is the one I'm using for the avatars to display in the memberlist.

    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){}})
    });

    Thanks for the reminder! @APE  Razz


    Last edited by Luke Spike on September 8th 2015, 12:16 am; edited 2 times in total
    Ape
    Ape
    Administrator
    Administrator


    Male Posts : 19324
    Reputation : 2005
    Language : fluent in dork / mumbojumbo & English haha

    Chat notification lines showing when adding avatar in memberlist? Empty Re: Chat notification lines showing when adding avatar in memberlist?

    Post by Ape September 8th 2015, 12:09 am

    Please Do not tag JScript as he is away on sick leave and it could be a long time before he returns

    EDIT: please post your Codes you are using on the thread so we can see if there is a problem with any of your codes

    Thank you.

    APE


    Last edited by APE on September 8th 2015, 12:11 am; edited 1 time in total



    Chat notification lines showing when adding avatar in memberlist? Left1212Chat notification lines showing when adding avatar in memberlist? Center11Chat notification lines showing when adding avatar in memberlist? Right112
    Chat notification lines showing when adding avatar in memberlist? Ape_b110
    Chat notification lines showing when adding avatar in memberlist? Ape1010
    avatar
    Guest
    Guest


    Chat notification lines showing when adding avatar in memberlist? Empty Re: Chat notification lines showing when adding avatar in memberlist?

    Post by Guest September 8th 2015, 12:10 am

    APE wrote:Please Do not tag JScript as he is away on sick leave and it could be a long time before he returns
    I've updated the tagged list as requested.  Very good
    Ape
    Ape
    Administrator
    Administrator


    Male Posts : 19324
    Reputation : 2005
    Language : fluent in dork / mumbojumbo & English haha

    Chat notification lines showing when adding avatar in memberlist? Empty Re: Chat notification lines showing when adding avatar in memberlist?

    Post by Ape September 8th 2015, 12:11 am

    Please read my edit and make an edit in your last post Wink

    Thank you.



    Chat notification lines showing when adding avatar in memberlist? Left1212Chat notification lines showing when adding avatar in memberlist? Center11Chat notification lines showing when adding avatar in memberlist? Right112
    Chat notification lines showing when adding avatar in memberlist? Ape_b110
    Chat notification lines showing when adding avatar in memberlist? Ape1010
    avatar
    Guest
    Guest


    Chat notification lines showing when adding avatar in memberlist? Empty Re: Chat notification lines showing when adding avatar in memberlist?

    Post by Guest September 8th 2015, 12:13 am

    AH YES! Lol, sorry I nearly forgot about that. Thanks for remind me, I shall update my topic right away.  huhohi