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.

Jscript's chatbox code issues

4 posters

Go down

Solved Jscript's chatbox code issues

Post by Van-Helsing December 2nd 2014, 8:31 am

Hello all,
Using the following Jscript's chatbox code:

Code:


    /**************************************************************************
     * Module: AVATARChat + JS_EditMsgChat
     * Description: Need?!
     * Author: Made and Optimizations by JScript - 2014/11/23
     * Version: RC2 (Release candidate 2!)
     ***************************************************************************/
    function insertChatBox(chatbox_id, chatbox_url) {
        return insertChatBoxNew(chatbox_id, chatbox_url);
    }

    // Redefine function in frm_lang_xx.js, by JScript Brasil at live dot com!
    function insertChatBoxNew(chatbox_id, chatbox_url) {

        document.getElementById(chatbox_id).innerHTML = '<iframe src="/chatbox/index.forum?archives=1" id="frame_chatbox" scrolling="no" width="100%" height="100%" marginwidth="0" marginheight="0" frameborder="0"></iframe>';

        frames["frame_chatbox"].onload = function() {
            // Redefine function in chatbox7.js, by JScript Brasil at live dot com!
            var JS_search = {
                    //inVar: /">\[(?:(?:2[0-3]|[0-1][0-9]|[0-9]):[0-5][0-9]:[0-5][0-9])\]<\/span>&nbsp;<span class="user-msg">(.+)&Iota;id=(.*?)&Alpha;<(.*?)>&Epsilon;<img (.*?)&Chi;<img (.*?)>&Tau;(.+)&Mu;(.*?)<\/span>/g,
                    //inHtml: /">\[(?:(?:2[0-3]|[0-1][0-9]|[0-9]):[0-5][0-9]:[0-5][0-9])\]<\/span>&nbsp;<span class="user-msg">(.+)[\u0399]id=(.*?)[\u0391]<(.*?)>[\u0395]<img (.*?)[\u03a7]<img (.*?)>[\u039c](.*?)<\/span>/g
                    inVar: /&Iota;id=(.*?)&Alpha;<(.*?)>&Epsilon;<img (.*?)&Chi;<img (.*?)>&Mu;(.*?)<\/span>/g,
                    inHtml: /[\u0399]id=(.*?)[\u0391]<(.*?)>[\u0395]<img (.*?)[\u03a7]<img (.*?)>[\u039c](.*?)<\/span>/g
                },
                // JS_replace = '">[$6]$1<span class="id" id=$2><span class="js-avatar"><$3></span><span class="editor"><img onclick="editor(this, 1)" $4<img onclick="editor(this, 2)" $5></span><span class="text">$7</span>',
                JS_replace = '<span class="id" id=$1><span class="js-avatar"><$2></span><span class="editor"><img onclick="editor(this, 1)" $3<img onclick="editor(this, 2)" $4></span><span class="text">$5</span>',
                oIframe = (document.getElementById("frame_chatbox").contentWindow || document.getElementById("frame_chatbox").contentDocument),
                script = oIframe.document.createElement("script"),
                memDiv = oIframe.document.createElement('div');

            script.type = "text/javascript";
            script.innerHTML =
                'USERNAME = parent._userdata.username;' +
                'SUPERMOD = parent._userdata.user_level;' +
                'AVATAR = parent._userdata.avatar.replace(\'<img src="\', "[img]").replace(\'" alt="" />\', "[/img]");' +
                'JS_search = ' + JS_search.inVar + ';' +
                'JS_replace = \'' + JS_replace + '\';' +
                'function submitmsg(params) {' +
                '   if (document.post.message.value.length < 4 && SUPERMOD !== 1) return false;' +
                '   if (document.post.message.value.indexOf("/") !== 0) {' +
                '      var date = new Date();' +
                '       var UID = Math.ceil(date.getDate() + date.getHours() + Math.random() * Math.pow(10, 10) + date.getMinutes() + date.getSeconds() + date.getMilliseconds());' +
                '       if (UID.length < 10) {' +
                '         UID + "" + (10 - UID.length);' +
                '       }' +
                //'      var time = new Date().toLocaleTimeString();' +
                //'      document.post.message.value = \'&Iota;id="\' + UID + \'"&Alpha;\' + AVATAR + "&Epsilon;[img]http://goo.gl/brvCui[/img]&Chi;[img]http://goo.gl/k8FZx5[/img]&Tau;" + time + "&Mu;" + document.post.message.value;' +
                '      document.post.message.value = \'&Iota;id="\' + UID + \'"&Alpha;\' + AVATAR + "&Epsilon;[img]http://goo.gl/brvCui[/img]&Chi;[img]http://goo.gl/k8FZx5[/img]&Mu;" + document.post.message.value;' +
                '    }' +
                '   document.post.sent.value = document.post.message.value;' +
                '   document.post.message.value = "";' +
                '   document.post.message.focus();' +
                '   ajax_submit_chatbox(params);' +
                '   return false' +
                '}' +
                'function copy_user_name(user_name) {' +
                '   if (document.post.message) {' +
                '      document.post.message.focus();' +
                '      document.post.message.value += ((user_name.indexOf("@") == 0) ? "" : "@") + user_name + " -> ";' +
                '   }' +
                '    return false' +
                '}' +
                'function ajax_submit_chatbox(params, editor) {' +
                '   number_of_refresh = 0;' +
                '   if (params == "" || params == undefined) {' +
                '      params = "?achives=0"' +
                '   }' +
                '   if (editor == "" || editor == undefined) {' +
                '      var msg_sent = document.post.sent.value;' +
                '   } else {' +
                '      var msg_sent = editor;' +
                '   }' +
                '   var data = "&mode=send";' +
                '   data += "&sent=" + encodeURIComponent(msg_sent);' +
                '   data += "&sbold=" + document.post.sbold.value;' +
                '   data += "&sitalic=" + document.post.sitalic.value;' +
                '   data += "&sunderline=" + document.post.sunderline.value;' +
                '   data += "&sstrike=" + document.post.sstrike.value;' +
                '   data += "&scolor=" + document.post.scolor.value;' +
                '   if ((msg_sent.indexOf("/away") == 0) || (msg_sent.indexOf("/abs") == 0)) {' +
                '      document.getElementById("refresh_auto").checked = false' +
                '   }' +
                '   if (document.post.sent.value == "/banlist") {' +
                '      window.open("/chatbox/chatbox_banlist.forum" + params, "banlist", "toolbar=no,menubar=no,personalbar=no,width=450,height=300,scrollbars=yes,resizable=yes");' +
                '      return false' +
                '   }' +
                '   $.ajax({' +
                '      url: "/chatbox/chatbox_actions.forum" + params,' +
                '      type: "post",' +
                '      data: data,' +
                '      dataType: "script",' +
                '      success: function(response, status, xhr) {' +
                '         if (xhr.status == 200) {' +
                //'            if (typeof (chatbox_messages) !== "undefined") {' +
                '               chatbox_messages = chatbox_messages.replace(JS_search, JS_replace);' +
                '                document.getElementById("memdiv").innerHTML = chatbox_messages;' +
                '                  hackMsg();' +
                '               document.getElementById("chatbox").innerHTML = document.getElementById("memdiv").innerHTML;' +
                '               /*$("#chatbox").html(chatbox_messages) [0].scrollTop = $("#chatbox").prop("scrollHeight");*/' +
                '               document.getElementById("chatbox").scrollTop = 999999;' +
                //'            }' +
                '            if (typeof (chatbox_memberlist) !== "undefined") {' +
                '               document.getElementById("chatbox_members").innerHTML = chatbox_memberlist;' +
                '               /*$("#chatbox_members").html(chatbox_memberlist);*/' +
                '            }' +
                '         }' +
                '      },' +
                '   })' +
                '}' +
                'function ajax_refresh_chatbox(params, force) {' +
                '   if (params == "" || params == undefined) {' +
                '      params = "?achives=0"' +
                '   }' +
                '   $.ajax({' +
                '      url: "/chatbox/chatbox_actions.forum" + params + "&mode=refresh",' +
                '      type: "get",' +
                '      dataType: "script",' +
                '      success: function(response, status, xhr) {' +
                '         if (xhr.status == 200) {' + // || force) {' + <- Fail!
                //'              if ($("#chatbox").length) {' +
                '            if (typeof (chatbox_messages) !== "undefined") {' +
                '               chatbox_messages = chatbox_messages.replace(JS_search, JS_replace);' +
                '                document.getElementById("memdiv").innerHTML = chatbox_messages;' +
                '                  hackMsg();' +
                '               document.getElementById("chatbox").innerHTML = document.getElementById("memdiv").innerHTML;' +
                '               document.getElementById("chatbox").scrollTop = document.getElementById("chatbox").scrollHeight + document.getElementById("chatbox").offsetHeight;' +
                '               document.getElementById("chatbox").scrollTop = 999999;' +
                '              }' +
                //'              if (document.getElementById("chatbox_members").innerHTML != null) document.getElementById("chatbox_members").innerHTML = chatbox_memberlist;' +
                '            if (typeof (chatbox_memberlist) !== "undefined") {' +
                '               document.getElementById("chatbox_members").innerHTML = chatbox_memberlist;' +
                '               /*$("#chatbox_members").html(chatbox_memberlist);*/' +
                '            }' +
                '         }' +
                '      },' +
                '   })' +
                '}' +
                'function hackMsg() {' +
                '   var oTarget = jQuery("#memdiv > p"),' +
                '      iLen = oTarget.length,' +
                '      index = 0;' +
                '   for (; index < iLen; index++) {' +
                '      var oThis = jQuery(oTarget[index]),' +
                '         sUserName = oThis.find(".user > a").text(),' +
                '         ID = oThis.find("span.id");' +
                '      if (ID.length == 0) {' +
                '         ID = oThis.find(".msg:last").text();' +
                // XORcipher -> '         ID = XORcipher(oThis.find(".msg").text());' +
                '         var del = ID.match(/^\\/remove[\\u0399](.*?)$/);' +
                // XORcipher -> '         var del = ID.match(/^\\/remove&Iota;(.*?)$/);' +
                '         if (del !== null) {' +
                '            var oMsg = oThis.parent().find("#" + del[1]).closest("p");' +
                '            if (oMsg.length) {' +
                //'               if (oMsg.find(".user > a").text() == sUserName || SUPERMOD > 0) {' +
                '                  oMsg.remove();' +
                //'               }' +
                '            }' +
                '         }' +
                '           var edit = ID.match(/^\\/edit[\\u0399]([0-9]+)[\\u039c](.*?)$/);' +
                // XORcipher -> '              var edit = ID.match(/^\\/edit&Iota;([0-9]+)&Mu;(.*?)$/);' +
                '           if (edit !== null) {' +
                '            var oMsg = oThis.parent().find("#" + edit[1]);' +
                '            if (oMsg.length) {' +
                //'               if (oMsg.closest("p").find(".user > a").text() == sUserName || SUPERMOD > 0) {' +
                '                  oMsg.find("span.text").text(edit[2]);' +
                //'               }' +
                '            }' +
                '              }' +
                '              /*var nudge = ID.match(/^\\/nudge[\\u0399]([0-9]+)[\\u039d](.*?)$/);' +
                '              if (nudge !== null) {' +
                '            var oMsg = oThis.parent().find("#" + nudge[1]);' +
                '            if (oMsg.length) {' +
                '               if (nudge[2] == USERNAME) {' +
                '                  // Developing!;' +
                '               }' +
                '            }' +
                '           }*/' +
                '         oThis.remove();' +
                '      } else {' +
                '         if (sUserName !== USERNAME && SUPERMOD == 0) {' +
                '            ID.find(".editor").remove();' +
                '         }' +
                '      }' +
                '   }' +
                '}' +
                'function editor(oThis, num) {' +
                '   if (num == 1 && iConfirm("Are you sure you want to remove this message?\\n\\n" + jQuery(oThis).closest(".id").text() ) == 1) {' +
                '      ajax_submit_chatbox("?achives=1", "/remove&Iota;" + jQuery(oThis).closest(".id").attr("id"));' +
                '      jQuery(oThis).closest("p").remove();' +
                '   } else if (num == 2) {' +
                '      var result = prompt("Editing the message:", jQuery(oThis).closest(".id").text());' +
                '      if (result != null) {' +
                '         ajax_submit_chatbox("?achives=1", "/edit&Iota;" + jQuery(oThis).closest(".id").attr("id") + "&Mu;" + result);' +
                '         jQuery(oThis).closest(".id span.text").text(result);' +
                '      }' +
                '   /*} else if (num == 3) {' +
                '      ajax_submit_chatbox("?achives=1", XORcipher("/nudge&Iota;" + jQuery(oThis).closest(".id").attr("id") + "&Nu;" + jQuery(oThis).closest("p").find(".user > a").text()));*/' +
                '   }' +
                '}' +
                /*'function XORcipher(sText) {' +
             '   var key = 2,' +
             '      result = "",' +
             '      len = sText.length,' +
             '      i = 0;' +
             '   for (; i < len; i++) {' +
             '      result += String.fromCharCode(key ^ sText.charCodeAt(i));' +
             '   }' +
             '   return result;' +
             '}' +*/
                'function iConfirm(text) {' +
                '   var iChoice = -1;' +
                '   if (confirm(text) == true) {' +
                '      iChoice = 1;' +
                '   } else {' +
                '      iChoice = 0;' +
                '   }' +
                '   return iChoice;' +
                '}';
            oIframe.document.getElementsByTagName("head")[0].appendChild(script);

            var style = oIframe.document.createElement("style");
          style.type = "text/css";
            style.innerHTML =
                '#chatbox p {' +
                '   background: none repeat scroll 0 0 #fff;' +
                '   border-bottom: 1px solid #e3e3e3;' +
                '   line-height: 1.3em;' +
                '   padding: 5px;' +
                '}' +
                '#chatbox span[title] {' +
                '   color: #8f8f8f !important;' +
                '   float: right !important;' +
                '}' +
                '#chatbox .user:not(:empty) {' +
                '   font-weight: 700;' +
                '   margin-left: 36px !important;' +
                '}' +
                '#chatbox .id {' +
                '   display: block;' +
                '   margin-top: 3px;' +
                '}' +
                '#chatbox .js-avatar img {' +
                '   background: none repeat scroll 0 0 #fff;' +
                '   border: 1px solid #ddd;' +
                '   float: left;' +
                '   height: 30px;' +
                '   margin-right: 5px;' +
                '   margin-top: -19px;' +
                '   max-width: 30px;' +
                '   padding: 1px;' +
                '   vertical-align: middle;' +
                '   width: 30px;' +
                '}' +
                '#chatbox .editor img {' +
                '   cursor: pointer;' +
                '   float: right;' +
                '   padding-left: 4px;' +
                '}' +
                '#chatbox {' +
                '   display: none;' +
                '}';
            oIframe.document.getElementsByTagName("head")[0].appendChild(style);

            var forceConnect = setInterval(function() {
                if (oIframe.document.getElementById("chatbox") !== null) {
                    clearInterval(forceConnect);
                    memDiv.id = 'memdiv';
                    oIframe.document.getElementsByTagName('body')[0].appendChild(memDiv);
                    oIframe.document.getElementById("memdiv").style.display = 'none';
                    oIframe.document.getElementById("memdiv").innerHTML = oIframe.document.getElementById("chatbox").innerHTML.replace(JS_search.inHtml, JS_replace);

                    oIframe.hackMsg();

                    oIframe.document.getElementById("chatbox").innerHTML = oIframe.document.getElementById("memdiv").innerHTML;
                    if (oIframe.document.getElementById('chatbox_option_disco').style.display == 'none') {
                        oIframe.CB_disconnect();
                    }
                    oIframe.document.getElementById("chatbox_option_with_archives").style.display = 'none';
                    oIframe.document.getElementById("chatbox_option_without_archives").style.display = 'none';
                    oIframe.document.getElementById("chatbox").style.display = 'block';
                }
            }, 250);
        };
    }

