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.

[help] Chatbox code for moderating.

Page 2 of 2 Previous  1, 2

View previous topic View next topic Go down

Solved [help] Chatbox code for moderating.

Post by Deditoiu Bogdan on September 7th 2016, 9:01 pm

First topic message reminder :

Hello to everyone. I'm struggling with my chatbox ... I want to make is:
1 - change the name of it
2 - Make it notify me when somebody send a new message like
here:
3 - auto log in and
this:
works , but not always... I'd like to get a little explanation or a point where i should paste those codes cuz i'm kinda bad with them ...
I have them
here:
But the tutorial that i've found in the forum says to paste them on Administrative panel>> Display >> Colors >> CSS Stylesheet
[img][/img]

This is the whole code that I used so far...
Code:
$(function(){
    if(document.getElementById('logout')) $.post('/chatbox/chatbox_actions.forum?archives','mode=send&sent=');
    });

$(window).load(function() {
  var chatbox_script = function() {
    $('#chatbox > p > .msg > span').filter('[style="color:green"],[style="color:red"]').closest('p').remove();
    var overrided = Chatbox.prototype.refresh;
    Chatbox.prototype.refresh = function(data) {
      if (data.messages && data.messages.length) {
        data.messages = $.grep(data.messages, function(v) {
          return v.userId != -10 || $.inArray(v.msgColor, ["red", "green"]) == -1;
        });
      }
      overrided.call(this, data);
    };
  };
 
  var
s=document.createElement('script');s.text="("+chatbox_script.toString()+")();";$('object[data^="/chatbox/index.forum"],iframe[src^="/chatbox/index.forum"]').each(function(){try{$(this.contentDocument||this.contentWindow.document).find("#chatbox").closest("html").find("head").first().each(function(){this.appendChild(s.cloneNode(true))})}catch(a){}})
});

$(window).load(function() {
  var chatbox_script = function() {
    $("a.chat-title").text("In Da Place");
  };
 
  var
s=document.createElement('script');s.text="("+chatbox_script.toString()+")();";$('object[data^="/chatbox/index.forum"],iframe[src^="/chatbox/index.forum"]').each(function(){try{$(this.contentDocument||this.contentWindow.document).find("#chatbox").closest("html").find("head").first().each(function(){this.appendChild(s.cloneNode(true))})}catch(a){}})
});

window.localStorage && $(window).load(function() {
  var chatbox_script = function() {
    var t_icon = window.top.$.find('link[rel="shortcut icon"]')[0];
    var t_doc = window.top.document;
    var title = t_doc.title;
    var icon = t_icon.getAttribute('href');
 
    var rep_title = '!! New message !! '+title;
    var rep_icon = 'http://s301826463.onlinehome.fr/f/al.ico';
 
    $(window).on("focus", function(){ localStorage.cb_blurred='' }).on("blur", function(){ localStorage.cb_blurred=1; });
    var overrided = Chatbox.prototype.refresh;
    Chatbox.prototype.refresh = function(data) {
      if (data.messages && data.messages.length) {
        var lm = data.messages.slice(-1)[0];
        var last_message = lm.time+','+lm.action+','+lm.msg;
        if(this.last_message != last_message) {
          var user = $.grep(data.users, function(v){return v.id==chatbox.userId});
          user = user.length ? user[0] : [{}];
          if(this.last_message!==undefined) {
            if(lm.userId!=chatbox.userId && user.username!=lm.username) {
              if(localStorage.cb_blurred) (function(){
                var blink = function(){
                  if(title == t_doc.title) {
                    if(!localStorage.cb_blurred) return;
                    var new_title = rep_title;
                    var new_icon = rep_icon;
                  } else {
                    var new_title = title;
                    var new_icon = icon;
                  }
                  t_doc.title = new_title;
                  var new_t_icon = t_icon.cloneNode(true);
                  new_t_icon.setAttribute('href', new_icon);
                  var t_icon_parent = t_icon.parentNode;
                  t_icon_parent.removeChild(t_icon);
                  t_icon_parent.appendChild(new_t_icon);
                  t_icon = new_t_icon;
                  setTimeout(blink, 500);
                };
                blink();
              })();
            } else {
              localStorage.cb_blurred='';
            }
          }
          this.last_message = lm;
        }
      }
      overrided.call(this, data);
    };
  };
 
  var
s=document.createElement('script');s.text="("+chatbox_script.toString()+")();";$('object[data^="/chatbox/index.forum"],iframe[src^="/chatbox/index.forum"]').each(function(){try{$(this.contentDocument||this.contentWindow.document).find("#chatbox").closest("html").find("head").first().each(function(){this.appendChild(s.cloneNode(true))})}catch(a){}})
});
I'm sorry if i posted it in the wrong topic or if i did something wrong... Sorry


Last edited by Deditoiu Bogdan on September 7th 2016, 11:35 pm; edited 1 time in total

Deditoiu Bogdan
New Member

Posts : 21
Reputation : 1
Language : Romanian

http://kureijiunit.onegoo.net/

Back to top Go down


Solved Re: [help] Chatbox code for moderating.

Post by Deditoiu Bogdan on September 10th 2016, 5:13 pm

Remove it? why?
I did it xD
Thanks a lot! You saved me Very Happy
The chat problem is solved Very Happy
For another request i have to open another thread? :-?

Deditoiu Bogdan
New Member

Posts : 21
Reputation : 1
Language : Romanian

http://kureijiunit.onegoo.net/

Back to top Go down

Solved Re: [help] Chatbox code for moderating.

Post by Ch@lo Valdez on September 10th 2016, 5:18 pm

my last javascript change this name too,
if you want change it this way:

search
Code:
message_header = 'In Da Place';

and replace
Code:
message_header = 'wherever you want';

Ch@lo Valdez
Forumember

Male Posts : 100
Reputation : 31
Language : spanish

Back to top Go down

Solved Re: [help] Chatbox code for moderating.

Post by Deditoiu Bogdan on September 10th 2016, 5:27 pm

Okey. Thanks again for the help! Very Happy bounce

Deditoiu Bogdan
New Member

Posts : 21
Reputation : 1
Language : Romanian

http://kureijiunit.onegoo.net/

Back to top Go down

Solved Re: [help] Chatbox code for moderating.

Post by SLGray on September 10th 2016, 10:25 pm

Problem solved & topic archived.
Please read our forum rules: ESF General Rules


When your topic has been solved, ensure you mark the topic solved.
Never post your email in public.


SLGray
Administrator
Administrator

Male Posts : 36735
Reputation : 2447
Language : English
Location : United States

http://ztwds.forumotion.com/

Back to top Go down

Page 2 of 2 Previous  1, 2

View previous topic View next topic Back to top


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