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.

Popup Chatbox

View previous topic View next topic Go down

Solved Popup Chatbox

Post by Erza Loveheart on December 13th 2014, 10:46 am

Visual:



So, is it possible for me to have a popup chatbox for my site? Just like the one shown in the image... Or maybe even a tad bit different? I want to go for the traditional FM chatbox and make it popup; and avoid Xat or any other chatbox.


The site that I want to use it for has Invision as its theme version.


Any help would be appreciated.


Last edited by Erza Loveheart on December 14th 2014, 10:28 am; edited 1 time in total

Erza Loveheart
Forumember

Female Posts : 32
Reputation : 1
Language : English, Hindi, Marathi, Malayalam, Sanskrit
Location : India

http://auroriarp.forumsline.com

Back to top Go down

Solved Re: Popup Chatbox

Post by Ange Tuteur on December 13th 2014, 8:28 pm

Hello @Erza,

Go to Administration Panel > Modules > JavaScript codes management > Create a new script

Title : Your choice
Placement : In all the pages
Paste the code below and submit :
Code:
$(function() {
  if (_userdata.session_logged_in == 0) return;
  var chat = document.createElement('IFRAME'), bouton = document.createElement('DIV'), frame;
  chat.src = '/chatbox';
  chat.setAttribute('style','width:700px;height:350px;display:none;border:1px solid #666;position:fixed;bottom:40px;right:0;z-index:99999;');
  bouton.innerHTML = 'Chat (0)';
  bouton.setAttribute('style','cursor:pointer;position:fixed;bottom:0;right:0;padding:5px 10px;border:1px solid #666;background:#333;color:#FFF;z-index:99999;');
  document.body.appendChild(bouton);
  document.body.appendChild(chat);
  
  bouton.onclick = function() {
    if (/none/.test(chat.style.display)) chat.style.display = 'block';
    else chat.style.display = 'none';
  };
  chat.onload = function() {    
    if (chat.contentDocument) frame = chat.contentDocument;
    else if (chat.contentWindow) frame = chat.contentWindow.document;
    var memb_thn = frame.getElementById('chatbox_members').getElementsByTagName('LI').length, memb_now = memb_thn, a = frame.getElementsByTagName('A');
    bouton.innerHTML = 'Chat ('+memb_thn+')';
    for (i=0; i<a.length; i++) if (/archives/.test(a[i].href)) a[i].onclick = function() { window.clearInterval(_refresh) };
    _refresh = window.setInterval(function() {memb_now = frame.getElementById('chatbox_members').getElementsByTagName('LI').length;if (memb_now > memb_thn || memb_now < memb_thn) {memb_thn = memb_now;bouton.innerHTML = 'Chat ('+memb_now+')'}},1);
  };
});

Result :

Ange Tuteur
Forumaster

Male Posts : 13021
Reputation : 2683
Language : EN10, FR5
Location : Pennsylvania

http://fmdesign.forumotion.com

Back to top Go down

Solved Re: Popup Chatbox

Post by Erza Loveheart on December 14th 2014, 10:27 am

It works perfectly~ ^^


Thank you @Ange Tuteur!


Topic can be locked and archived now.

Erza Loveheart
Forumember

Female Posts : 32
Reputation : 1
Language : English, Hindi, Marathi, Malayalam, Sanskrit
Location : India

http://auroriarp.forumsline.com

Back to top Go down

Solved Re: Popup Chatbox

Post by Ange Tuteur on December 14th 2014, 9:00 pm

You're welcome ^^

Topic archived

Ange Tuteur
Forumaster

Male Posts : 13021
Reputation : 2683
Language : EN10, FR5
Location : Pennsylvania

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