Is there an ability to stay the members connected in chatbox while they are connected to forum and hiding the chatbox options archive/connect/disconnect? Is there an ability to change the default chatbox title?

And one more question how can I change the date format into dd/mm/yyyy?


Last edited by Black-Shadow on December 10th 2014, 3:13 am; edited 1 time in total
Van-Helsing
Van-Helsing
Hyperactive

Male Posts : 2431
Reputation : 116
Language : English, Greek

http://itexperts.forumgreek.com/

Back to top Go down

Solved Re: Jscript's chatbox code issues

Post by tommycoo8 December 2nd 2014, 9:50 am

and one thing is that possible to make it auto login ?
tommycoo8
tommycoo8
Forumember

Male Posts : 57
Reputation : 1
Language : Indonesia

Back to top Go down

Solved Re: Jscript's chatbox code issues

Post by Van-Helsing December 2nd 2014, 11:39 am

Hello tommycoo8,
Yes I need an auto-login function for the members which are logged in.
Van-Helsing
Van-Helsing
Hyperactive

Male Posts : 2431
Reputation : 116
Language : English, Greek

http://itexperts.forumgreek.com/

Back to top Go down

Solved Re: Jscript's chatbox code issues

Post by JScript December 2nd 2014, 12:12 pm

@Black-Shadow

