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.

auto update chat users without page refresh

2 posters

Go down

In progress auto update chat users without page refresh

Post by _Twisted_Mods_ 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_
_Twisted_Mods_
Helper
Helper

Male Posts : 2083
Reputation : 336
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 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!
avatar
Guest
Guest


Back to top Go down

In progress Re: auto update chat users without page refresh

Post by _Twisted_Mods_ 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_
_Twisted_Mods_
Helper
Helper

Male Posts : 2083
Reputation : 336
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 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...
avatar
Guest
Guest


Back to top Go down

In progress Re: auto update chat users without page refresh

Post by _Twisted_Mods_ 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_
_Twisted_Mods_
Helper
Helper

Male Posts : 2083
Reputation : 336
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 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!
avatar
Guest
Guest


Back to top Go down

In progress Re: auto update chat users without page refresh

Post by Ange Tuteur 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
Ange Tuteur
Forumaster

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

https://fmdesign.forumotion.com

Back to top Go down

In progress Re: auto update chat users without page refresh

Post by _Twisted_Mods_ 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_
_Twisted_Mods_
Helper
Helper

Male Posts : 2083
Reputation : 336
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 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
avatar
Guest
Guest


Back to top Go down

In progress Re: auto update chat users without page refresh

Post by Ange Tuteur 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
Ange Tuteur
Forumaster

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

https://fmdesign.forumotion.com

Back to top Go down

In progress Re: auto update chat users without page refresh

Post by _Twisted_Mods_ 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_
_Twisted_Mods_
Helper
Helper

Male Posts : 2083
Reputation : 336
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 November 23rd 2014, 6:25 am

I'm sorry I thought you were talking about the member count :
auto update chat users without page refresh Captur79

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

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

https://fmdesign.forumotion.com

Back to top Go down

In progress Re: auto update chat users without page refresh

Post by _Twisted_Mods_ 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_
_Twisted_Mods_
Helper
Helper

Male Posts : 2083
Reputation : 336
Language : English
Location : Ms

http://liquidcode.forumotion.com

Back to top Go down

Back to top

- Similar topics

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