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.

auto update chat users without page refresh

View previous topic View next topic Go down

In progress auto update chat users without page refresh

Post by _Twisted_Mods_ on November 22nd 2014, 10:45 am

where it says



There are currently ### user(s) on the ChatBox�


is there anyway to write a script or something to make this update without a page refresh?

_Twisted_Mods_
Helper
Helper

Male Posts : 2032
Reputation : 302
Language : English
Location : Ms

http://liquidcode.forumotion.com

Back to top Go down

In progress Re: auto update chat users without page refresh

Post by Guest on November 22nd 2014, 1:50 pm

Hi! It's AWC you're using, right? I'm an AWC user as well. I've seen you on AvacWeb b4. Hey, Ange wrote a script for refreshing chat every whatever you like for a period. You may wanna search for that in the topics around here. Just saying. It may help you. And since you're a good scripter, you might find yourself the answer in just that one small but very important post of her! Smile If you can't find the answer here, please consult LG first I'd advise!

Guest
Guest


Back to top Go down

In progress Re: auto update chat users without page refresh

Post by _Twisted_Mods_ on November 22nd 2014, 2:28 pm

no im not talking about the chat box but on the forum itself under

Who is online?

_Twisted_Mods_
Helper
Helper

Male Posts : 2032
Reputation : 302
Language : English
Location : Ms

http://liquidcode.forumotion.com

Back to top Go down

In progress Re: auto update chat users without page refresh

Post by Guest on November 22nd 2014, 2:31 pm

Like I said b4, you're a good scripter, and I think together with what Ange wrote b4 you might strike lucky. Else, please consult Ange on this. She's the greatest on this. Sorry for interrupting in this topic of yours, I thought I could help you out and get you in the right direction...

Guest
Guest


Back to top Go down

In progress Re: auto update chat users without page refresh

Post by _Twisted_Mods_ on November 22nd 2014, 3:10 pm

yea i looked around and tried to change up some other script but had no luck.. im still a script kiddy im just starting to learn javascript

_Twisted_Mods_
Helper
Helper

Male Posts : 2032
Reputation : 302
Language : English
Location : Ms

http://liquidcode.forumotion.com

Back to top Go down

In progress Re: auto update chat users without page refresh

Post by Guest on November 22nd 2014, 3:25 pm

<< NVM the n00b. Smile I'm ok. You should really get in touch with Ange! She's an angel. Please, be very kind to her. I'm sure she can help you!

Guest
Guest


Back to top Go down

In progress Re: auto update chat users without page refresh

Post by Ange Tuteur on November 22nd 2014, 11:38 pm

Hi _Twisted_Mods_,

Is your chatbox on the homepage where those texts are ? If so, we can access the frame to get the length of the chat members. Otherwise, we could probably use some AJAX to load the chatbox. ( never tried that )

Ange Tuteur
Forumaster

Male Posts : 13028
Reputation : 2704
Language : EN10, FR5
Location : Pennsylvania

http://fmdesign.forumotion.com

Back to top Go down

In progress Re: auto update chat users without page refresh

Post by _Twisted_Mods_ on November 23rd 2014, 12:06 am

yea the chatbox is on the forum page so you can get the iframe .. and i dont know crap about ajax other then i think its some kinda cleaner lmao

_Twisted_Mods_
Helper
Helper

Male Posts : 2032
Reputation : 302
Language : English
Location : Ms

http://liquidcode.forumotion.com

Back to top Go down

In progress Re: auto update chat users without page refresh

Post by Guest on November 23rd 2014, 12:13 am

Yeah, you should keep far off of that AJAX stuff I know. Ange's wearing special toxic waste gloves for that. We better stand back while Ange's on it. Laughing

Guest
Guest


Back to top Go down

In progress Re: auto update chat users without page refresh

Post by Ange Tuteur on November 23rd 2014, 5:00 am

Try this :
Administration Panel > Modules > JavaScript codes management > Create a new script

Title : Your choice
Placement : In the homepage
Paste the code below :
Code:
$(function() {
 var fa_chat = document.getElementById('frame_chatbox'), frame;
 if (!fa_chat) return;
 
 fa_chat.onload = function() {
  if (fa_chat.contentDocument) frame = fa_chat.contentDocument;
  else if (fa_chat.contentWindow) frame = fa_chat.contentWindow.document;
  var mem_thn = frame.getElementById('chatbox_members').getElementsByTagName('LI').length, mem_now;
 
  var a = frame.getElementsByTagName('A');
  for (var i=0; i<a.length; i++) if (/archives/.test(a[i].href)) a[i].onclick = function() { window.clearInterval(_chat_refresh) };

  _chat_refresh = window.setInterval(function() {
  mem_now = frame.getElementById('chatbox_members').getElementsByTagName('LI').length;
  if (mem_now > mem_thn || mem_now < mem_thn) {
  var s = document.getElementsByTagName('SPAN'),i;
  for (i=0; i<s.length; i++) if (/gensmall/.test(s[i].className) && /ChatBox/.test(s[i].innerHTML)) s[i].innerHTML = s[i].innerHTML.replace(/<strong>\d+<\/strong>/,'<strong>'+mem_now+'</strong>');
  mem_thn = mem_now;
  }
  },1);
 }
});

It should update the count whenever someone signs in or out.

Ange Tuteur
Forumaster

Male Posts : 13028
Reputation : 2704
Language : EN10, FR5
Location : Pennsylvania

http://fmdesign.forumotion.com

Back to top Go down

In progress Re: auto update chat users without page refresh

Post by _Twisted_Mods_ on November 23rd 2014, 6:10 am

unfortunately it didn't work .. idk if it would effect it but our names r styled like i have a image for my name some people have shadows and some people have icons b4 there name

_Twisted_Mods_
Helper
Helper

Male Posts : 2032
Reputation : 302
Language : English
Location : Ms

http://liquidcode.forumotion.com

Back to top Go down

In progress Re: auto update chat users without page refresh

Post by Ange Tuteur on November 23rd 2014, 6:25 am

I'm sorry I thought you were talking about the member count :


I'll have to write something else for the usernames..

Ange Tuteur
Forumaster

Male Posts : 13028
Reputation : 2704
Language : EN10, FR5
Location : Pennsylvania

http://fmdesign.forumotion.com

Back to top Go down

In progress Re: auto update chat users without page refresh

Post by _Twisted_Mods_ on November 23rd 2014, 6:42 am

sorry i didnt specify b4 i was wanting to update both the # of online and the name list

_Twisted_Mods_
Helper
Helper

Male Posts : 2032
Reputation : 302
Language : English
Location : Ms

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