See this snippet below:
Code:

                oIframe.document.getElementById("chatbox").innerHTML = oIframe.document.getElementById("memdiv").innerHTML;
                if (oIframe.document.getElementById('chatbox_option_disco').style.display == 'none') {
                    oIframe.CB_disconnect();
                }
                oIframe.document.getElementById("chatbox_option_with_archives").style.display = 'none';
                oIframe.document.getElementById("chatbox_option_without_archives").style.display = 'none';
It is already present in my code and does just the auto login in chat!
As well as hiding the chatbox archive options, but not the option to connect / disconnect for a good reason:
"The Forumotion is changing the ChatBox's internal code and I assure you it will not be feasible hide the option to connect / disconnect, at least for now!"

I can change the date format, but this will according to your local language, so I do not see much need.

To change the title, add the code below after the following line: oIframe.document.getElementById ("chatbox") style.display = 'block';
Code:

// change title "Chatbox"
var MyTitle = "Your title for the ChatBox!";
oIframe.find('a.chat-title').text(MyTitle);

So long,

JS
JScript
JScript
Forumember

Male Posts : 741
Reputation : 175
Language : PT-BR, EN
Location : Brazil

http://jscript.forumeiros.com/

Back to top Go down

Solved Re: Jscript's chatbox code issues

Post by tommycoo8 December 2nd 2014, 1:03 pm

