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.

Members of the toolbar in the chatbox

3 posters

Go down

Solved Members of the toolbar in the chatbox

Post by Milouze14 November 10th 2015, 5:46 am

Hi to all of you,
I have this script on every page to view the chatbox on the toolbar,
it would be possible to display the button before the number of connected members on the chatbox?

This is the script in question:
Code:

jQuery(document).ready(function() { jQuery('body').append('<table id="M14_Chat_Box"style="display:none;position:fixed; top:30px;left:10%;background-color: #;z-index:10000;"><tr><td><div scrolling="no" style="width: 800px; height: 400px; marginwidth="0" marginheight="0" frameborder="0" title="ChatBox">
        <iframe id="M14"src="/chatbox/index.forum?page=front" style="width: 800px; height: 380px;" ></iframe>
        </div></td><td id="M14_Close"style="vertical-align: bottom;cursor:pointer;"title="Fermer la Chatbox"><img src="http://i37.servimg.com/u/f37/11/44/92/25/fermer10.png"/></td></tr></table>'); } );
       
        $(function(){
        $(function(){
        $('<span id="M14_Chat"style="cursor:pointer;"title="Rejoindre la Chatbox"> <img src="http://i39.servimg.com/u/f39/11/26/21/37/ouvrir10.png"alt="Rejoindre la ChatBox"  align="absmiddle"/></span>').insertBefore('#fa_menu');
        })});
       
        $(function(){
        $(function(){
        $('#M14_Chat').click(function(){
        $('#M14_Chat_Box').fadeIn(800);
        });
        });});
       
        $(function(){
        $(function(){
        $('#M14_Close').click(function(){
        $('#M14_Chat_Box').fadeOut(800);
        });
        });});


thank you a lot

a++
Milouze14
Milouze14
Forumember

Male Posts : 59
Reputation : 18
Language : French
Location : Vendée

http://www.milouze14.com/

Back to top Go down

Solved Re: Members of the toolbar in the chatbox

Post by SLGray November 10th 2015, 6:03 am

If you use this:  https://help.forumotion.com/t143414-add-the-chatbox-to-your-toolbar?highlight=chatbox , it will show the number of members logged into the chatbox.


Members of the toolbar in the chatbox 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 : 51596
Reputation : 3527
Language : English
Location : United States

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

Back to top Go down

Solved Re: Members of the toolbar in the chatbox

Post by Milouze14 November 10th 2015, 6:09 am

Hi SL Gray,
thank you but I prefer to have just connected members on the toolbar and simply nothing else.
Thank you in advance.

a++
Milouze14
Milouze14
Forumember

Male Posts : 59
Reputation : 18
Language : French
Location : Vendée

http://www.milouze14.com/

Back to top Go down

Solved Re: Members of the toolbar in the chatbox

Post by Ange Tuteur November 10th 2015, 11:02 am

Hi @Milouze14,

Try replacing your script with this :
Code:
$(function() {
  $('body').append('<table id="M14_Chat_Box"style="display:none;position:fixed; top:30px;left:10%;background-color: #;z-index:10000;"><tr><td><div scrolling="no" style="width: 800px; height: 400px; marginwidth="0" marginheight="0" frameborder="0" title="ChatBox"><iframe id="fa_chat_frame"src="/chatbox/index.forum?page=front" style="width: 800px; height: 380px;" ></iframe></div></td><td id="M14_Close"style="vertical-align: bottom;cursor:pointer;"title="Fermer la Chatbox"><img src="http://i37.servimg.com/u/f37/11/44/92/25/fermer10.png"/></td></tr></table>');

  window.$fa_chat = {

    listen : function() {

      var users = $fa_chat.members.getElementsByTagName('LI').length;

      if (users > $fa_chat.users || users < $fa_chat.users) {
        $fa_chat.users = users;
        $fa_chat.chatters.innerHTML = '(' + $fa_chat.users + ')';
      }

    },

    users : 0,

    chatters : document.createElement('SPAN')

  };

  $fa_chat.chatters.innerHTML = '(0)';

  document.getElementById('fa_chat_frame').onload = function() {

    if (window.$fa_chat.poll) window.clearInterval($fa_chat.poll);
    if (this.contentDocument || this.contentWindow) {
      $fa_chat.document = this.contentDocument ? this.contentDocument : this.contentWindow.document;
      $fa_chat.members = $fa_chat.document.getElementById('chatbox_members');
      window.$fa_chat.poll = window.setInterval($fa_chat.listen, 300);
    }

  };


  $(function() {
    $('<span id="M14_Chat"style="cursor:pointer;"title="Rejoindre la Chatbox"> <img src="http://i39.servimg.com/u/f39/11/26/21/37/ouvrir10.png"alt="Rejoindre la ChatBox"  align="absmiddle"/></span>').insertBefore('#fa_menu');

    $('#M14_Chat').click(function() {
      $('#M14_Chat_Box').fadeIn(800);
    }).prepend($fa_chat.chatters);

    $('#M14_Close').click(function() {
      $('#M14_Chat_Box').fadeOut(800);
    });
  });
});

I just took the member count from the script I wrote and modified it to work with your chatbox. thumleft
Ange Tuteur
Ange Tuteur
Forumaster

Male Posts : 13207
Reputation : 3000
Language : English & 日本語
Location : Pennsylvania

https://fmdesign.forumotion.com

Back to top Go down

Solved Re: Members of the toolbar in the chatbox

Post by Milouze14 November 10th 2015, 1:55 pm

Hello Ange Tuteur Hello ,
thank you already for your legendary responsiveness friend, always surprising ease.
Sorry, but you have the option of having the Pseudonyms are please?

If this is not possible, it is not really important, do not you doing the head for it Wink .
Thank you

a++
Milouze14
Milouze14
Forumember

Male Posts : 59
Reputation : 18
Language : French
Location : Vendée

http://www.milouze14.com/

Back to top Go down

Solved Re: Members of the toolbar in the chatbox

Post by Ange Tuteur November 10th 2015, 5:24 pm

You could add it to the title for the chat members, so when you hover the number it'll show you a list of users. Like this :
Members of the toolbar in the chatbox Scr11

This is the updated script :
Code:
$(function() {
  $('body').append('<table id="M14_Chat_Box"style="display:none;position:fixed; top:30px;left:10%;background-color: #;z-index:10000;"><tr><td><div scrolling="no" style="width: 800px; height: 400px; marginwidth="0" marginheight="0" frameborder="0" title="ChatBox"><iframe id="fa_chat_frame"src="/chatbox/index.forum?page=front" style="width: 800px; height: 380px;" ></iframe></div></td><td id="M14_Close"style="vertical-align: bottom;cursor:pointer;"title="Fermer la Chatbox"><img src="http://i37.servimg.com/u/f37/11/44/92/25/fermer10.png"/></td></tr></table>');
 
  window.$fa_chat = {
 
    listen : function() {
 
      var li = $fa_chat.members.getElementsByTagName('LI'),
          users = li.length,
          i = 0;
 
      if (users > $fa_chat.users || users < $fa_chat.users) {
        $fa_chat.users = users;
        $fa_chat.chatters.innerHTML = '(' + $fa_chat.users + ')';
        $fa_chat.chatters.title = '';
        for (; i < users; i++) $fa_chat.chatters.title += $('.chatbox-username', li[i]).text() + '\n';
      }
 
    },
 
    users : 0,
 
    chatters : document.createElement('SPAN')
 
  };
 
  $fa_chat.chatters.innerHTML = '(0)';
 
  document.getElementById('fa_chat_frame').onload = function() {
 
    if (window.$fa_chat.poll) window.clearInterval($fa_chat.poll);
    if (this.contentDocument || this.contentWindow) {
      $fa_chat.document = this.contentDocument ? this.contentDocument : this.contentWindow.document;
      $fa_chat.members = $fa_chat.document.getElementById('chatbox_members');
      window.$fa_chat.poll = window.setInterval($fa_chat.listen, 300);
    }
 
  };
 
 
  $(function() {
    $('<span id="M14_Chat"style="cursor:pointer;"title="Rejoindre la Chatbox"> <img src="http://i39.servimg.com/u/f39/11/26/21/37/ouvrir10.png"alt="Rejoindre la ChatBox"  align="absmiddle"/></span>').insertBefore('#fa_menu');
 
    $('#M14_Chat').click(function() {
      $('#M14_Chat_Box').fadeIn(800);
    }).prepend($fa_chat.chatters);
 
    $('#M14_Close').click(function() {
      $('#M14_Chat_Box').fadeOut(800);
    });
  });
});
Ange Tuteur
Ange Tuteur
Forumaster

Male Posts : 13207
Reputation : 3000
Language : English & 日本語
Location : Pennsylvania

https://fmdesign.forumotion.com

Back to top Go down

Solved Re: Members of the toolbar in the chatbox

Post by Milouze14 November 10th 2015, 8:04 pm

Ugh, it gets more baffling that so you find it all in
very little time.
thank you a lot Ange Tuteur .

You are a god coding
If if I insist Very Happy


a++
Milouze14
Milouze14
Forumember

Male Posts : 59
Reputation : 18
Language : French
Location : Vendée

http://www.milouze14.com/

Back to top Go down

Solved Re: Members of the toolbar in the chatbox

Post by Ange Tuteur November 10th 2015, 8:47 pm

Hehe, you're welcome ! ^^

Topic archived

Have a good day. Smile
Ange Tuteur
Ange Tuteur
Forumaster

Male Posts : 13207
Reputation : 3000
Language : English & 日本語
Location : Pennsylvania

https://fmdesign.forumotion.com

Back to top Go down

Back to top

- Similar topics

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