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.
The forum of the forums
4 posters

    Chatbox No-Kick

    avatar
    MarcoNecroX
    Forumember


    Posts : 95
    Reputation : 3
    Language : English

    Solved Chatbox No-Kick

    Post by MarcoNecroX October 25th 2014, 8:42 pm

    Hi

    Well as most of you probably know already the chatbox is pretty bad. It automatically logs you off or sets you afk, which makes it really complicated to use. Of course there is no way to change the settings in it nor forumotion seems to do anything about it (despite it has been requested years ago)

    I am looking for a way to solve this using javascript. I want to disable the 'away' mode as well as the auto-kick.
    Ramdaman
    Ramdaman
    Active Poster


    Male Posts : 1590
    Reputation : 99
    Language : English, Albanian, Macedonian, Russian | HTML, CSS
    Location : New York City

    Solved Re: Chatbox No-Kick

    Post by Ramdaman October 25th 2014, 8:44 pm

    So the JavaScript you're looking for will keep you online at all times, until you log out?
    avatar
    MarcoNecroX
    Forumember


    Posts : 95
    Reputation : 3
    Language : English

    Solved Re: Chatbox No-Kick

    Post by MarcoNecroX October 25th 2014, 8:45 pm

    Yes, exactly.
    Ramdaman
    Ramdaman
    Active Poster


    Male Posts : 1590
    Reputation : 99
    Language : English, Albanian, Macedonian, Russian | HTML, CSS
    Location : New York City

    Solved Re: Chatbox No-Kick

    Post by Ramdaman October 25th 2014, 8:46 pm

    Alright well, I just asked that to clarify it for the one who could provide the JavaScript, since I don't really code JavaScript.
    avatar
    MarcoNecroX
    Forumember


    Posts : 95
    Reputation : 3
    Language : English

    Solved Re: Chatbox No-Kick

    Post by MarcoNecroX October 25th 2014, 8:48 pm

    Or maybe you're just trying to boost your post count, since I made it pretty clear from the start Very Happy

    Now you can post again! wohoo!
    Ramdaman
    Ramdaman
    Active Poster


    Male Posts : 1590
    Reputation : 99
    Language : English, Albanian, Macedonian, Russian | HTML, CSS
    Location : New York City

    Solved Re: Chatbox No-Kick

    Post by Ramdaman October 25th 2014, 8:50 pm

    Actually that's not the point. A post count is really nothing, just a number. And that's off topic.

    On Topic: I'm not sure if this sort of JavaScript could work as I've googled around a bit, but still there is a possibility.

    EDIT: After some forumotion searching, I found this: http://chat.avacweb.net/features It's supposed to work on forumotion, I'm not sure if it still does though.
    avatar
    MarcoNecroX
    Forumember


    Posts : 95
    Reputation : 3
    Language : English

    Solved Re: Chatbox No-Kick

    Post by MarcoNecroX October 25th 2014, 8:55 pm

    So you don't know a lot of javascript, but you googled for 5 minutes and came to the conclusion that it's "probably not possible" but you're not sure and you think there's actually a possibility. Thanks for your useful reply! Why aren't you in the staff yet?

    Edit: that clearly doesn't have anything to do with the standard forumotion chatbox. I don't see how it helps, but thank you I guess.
    Ange Tuteur
    Ange Tuteur
    Forumaster


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

    Solved Re: Chatbox No-Kick

    Post by Ange Tuteur October 25th 2014, 10:41 pm

    Hello MacroNecroX,

    Everyone helps in their own way, there is no need to be disrespectful.. Wink

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

    Title : Your choice
    Placement : In the homepage
    Code:
    setInterval(function(){ $.post('/chatbox/chatbox_actions.forum?archives','mode=send&sent='); }, 5000);
    ( this is for if your chatbox is on the homepage i.e. forum index )
    avatar
    MarcoNecroX
    Forumember


    Posts : 95
    Reputation : 3
    Language : English

    Solved Re: Chatbox No-Kick

    Post by MarcoNecroX October 25th 2014, 11:50 pm

    Thanks for your reply. And I didn't mean to be disrespectful, it's just that there are a lot of people who just provide useless replies here.

    I am now trying to remove the "loged off / logged in" chatbox messages using jQuery. I've put this global script, and it doesn't seem to be working:

    Code:
    <script type="text/javascript">
            $(function(){
                    $('p.chatbox:contains("has been disconnected on")').css( "display" , "none" );
                    });
         </script>

    Any idea?
    Thanks
    Ange Tuteur
    Ange Tuteur
    Forumaster


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

    Solved Re: Chatbox No-Kick

    Post by Ange Tuteur October 26th 2014, 2:10 am

    The chatbox is set in a frame, or <object>. You'll need to access that frame to modify its contents. However, it's a bit tricky, since the data is refreshed when a message is submitted. You can set an interval and determine when a new message is posted by comparing a global and local variable. See if this works for you :

    Modules > JavaScript codes management > Create a new script
    Title : Your choice
    Placement : In the homepage
    Code:
    $(function() {
     Â var refresh_rate = 1000, fa_chat = document.getElementById('frame_chatbox'), frame;
     Â fa_chat.onload = function() {
     Â   if (fa_chat.contentDocument) { frame = fa_chat.contentDocument }
     Â   else if (fa_chat.contentWindow) { frame = fa_chat.contentWindow.document }
     Â   _chatdata_msg_thn = frame.getElementById('chatbox').getElementsByTagName('p').length;
     Â   hideLogs();
     Â   
     Â   setInterval(function() {
     Â     var msg_now = frame.getElementById('chatbox').getElementsByTagName('p').length;
     Â     if (msg_now > _chatdata_msg_thn || msg_now < _chatdata_msg_thn) {
     Â       hideLogs();
     Â       _chatdata_msg_thn = msg_now;
     Â     }
     Â   },refresh_rate);
     Â   
     Â   function hideLogs() {var s = frame.getElementsByTagName('SPAN');for (i=0; i<s.length; i++) {if (s[i].style.color == 'green' || s[i].style.color == 'red') {var p = s[i].parentNode.parentNode;if (p.style.display != 'none') p.style.display = 'none'}}}
     Â }
    });

    This variable determines how often the interval compares the messages from then and now. If there is a difference between the two, it will execute the function to hide the logs. The higher the refresh_rate the longer it will take for the comparison and vise versa.
    Code:
    refresh_rate = 1000
    avatar
    MarcoNecroX
    Forumember


    Posts : 95
    Reputation : 3
    Language : English

    Solved Re: Chatbox No-Kick

    Post by MarcoNecroX October 26th 2014, 2:50 am

    Thanks for your help so far.

    While that works somewhat, it's really not the most optimal way to achieve this. Wouldn't it be possible to simply disable users from going into the away status by modifying the AJAX request? This would solve all issues. Because right now, users getting re-logged by the script spam these log in/off messages constantly, and also automatically joins everyone into the chatroom.
    Ange Tuteur
    Ange Tuteur
    Forumaster


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

    Solved Re: Chatbox No-Kick

    Post by Ange Tuteur October 26th 2014, 5:03 am

    I see what you mean. You could make it post to the cb only while the user is logged into the chat. You can remove the last two scripts I gave you, if you want. Choose the one you want :

    Post to cb only while logged in + remove message logs :
    Code:
    $(function() {
     Â var refresh_rate = 1000, fa_chat = document.getElementById('frame_chatbox'), frame;
     Â fa_chat.onload = function() {
     Â   if (fa_chat.contentDocument) { frame = fa_chat.contentDocument }
     Â   else if (fa_chat.contentWindow) { frame = fa_chat.contentWindow.document }
     Â   _chatdata_msg_thn = frame.getElementById('chatbox').getElementsByTagName('p').length;
     Â   hideLogs();
     Â   
     Â   setInterval(function(){
     Â     if (frame.getElementById('chatbox_option_co').style.display != 'none') return;
     Â     $.post('/chatbox/chatbox_actions.forum?archives','mode=send&sent=');
     Â   }, 5000);
     Â   setInterval(function() {
     Â     var msg_now = frame.getElementById('chatbox').getElementsByTagName('p').length;
     Â     if (msg_now > _chatdata_msg_thn || msg_now < _chatdata_msg_thn) {
     Â       hideLogs();
     Â       _chatdata_msg_thn = msg_now;
     Â     }
     Â   },refresh_rate);
     Â   
     Â   function hideLogs() {
     Â     var s = frame.getElementsByTagName('SPAN');
     Â     for (i=0; i<s.length; i++) {
     Â       if (s[i].style.color == 'green' || s[i].style.color == 'red') {
     Â         var p = s[i].parentNode.parentNode;
     Â         if (p.style.display != 'none') p.style.display = 'none';
     Â       }
     Â     }
     Â   }
     Â }
    });

    or post to cb only while logged in :
    Code:
    $(function() {
     Â var fa_chat = document.getElementById('frame_chatbox'), frame;
     Â fa_chat.onload = function() {
     Â   if (fa_chat.contentDocument) { frame = fa_chat.contentDocument }
     Â   else if (fa_chat.contentWindow) { frame = fa_chat.contentWindow.document }
     Â   
     Â   setInterval(function(){
     Â     if (frame.getElementById('chatbox_option_co').style.display != 'none') return;
     Â     $.post('/chatbox/chatbox_actions.forum?archives','mode=send&sent=');
     Â   }, 5000);
     Â }
    });

    Like before they can be applied in JavaScript management and in the homepage. Smile
    avatar
    MarcoNecroX
    Forumember


    Posts : 95
    Reputation : 3
    Language : English

    Solved Re: Chatbox No-Kick

    Post by MarcoNecroX October 26th 2014, 5:21 am

    Thanks Smile

    So it's not possible to modify the script to prevent users becoming AFK after 10 minutes?
    Ange Tuteur
    Ange Tuteur
    Forumaster


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

    Solved Re: Chatbox No-Kick

    Post by Ange Tuteur October 26th 2014, 5:32 am

    You're welcome.

    I can see a portion of the functions in the chatbox script, but as far as the timeout goes I didn't see anything of interest. It looked like basic functions; formatting, message sending, refreshing.. It might be server side.
    _Twisted_Mods_
    _Twisted_Mods_
    Helper
    Helper


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

    Solved Re: Chatbox No-Kick

    Post by _Twisted_Mods_ October 26th 2014, 5:56 am

    i think it sets a exasperation time for your cb cookies everytime you post a msg so you would have to find away to edit that cookie or over write it

    this what i seen in the js


    Code:
    function SetCookie(name,value){var expire='';var path="/";var domain='';document.cookie=name+"="+value+"; path="+path+expire+domain+';'}function copy_user_name(user_name){if(document.post.message)
    avatar
    MarcoNecroX
    Forumember


    Posts : 95
    Reputation : 3
    Language : English

    Solved Re: Chatbox No-Kick

    Post by MarcoNecroX October 26th 2014, 7:22 pm

    Ange Tuteur wrote:You're welcome.

    I can see a portion of the functions in the chatbox script, but as far as the timeout goes I didn't see anything of interest. It looked like basic functions; formatting, message sending, refreshing.. It might be server side.

    Hey,

    how about making "view archives" option to be set by default? That way the log in/out messages are removed, which would be an optimal solution on top of the auto-login, then I can remove the "without archives" option with css Smile
    Ange Tuteur
    Ange Tuteur
    Forumaster


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

    Solved Re: Chatbox No-Kick

    Post by Ange Tuteur October 26th 2014, 10:25 pm

    I didn't think about that ! You should be able to change the object data so it will automatically be on the archives URL. See if this works :
    * Like always, add in the homepage
    Code:
    $(function() {
     Â var fa_chat = document.getElementById('frame_chatbox');
     Â fa_chat.data = '/chatbox/index.forum?archives=1';
    });
    avatar
    MarcoNecroX
    Forumember


    Posts : 95
    Reputation : 3
    Language : English

    Solved Re: Chatbox No-Kick

    Post by MarcoNecroX October 26th 2014, 10:50 pm

    thank you, it worked Smile
    Ange Tuteur
    Ange Tuteur
    Forumaster


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

    Solved Re: Chatbox No-Kick

    Post by Ange Tuteur October 26th 2014, 10:55 pm

    You're welcome, is this solved for you now ? Smile
    avatar
    MarcoNecroX
    Forumember


    Posts : 95
    Reputation : 3
    Language : English

    Solved Re: Chatbox No-Kick

    Post by MarcoNecroX October 26th 2014, 11:08 pm

    Yeah
    Ange Tuteur
    Ange Tuteur
    Forumaster


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

    Solved Re: Chatbox No-Kick

    Post by Ange Tuteur October 26th 2014, 11:13 pm

    Okay ^^

    Topic archived

    Enjoy your day. Smile

      Current date/time is September 23rd 2024, 11:14 am