but when i login with other account it won't login automatically ? why ?
i want to ask a question, how i can edit the style of the chatbox, i try to style it with css but it won't work ?
tommycoo8
tommycoo8
Forumember

Male Posts : 57
Reputation : 1
Language : Indonesia

Back to top Go down

Solved Re: Jscript's chatbox code issues

Post by Van-Helsing December 2nd 2014, 1:24 pm

Hello all,
I change my code to this code:
Code:

/**************************************************************************
     * Module: AVATARChat + JS_EditMsgChat
     * Description: Need?!
     * Author: Made and Optimizations by JScript - 2014/11/23
     * Version: RC2 (Release candidate 2!)
     ***************************************************************************/
    function insertChatBox(chatbox_id, chatbox_url) {
        return insertChatBoxNew(chatbox_id, chatbox_url);
    }

    // Redefine function in frm_lang_xx.js, by JScript Brasil at live dot com!
    function insertChatBoxNew(chatbox_id, chatbox_url) {

        document.getElementById(chatbox_id).innerHTML = '<iframe src="/chatbox/index.forum?archives=1" id="frame_chatbox" scrolling="no" width="100%" height="100%" marginwidth="0" marginheight="0" frameborder="0"></iframe>';

        frames["frame_chatbox"].onload = function() {
            // Redefine function in chatbox7.js, by JScript Brasil at live dot com!
            var JS_search = {
                    //inVar: /">\[(?:(?:2[0-3]|[0-1][0-9]|[0-9]):[0-5][0-9]:[0-5][0-9])\]<\/span>&nbsp;<span class=\"user-msg\">(.+)&Iota;id=(.*?)&Alpha;<(.*?)>&Epsilon;<img (.*?)&Chi;<img (.*?)>&Tau;(.+)&Mu;(.*?)<\/span>/g,
                    //inHtml: /">\[(?:(?:2[0-3]|[0-1][0-9]|[0-9]):[0-5][0-9]:[0-5][0-9])\]<\/span>&nbsp;<span class=\"user-msg\">(.+)[\u0399]id=(.*?)[\u0391]<(.*?)>[\u0395]<img (.*?)[\u03a7]<img (.*?)>[\u039c](.*?)<\/span>/g
                    inVar: /&Iota;id=(.*?)&Alpha;<(.*?)>&Epsilon;<img (.*?)&Chi;<img (.*?)>&Mu;(.*?)<\/span>/g,
                    inHtml: /[\u0399]id=(.*?)[\u0391]<(.*?)>[\u0395]<img (.*?)[\u03a7]<img (.*?)>[\u039c](.*?)<\/span>/g
                },
                // JS_replace = '">[$6]$1<span class="id" id=$2><span class="js-avatar"><$3></span><span class="editor"><img onclick="editor(this, 1)" $4<img onclick="editor(this, 2)" $5></span><span class="text">$7</span>',
                JS_replace = '<span class="id" id=$1><span class="js-avatar"><$2></span><span class="editor"><img onclick="editor(this, 1)" $3<img onclick="editor(this, 2)" $4></span><span class="text">$5</span>',
                oIframe = (document.getElementById("frame_chatbox").contentWindow || document.getElementById("frame_chatbox").contentDocument),
                script = oIframe.document.createElement("script"),
                memDiv = oIframe.document.createElement('div');

            script.type = "text/javascript";
            script.innerHTML =
                'USERNAME = parent._userdata.username;' +
                'SUPERMOD = parent._userdata.user_level;' +
                'AVATAR = parent._userdata.avatar.replace(\'<img src="\', "[img]").replace(\'" alt="" />\', "[/img]");' +
                'JS_search = ' + JS_search.inVar + ';' +
                'JS_replace = \'' + JS_replace + '\';' +
                'function submitmsg(params) {' +
                '   if (document.post.message.value.length < 4 && SUPERMOD !== 1) return false;' +
                '   if (document.post.message.value.indexOf("/") !== 0) {' +
                '      var date = new Date();' +
                '       var UID = Math.ceil(date.getDate() + date.getHours() + Math.random() * Math.pow(10, 10) + date.getMinutes() + date.getSeconds() + date.getMilliseconds());' +
                '       if (UID.length < 10) {' +
                '         UID + "" + (10 - UID.length);' +
                '       }' +
                //'      var time = new Date().toLocaleTimeString();' +
                //'      document.post.message.value = \'&Iota;id="\' + UID + \'"&Alpha;\' + AVATAR + "&Epsilon;[img]http://goo.gl/brvCui[/img]&Chi;[img]http://goo.gl/k8FZx5[/img]&Tau;" + time + "&Mu;" + document.post.message.value;' +
                '      document.post.message.value = \'&Iota;id="\' + UID + \'"&Alpha;\' + AVATAR + "&Epsilon;[img]http://goo.gl/brvCui[/img]&Chi;[img]http://goo.gl/k8FZx5[/img]&Mu;" + document.post.message.value;' +
                '    }' +
                '   document.post.sent.value = document.post.message.value;' +
                '   document.post.message.value = "";' +
                '   document.post.message.focus();' +
                '   ajax_submit_chatbox(params);' +
                '   return false' +
                '}' +
                'function copy_user_name(user_name) {' +
                '   if (document.post.message) {' +
                '      document.post.message.focus();' +
                '      document.post.message.value += ((user_name.indexOf("@") == 0) ? "" : "@") + user_name + " -> ";' +
                '   }' +
                '    return false' +
                '}' +
                'function ajax_submit_chatbox(params, editor) {' +
                '   number_of_refresh = 0;' +
                '   if (params == "" || params == undefined) {' +
                '      params = "?achives=0"' +
                '   }' +
                '   if (editor == "" || editor == undefined) {' +
                '      var msg_sent = document.post.sent.value;' +
                '   } else {' +
                '      var msg_sent = editor;' +
                '   }' +
                '   var data = "&mode=send";' +
                '   data += "&sent=" + encodeURIComponent(msg_sent);' +
                '   data += "&sbold=" + document.post.sbold.value;' +
                '   data += "&sitalic=" + document.post.sitalic.value;' +
                '   data += "&sunderline=" + document.post.sunderline.value;' +
                '   data += "&sstrike=" + document.post.sstrike.value;' +
                '   data += "&scolor=" + document.post.scolor.value;' +
                '   if ((msg_sent.indexOf("/away") == 0) || (msg_sent.indexOf("/abs") == 0)) {' +
                '      document.getElementById("refresh_auto").checked = false' +
                '   }' +
                '   if (document.post.sent.value == "/banlist") {' +
                '      window.open("/chatbox/chatbox_banlist.forum" + params, "banlist", "toolbar=no,menubar=no,personalbar=no,width=450,height=300,scrollbars=yes,resizable=yes");' +
                '      return false' +
                '   }' +
                '   $.ajax({' +
                '      url: "/chatbox/chatbox_actions.forum" + params,' +
                '      type: "post",' +
                '      data: data,' +
                '      dataType: "script",' +
                '      success: function(response, status, xhr) {' +
                '         if (xhr.status == 200) {' +
                //'            if (typeof (chatbox_messages) !== "undefined") {' +
                '               chatbox_messages = chatbox_messages.replace(JS_search, JS_replace);' +
                '                document.getElementById("memdiv").innerHTML = chatbox_messages;' +
                '                  hackMsg();' +
                '               document.getElementById("chatbox").innerHTML = document.getElementById("memdiv").innerHTML;' +
                '               /*$("#chatbox").html(chatbox_messages) [0].scrollTop = $("#chatbox").prop("scrollHeight");*/' +
                '               document.getElementById("chatbox").scrollTop = 999999;' +
                //'            }' +
                '            if (typeof (chatbox_memberlist) !== "undefined") {' +
                '               document.getElementById("chatbox_members").innerHTML = chatbox_memberlist;' +
                '               /*$("#chatbox_members").html(chatbox_memberlist);*/' +
                '            }' +
                '         }' +
                '      },' +
                '   })' +
                '}' +
                'function ajax_refresh_chatbox(params, force) {' +
                '   if (params == "" || params == undefined) {' +
                '      params = "?achives=0"' +
                '   }' +
                '   $.ajax({' +
                '      url: "/chatbox/chatbox_actions.forum" + params + "&mode=refresh",' +
                '      type: "get",' +
                '      dataType: "script",' +
                '      success: function(response, status, xhr) {' +
                '         if (xhr.status == 200) {' + // || force) {' + <- Fail!
                //'              if ($("#chatbox").length) {' +
                '            if (typeof (chatbox_messages) !== "undefined") {' +
                '               chatbox_messages = chatbox_messages.replace(JS_search, JS_replace);' +
                '                document.getElementById("memdiv").innerHTML = chatbox_messages;' +
                '                  hackMsg();' +
                '               document.getElementById("chatbox").innerHTML = document.getElementById("memdiv").innerHTML;' +
                '               document.getElementById("chatbox").scrollTop = document.getElementById("chatbox").scrollHeight + document.getElementById("chatbox").offsetHeight;' +
                '               document.getElementById("chatbox").scrollTop = 999999;' +
                '              }' +
                //'              if (document.getElementById("chatbox_members").innerHTML != null) document.getElementById("chatbox_members").innerHTML = chatbox_memberlist;' +
                '            if (typeof (chatbox_memberlist) !== "undefined") {' +
                '               document.getElementById("chatbox_members").innerHTML = chatbox_memberlist;' +
                '               /*$("#chatbox_members").html(chatbox_memberlist);*/' +
                '            }' +
                '         }' +
                '      },' +
                '   })' +
                '}' +
                'function hackMsg() {' +
                '   var oTarget = jQuery("#memdiv > p"),' +
                '      iLen = oTarget.length,' +
                '      index = 0;' +
                '   for (; index < iLen; index++) {' +
                '      var oThis = jQuery(oTarget[index]),' +
                '         sUserName = oThis.find(".user > a").text(),' +
                '         ID = oThis.find("span.id");' +
                '      if (ID.length == 0) {' +
                '         ID = oThis.find(".msg:last").text();' +
                // XORcipher -> '         ID = XORcipher(oThis.find(".msg").text());' +
                '         var del = ID.match(/^\\/remove[\\u0399](.*?)$/);' +
                // XORcipher -> '         var del = ID.match(/^\\/remove&Iota;(.*?)$/);' +
                '         if (del !== null) {' +
                '            var oMsg = oThis.parent().find("#" + del[1]).closest("p");' +
                '            if (oMsg.length) {' +
                //'               if (oMsg.find(".user > a").text() == sUserName || SUPERMOD > 0) {' +
                '                  oMsg.remove();' +
                //'               }' +
                '            }' +
                '         }' +
                '           var edit = ID.match(/^\\/edit[\\u0399]([0-9]+)[\\u039c](.*?)$/);' +
                // XORcipher -> '              var edit = ID.match(/^\\/edit&Iota;([0-9]+)&Mu;(.*?)$/);' +
                '           if (edit !== null) {' +
                '            var oMsg = oThis.parent().find("#" + edit[1]);' +
                '            if (oMsg.length) {' +
                //'               if (oMsg.closest("p").find(".user > a").text() == sUserName || SUPERMOD > 0) {' +
                '                  oMsg.find("span.text").text(edit[2]);' +
                //'               }' +
                '            }' +
                '              }' +
                '              /*var nudge = ID.match(/^\\/nudge[\\u0399]([0-9]+)[\\u039d](.*?)$/);' +
                '              if (nudge !== null) {' +
                '            var oMsg = oThis.parent().find("#" + nudge[1]);' +
                '            if (oMsg.length) {' +
                '               if (nudge[2] == USERNAME) {' +
                '                  // Developing!;' +
                '               }' +
                '            }' +
                '           }*/' +
                '         oThis.remove();' +
                '      } else {' +
                '         if (sUserName !== USERNAME && SUPERMOD == 0) {' +
                '            ID.find(".editor").remove();' +
                '         }' +
                '      }' +
                '   }' +
                '}' +
                'function editor(oThis, num) {' +
                '   if (num == 1 && iConfirm("Είστε σίγουροι ότι θέλετε να διαγράψετε αυτό το μήνυμα;\\n\\n" + jQuery(oThis).closest(".id").text() ) == 1) {' +
                '      ajax_submit_chatbox("?achives=1", "/remove&Iota;" + jQuery(oThis).closest(".id").attr("id"));' +
                '      jQuery(oThis).closest("p").remove();' +
                '   } else if (num == 2) {' +
                '      var result = prompt("Επεξεργασία Μηνύματος:", jQuery(oThis).closest(".id").text());' +
                '      if (result != null) {' +
                '         ajax_submit_chatbox("?achives=1", "/edit&Iota;" + jQuery(oThis).closest(".id").attr("id") + "&Mu;" + result);' +
                '         jQuery(oThis).closest(".id span.text").text(result);' +
                '      }' +
                '   /*} else if (num == 3) {' +
                '      ajax_submit_chatbox("?achives=1", XORcipher("/nudge&Iota;" + jQuery(oThis).closest(".id").attr("id") + "&Nu;" + jQuery(oThis).closest("p").find(".user > a").text()));*/' +
                '   }' +
                '}' +
                /*'function XORcipher(sText) {' +
             '   var key = 2,' +
             '      result = "",' +
             '      len = sText.length,' +
             '      i = 0;' +
             '   for (; i < len; i++) {' +
             '      result += String.fromCharCode(key ^ sText.charCodeAt(i));' +
             '   }' +
             '   return result;' +
             '}' +*/
                'function iConfirm(text) {' +
                '   var iChoice = -1;' +
                '   if (confirm(text) == true) {' +
                '      iChoice = 1;' +
                '   } else {' +
                '      iChoice = 0;' +
                '   }' +
                '   return iChoice;' +
                '}';
            oIframe.document.getElementsByTagName("head")[0].appendChild(script);

            var style = oIframe.document.createElement("style");
          style.type = "text/css";
            style.innerHTML =
                '#chatbox p {' +
                '   background: none repeat scroll 0 0 #fff;' +
                '   border-bottom: 1px solid #e3e3e3;' +
                '   line-height: 1.3em;' +
                '   padding: 5px;' +
                '}' +
                '#chatbox span[title] {' +
                '   color: #8f8f8f !important;' +
                '   float: right !important;' +
                '}' +
                '#chatbox .user:not(:empty) {' +
                '   font-weight: 700;' +
                '   margin-left: 36px !important;' +
                '}' +
                '#chatbox .id {' +
                '   display: block;' +
                '   margin-top: 3px;' +
                '}' +
                '#chatbox .js-avatar img {' +
                '   background: none repeat scroll 0 0 #fff;' +
                '   border: 1px solid #ddd;' +
                '   float: left;' +
                '   height: 30px;' +
                '   margin-right: 5px;' +
                '   margin-top: -19px;' +
                '   max-width: 30px;' +
                '   padding: 1px;' +
                '   vertical-align: middle;' +
                '   width: 30px;' +
                '}' +
                '#chatbox .editor img {' +
                '   cursor: pointer;' +
                '   float: right;' +
                '   padding-left: 4px;' +
                '}' +
                '#chatbox {' +
                '   display: none;' +
                '}';
            oIframe.document.getElementsByTagName("head")[0].appendChild(style);

            var forceConnect = setInterval(function() {
                if (oIframe.document.getElementById("chatbox") !== null) {
                    clearInterval(forceConnect);
                    memDiv.id = 'memdiv';
                    oIframe.document.getElementsByTagName('body')[0].appendChild(memDiv);
                    oIframe.document.getElementById("memdiv").style.display = 'none';
                    oIframe.document.getElementById("memdiv").innerHTML = oIframe.document.getElementById("chatbox").innerHTML.replace(JS_search.inHtml, JS_replace);

                    oIframe.hackMsg();

                    oIframe.document.getElementById("chatbox").innerHTML = oIframe.document.getElementById("memdiv").innerHTML;
                    if (oIframe.document.getElementById('chatbox_option_disco').style.display == 'none') {
                        oIframe.CB_disconnect();
                    }
                    oIframe.document.getElementById("chatbox_option_with_archives").style.display = 'none';
                    oIframe.document.getElementById("chatbox_option_without_archives").style.display = 'none';
                    oIframe.document.getElementById("chatbox").style.display = 'block';
                    // change title "Chatbox"
                    var MyTitle = "Shoutbox";
                    oIframe.find('a.chat-title').text(MyTitle);
                }
            }, 250);
        };
    }
but its not working.
Is there a solution to block the external links in chatbox? After a few minutes of inactivity the chatbox disconnect the members as I watched.
Van-Helsing
Van-Helsing
Hyperactive

Male Posts : 2431
Reputation : 116
Language : English, Greek

http://itexperts.forumgreek.com/

Back to top Go down

Solved Re: Jscript's chatbox code issues

Post by Van-Helsing December 3rd 2014, 1:34 pm

Bump
Van-Helsing
Van-Helsing
Hyperactive

Male Posts : 2431
Reputation : 116
Language : English, Greek

http://itexperts.forumgreek.com/

Back to top Go down

Solved Re: Jscript's chatbox code issues

Post by Van-Helsing December 4th 2014, 2:40 pm

Bump
Van-Helsing
Van-Helsing
Hyperactive

Male Posts : 2431
Reputation : 116
Language : English, Greek

http://itexperts.forumgreek.com/

Back to top Go down

Solved Re: Jscript's chatbox code issues

Post by _Twisted_Mods_ December 4th 2014, 2:57 pm

dont forget to /clear your chatbox then refresh the page
_Twisted_Mods_
_Twisted_Mods_
Helper
Helper

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

http://liquidcode.forumotion.com

Back to top Go down

Solved Re: Jscript's chatbox code issues

Post by JScript December 4th 2014, 4:09 pm

Black-Shadow wrote:Is there a solution to block the external links in chatbox?
Sure, but I do not intend to add in this version of my code, it will be an addon in the next version ok?

Black-Shadow wrote:After a few minutes of inactivity the chatbox disconnect the members as I watched.
But this is not a natural behavior? My code only replicates the original functions, then I put my changes to add the edition of messages!

So long,

JS
JScript
JScript
Forumember

Male Posts : 741
Reputation : 175
Language : PT-BR, EN
Location : Brazil

http://jscript.forumeiros.com/

Back to top Go down

Solved Re: Jscript's chatbox code issues

Post by Van-Helsing December 4th 2014, 9:55 pm

JScript wrote:Black-Shadow
After a few minutes of inactivity the chatbox disconnect the members as I watched.
But this is not a natural behavior? My code only replicates the original functions, then I put my changes to add the edition of messages!

So long,

JS
Is there a way to disable the disconnections?
Van-Helsing
Van-Helsing
Hyperactive

Male Posts : 2431
Reputation : 116
Language : English, Greek

http://itexperts.forumgreek.com/

Back to top Go down

Solved Re: Jscript's chatbox code issues

Post by JScript December 5th 2014, 2:47 am

Black-Shadow wrote:Is there a way to disable the disconnections?
Yes, but this should never be done because it overloads the system!

JS
JScript
JScript
Forumember

Male Posts : 741
Reputation : 175
Language : PT-BR, EN
Location : Brazil

http://jscript.forumeiros.com/

Back to top Go down

Solved Re: Jscript's chatbox code issues

Post by Van-Helsing December 5th 2014, 3:13 am

Yes I am understanding that, can we set it to 10 minutes of inactivity like your old shoutbox?
Van-Helsing
Van-Helsing
Hyperactive

Male Posts : 2431
Reputation : 116
Language : English, Greek

http://itexperts.forumgreek.com/

Back to top Go down

Solved Re: Jscript's chatbox code issues

Post by JScript December 5th 2014, 4:11 pm

Black-Shadow wrote:Yes I am understanding that, can we set it to 10 minutes of inactivity like your old shoutbox?
Yes we can, but only in the next version!

So long,

JS
JScript
JScript
Forumember

Male Posts : 741
Reputation : 175
Language : PT-BR, EN
Location : Brazil

http://jscript.forumeiros.com/

Back to top Go down

Solved Re: Jscript's chatbox code issues

Post by tommycoo8 December 9th 2014, 11:20 pm

how can i style this chatbox ?
tommycoo8
tommycoo8
Forumember

Male Posts : 57
Reputation : 1
Language : Indonesia

Back to top Go down

Solved Re: Jscript's chatbox code issues

Post by JScript December 10th 2014, 1:21 am

tommycoo8 wrote:how can i style this chatbox ?
I guess the correct thing you create another topic!

So long,

JS
JScript
JScript
Forumember

Male Posts : 741
Reputation : 175
Language : PT-BR, EN
Location : Brazil

http://jscript.forumeiros.com/

Back to top Go down

Solved Re: Jscript's chatbox code issues

Post by Van-Helsing December 10th 2014, 3:14 am

Hello,
I mark it as Solved as there isn't any update available yet.

Best Regards,
Black-Shadow
Van-Helsing
Van-Helsing
Hyperactive

Male Posts : 2431
Reputation : 116
Language : English, Greek

http://itexperts.forumgreek.com/

Back to top Go down

Back to top

- Similar topics

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