FreiChat related discussions
Show date & time in chat and email

Hi

I found another topic about how someone can show the date also in the chat..
http://codologic.com/forum/index.php?u=/topic/3756/how-to-show-the-chat-date

However I opened the plugins.js file and I cannot find the function you mention.

Also is it possible when sending the conversation from a private chat to show the date/time also. Now it shows nothing.

Thanks in advance.

Hi I found another topic about how someone can show the date also in the chat.. http://codologic.com/forum/index.php?u=/topic/3756/how-to-show-the-chat-date However I opened the plugins.js file and I cannot find the function you mention. Also is it possible when sending the conversation from a private chat to show the date/time also. Now it shows nothing. Thanks in advance.

Can you post the contents of plugins.js file ?

Also is it possible when sending the conversation from a private chat to show the date/time also. Now it shows nothing.

It shows the date/time when you hover over the message

Can you post the contents of plugins.js file ? >Also is it possible when sending the conversation from a private chat to show the date/time also. Now it shows nothing. It shows the date/time when you hover over the message

Here is the contents of the file:

//------------------------------------------------------------------------------
/* Chatroom font formatter plugin */

FreiChat.util = {
    storage: {
        get: function (index) {

            if (typeof Storage !== "undefined") {
                localStorage.getItem(index);
            } else {
                Get_Cookie(index);
            }
        },
        set: function (index, value) {

            if (typeof Storage !== "undefined") {
                localStorage.setItem(index, value);
            } else {
                Set_Cookie(index, value);
            }

        }

    }
};

FreiChat.plugins = {
    formatter: {
        id: "frei_chatroom_formatter_plugin",
        color: null,
        get_html: function () {

            var ident = this.id;
            var wrapper = '<div onclick="FreiChat.plugins.formatter.show_html()" id="' + ident + '" class="' + ident + '" > ';

            var body = '';

            var sel = '<div class="cp-default" id="frei_chatroom_cp"><div id="frei_chatroom_cp_content"></div></div>';
            var end = '</div>';

            return wrapper + body + end + sel;

        },
        load: function () {

            this.color = this.get_color();
            this.cp = $jn("#" + this.id);

            $jn("#frei_chatroom_cp_content").spectrum({
                color: this.color,
                showPaletteOnly: true,
                showPalette: true,
                palette: [
                    ['rgb(255, 255, 255)', 'rgb(0, 0, 0)', 'rgb(0, 0, 85)',
                        'rgb(0, 128, 0)', 'rgb(255, 0, 0)'],
                    ['rgb(128, 0, 0)', 'rgb(128, 0, 128)', 'rgb(255, 85, 0)',
                        'rgb(255, 255, 0)', 'rgb(0, 255, 0)'],
                    ['rgb(0, 128, 128)', 'rgb(0, 255, 255)', 'rgb(0, 0, 255)',
                        'rgb(255, 0, 255)', 'grey'],
                ], flat: true,
                change: function (tcolor) {
                    FreiChat.plugins.formatter.change_clr(tcolor);
                }

            });

            this.cp.css("background", this.color);
            $jn('#chatroommessagearea').css("color", this.color);
        },
        change_clr: function (color) {

            var rgba = color.toHexString();
            this.cp.css("background", rgba);
            this.set_color(rgba);

        },
        show_html: function () {

            $jn("#frei_chatroom_cp").show();
        },
        get_color: function () {

            return Get_Cookie('selected_chatroom_color');
        },
        set_color: function (color) {

            Set_Cookie('selected_chatroom_color', color);
            this.color = color;
            $jn('#chatroommessagearea').css("color", color);
        },
        formatBB: function (message) {

            if (this.color !== "#808080" || this.color !== "grey") {

                message = "[color=" + this.color + "]" + message + "[/color]";
            }

            return message;
        },
        format: function (message) {

            if (this.color !== "#808080" || this.color !== "grey") {

                message = "<span style='color:" + this.color + "'>" + message + "</span>";
            }

            return message;

        }
    },
    is_allowed: function (index) {

        var guests = (freidefines.GEN.is_guest == 1 && freidefines.ACL[index].guest == "allow");
        var users = (freidefines.GEN.is_guest == 0 && freidefines.ACL[index].user == "allow");

        return (guests || users);
    }
};

/*  The SMILEY plugin !*/
FreiChat.smiley = function (id)
{

    if (id == FreiChat.in_room) {
        id = "chatroom";
    }

    FreiChat.current_smiley_selected = id;

    var smileys = $jn('#frei_smileys_' + id);
    smileys.slideToggle();
};
//------------------------------------------------------------------------------
FreiChat.smileylist = function (id)
{
    var smileys = freidefines.smileys;

    var i = 0;

    var sm_array = [];

    for (i = 0; i < smileys.length; i++) {
        sm_array[i] = smileys[i].symbol;
    }

    var str;

    /*
     if(freidefines.thememaker == true) {
     str= '<span class="smileylist">'+FreiChat.mksmileyurl([':)',':(',':B',':\')',':laugh:',':cheer:',';)',':P',':angry:',':unsure:',':ohmy:',':huh:',':dry:',':lol:',':silly:',':woohoo:'], id)+'</span>';
     }else{
     str= '<span class="smileylist">'+FreiChat.mksmileyurl([':)',':(',':B',':\')',':laugh:',':cheer:',';)',':P',':angry:',':unsure:',':ohmy:',':huh:',':o',':0',':dry:',':lol:',':D',':silly:',':woohoo:'], id)+'</span>';
     }*/


    str = '<span class="smileylist">' + FreiChat.mksmileyurl(sm_array, id) + '</span>';


    return str;

};
//------------------------------------------------------------------------------
FreiChat.mksmileyurl = function (name, id)
{
    var namelen = name.length;
    var i = 0;
    var str = '<tr>';
    var j = 0;

    for (i = 0; i <= namelen; i++)
    {
        if (name[i] == null || name[i] == undefined)
        {
            break;
        }

        if (j >= 5)
        {
            str += '</tr><tr>';
            j = 0;
        }

        var action;

        if (freidefines.thememaker == true) {
            action = ''
        } else {
            action = 'onmousedown=FreiChat.appendsmiley("' + name[i] + '","' + id + '")';
        }

        str += '<td><div class="frei_smiley_image" ' + action + ' >' + FreiChat.SmileyGenerate(name[i], id) + '</div></td>';
        j++
    }
    //sconsole.log('<table><td>'+str+'</td></table>');
    return '<table class="frei_smileys_table">' + str + '</table>';
};
//------------------------------------------------------------------------------
FreiChat.appendsmiley = function (name, id)
{

    if (id == "chatroom") {
        id = "chatroommessagearea";
    } else if (id == "mobile") {
        id = "chat_message";
    } else {
        id = 'chatboxtextarea' + id;
    }
    var area = $jn('#' + id);

    $jn('#frei_smileys_' + id).css('display', 'none')
            .removeClass('inline')
            .addClass('none');

    area.val(area.val() + name + " ");

    setTimeout(function () {
        FreiChat.move_cursor_to_end(document.getElementById(id));
    }, 100);
};
//------------------------------------------------------------------------------

FreiChat.move_cursor_to_end = function (el) {
    if (typeof el.selectionStart == "number") {
        el.selectionStart = el.selectionEnd = el.value.length;
    } else if (typeof el.createTextRange != "undefined") {
        el.focus();
        var range = el.createTextRange();
        range.collapse(false);
        range.select();
    }
};
//------------------------------------------------------------------------------


FreiChat.SmileyGenerate = function (messages, id)
{
    var replaced_mesg = messages;


    var smileys = freidefines.smileys;
    var i = 0;
    for (i = 0; i < smileys.length; i++) {

        replaced_mesg = replaced_mesg.frei_smiley_replace(smileys[i].symbol, '<img id="smile__' + id + '" src="' + FreiChat.make_url(smileys[i].image_name, "smileys") + '" alt="smile" />');

    }
    return replaced_mesg;
};
//------------------------------------------------------------------------------

String.prototype.frei_smiley_replace = function (name, value) {
    name = name.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, "\\$&");
    var re = new RegExp(name, "g");
    return this.replace(re, value);
}

/*  The SMILEY plugin !*/
//------------------------------------------------------------------------------
/*  The MAIL plugin !*/

FreiChat.sendmail = function (user, id)
{
    FreiChat.toid = id;
    FreiChat.touser = user;

    var left = (screen.width - 450) / 2;
    var top = (screen.height - 250) / 2;

    FreiChat.is_chatroom = (FreiChat.in_room === id);

    window.open(freidefines.GEN.url + "client/plugins/mail/html.php", 'mailWindow', 'width=450,height=250,top=' + top + ',left=' + left);
};
/*  The MAIL plugin !*/
//------------------------------------------------------------------------------
/*  The TRANSLATE plugin !*/
FreiChat.changelang = function (lang, id)
{
    var CookieStatus = FreiChat.getCookie(id);

    if (lang == 'disable')
    {
        FreiChat.setCookie("frei_stat_" + id, "disable&opened&" + CookieStatus.chatwindow_2 + "&" + CookieStatus.message + "&" + CookieStatus.pos_top + "&" + CookieStatus.pos_left);
        $jn("#translateimage" + id).attr('src', FreiChat.make_url(freidefines.notransimg));
        $jn("#frei_trans" + id).slideToggle('slow');
    }
    else
    {
        $jn("#translateimage" + id).attr('src', FreiChat.make_url(freidefines.translateimg));
        FreiChat.setCookie("frei_stat_" + id, lang + "&opened&" + CookieStatus.chatwindow_2 + "&" + CookieStatus.message + "&" + CookieStatus.pos_top + "&" + CookieStatus.pos_left);
        $jn("#frei_trans" + id).slideToggle('slow');
    }
};
//------------------------------------------------------------------------------
FreiChat.translate = function (id)
{
    $jn("#frei_trans" + id).slideToggle();
};
//------------------------------------------------------------------------------
FreiChat.langlist = function (id)
{
    var str = '<span class="langlist">' + FreiChat.makelangurl(['en', 'de', 'zh', 'cy', 'tr', 'uk', 'ru', 'it', 'ja', 'el', 'iw', 'fr', 'gl', 'ar'], id) + '<br/><a href="javascript:void(0)" onmousedown=FreiChat.changelang("disable",\'' + id + '\')>' + freidefines.plugin_trans_disable + '</a>&nbsp;</span>';
    return str;
};
//------------------------------------------------------------------------------
FreiChat.makelangurl = function (name, id)
{
    var namelen = name.length;
    var i = 0;
    var str = '';
    for (i = 0; i <= namelen; i++)
    {
        if (name[i] == null || name[i] == undefined)
        {
            break;
        }
        str += '<a href="javascript:void(0)" onmousedown=FreiChat.changelang("' + name[i] + '",\'' + id + '\')>' + name[i] + '</a>&nbsp;';
    }
    return str;
};
//------------------------------------------------------------------------------
FreiChat.appendtranslate = function (language, id, arr)
{
    var div = null;
    if (arr[0] == 'callbyget')
    {
        div = $jn('#msg_' + arr[1]);
        div.translate(language, {
            not: '.notranslate'
        });
    }
    else
    {
        div = $jn("#frei_" + id + " .chatboxcontent");
        if (arr == null || arr == '')
        {
            div.translate(language, {
                not: '.notranslate'
            });
        }
        else
        {
            div.translate(language, {
                not: '.notranslate'
            });

        }

    }

};
//------------------------------------------------------------------------------
FreiChat.show_original_text = function (me, id)
{
    var show_by_delaying = function () {

        var pos = $jn(me).position();

        if ($jn("#frei_orig_" + id).hasClass('iamtobehovered'))
        {
            $jn("#frei_orig_" + id).css({
                "left": (pos.left - 30) + "px",
                "top": (pos.top - 50) + "px",
                "display": "block"
            });
        }
    };

    FreiChat.timer = setTimeout(show_by_delaying, 500);
};
//------------------------------------------------------------------------------
FreiChat.show_original_text_onhover = function (me)
{
    if ($jn(me).hasClass('iamtobehovered'))
    {
        $jn(me).addClass('iambeinghovered');
    }


};
//------------------------------------------------------------------------------
FreiChat.hide_original_text = function (id)
{
    var a = function () {
        if (!$jn("#frei_orig_" + id).hasClass('iambeinghovered'))

        {
            $jn("#frei_orig_" + id).css("display", "none");
        }
    };
    setTimeout(a, 500);
    clearTimeout(FreiChat.timer);
};
//------------------------------------------------------------------------------
FreiChat.hide_original_text_onout = function (id)
{

    var hide_by_delaying = function () {

        $jn("#frei_orig_" + id).removeClass('iambeinghovered');
        $jn("#frei_orig_" + id).css("display", "none");
    };

    setTimeout(hide_by_delaying, 500);

};
/*  The TRANSLATE plugin !*/
//------------------------------------------------------------------------------
/*  The UPLOAD plugin !*/
FreiChat.upload = function (user, id)
{
    FreiChat.toid = id;
    FreiChat.touser = user;
    var left = (screen.width - 400) / 2;
    var top = (screen.height - 200) / 2;

    FreiChat.secure_upload = true;
    FreiChat.is_chatroom = (FreiChat.in_room == id);

    window.open(freidefines.GEN.url + "client/plugins/upload/html.php", 'uploadWindow', 'width=400,height=200,top=' + top + ',left=' + left);
};
/*  The UPLOAD plugin !*/
//------------------------------------------------------------------------------
/*  The VIDEO plugin !*/

//-------------------------------------------------------------------------------
/* Time */

FreiChat.getlocal_time = function (GMT_time) {



    if (GMT_time == 0) {
        GMT_time = FreiChat.getGMT_time();
    }

    var d = FreiChat.Date;
    var offset = d.getTimezoneOffset() * 60000;
    var timestamp = GMT_time - offset;

    var dTime = new Date(timestamp);
    var hours = dTime.getHours();
    var minute = dTime.getMinutes();

    if (minute < 10) {
        minute = "0" + minute;
    }
    /*
     var period = "AM";
     if (hours > 12) {
     period = "PM"
     }
     else {
     period = "AM";
     }*/
    //hours = ((hours > 12) ? hours - 12 : hours)
    return hours + ":" + minute + " ";// + period
};
//-----------------------------------------------------------------------------------------------
FreiChat.getGMT_time = function () {

    var d = new Date();
    var localtime = d.getTime();
    var offset = d.getTimezoneOffset() * 60000;
    return localtime + offset;
};
//-----------------------------------------------------------------------------------------------
FreiChat.show_time = function (id) {

    try {
        if (freidefines.PLUGINS.chat_time_shown_always === 'no')
            $jn("#freichat_time_" + id).css("visibility", "visible");
    } catch (e) {

        console.log('Something happended in FreiChat.show_time that was not supposed to happen!');
    }

};
//-----------------------------------------------------------------------------------------------
FreiChat.hide_time = function (id) {

    try {
        if (freidefines.PLUGINS.chat_time_shown_always === 'no')
            $jn("#freichat_time_" + id).css("visibility", "hidden");
    } catch (e) {

        console.log('Something happended in FreiChat.hide_time that was not supposed to happen!');
    }
};
//-----------------------------------------------------------------------------------------------
/* Time */
/* profile link */

FreiChat.show_profilelink = function (id) {
    $jn("#freichat_profile_link_" + id).css("visibility", "visible");
    $jn("#freichat_user_" + id).addClass('freichat_userlist_hover');
};
FreiChat.hide_profilelink = function (id) {
    $jn("#freichat_user_" + id).removeClass('freichat_userlist_hover');
    $jn("#freichat_profile_link_" + id).css("visibility", "hidden");
};


FreiChat.has_scrollbar = function (id) {
    var _elm = $jn("#" + id);
    var _hasScrollBar = false;
    if ((_elm.clientHeight < _elm.scrollHeight) || (_elm.clientWidth < _elm.scrollWidth)) {
        _hasScrollBar = true;
    }
    return _hasScrollBar;
};

//------------------------------------------------------------------------------
FreiChat.create_scrollbar = function (id, push) {
    var pane = $jn("#" + id);
    pane.nanoScroller({
        preventPageScrolling: true,
        scroll: 'bottom',
        alwaysVisible: true,
        contentClass: 'frei_content'

    });

    if (typeof push === "undefined")
        push = true;

    if (push)
        FreiChat.jscrollers.push(id);

};
//------------------------------------------------------------------------------
FreiChat.show_prompt = function (mesg) {

    var mesg = prompt(mesg);

    return mesg;
};
//-------------scrolls down the scroller ---------------------------

FreiChat.update_custom_gst_name = function () {

    FreiChat.freichatopt("nooptions");

    var name = $jn('#custom_guest_name_id').val();

    if (FreiChat.name_exists(name)) {

        alert(freidefines.TRANS.custom_guest_name_exists);
        return;
    }

    var l_name = name.toLowerCase();
    if (l_name.indexOf(FreiChat.g_prefix) >= 0) {
        FreiChat.custom_gst_name = name;
    } else {
        FreiChat.custom_gst_name = FreiChat.mod_guest_name(name, false);
    }

};

FreiChat.mod_guest_name = function (name, dup) {

    if (dup) {

        return name + Math.floor(Math.random() * 90 + 10);
    } else {
        return name + " (" + FreiChat.g_prefix + ")";
    }
};

FreiChat.name_exists = function (name) {

    var len = FreiChat.userdata.length;

    //here len>0 makes sure that len-- does not make len as -1
    while (len > 0 && len--) {

        if (name === FreiChat.userdata[len].show_name
                || FreiChat.mod_guest_name(name, false) === FreiChat.userdata[len].show_name)
            break;
    }

    return !!len;
};
//-------------scrolls down the scroller ---------------------------

FreiChat.scroll_down = function (ele_id, id) {

    //is called when content is added dynamically

    //reinistialize for every new message (dynamic content)
    if (id) {
        //FreiChat.jscroll[id].reinitialise();
        //FreiChat.jscroll[id].scrollToBottom();
    } else {
        //chatroom -> as false is passed in this case
    }
    //->bring scroller to bottom

    //get jquery div
    var div = $jn("#" + ele_id); //assuming only id of the element is passed
    //get height of div
    //var ht = div[0].scrollHeight; //DOM property

    //set its scrolltop equal to its new scroll height
    if (FreiChat.jscrollers.indexOf(ele_id) != -1) {
        div.nanoScroller().nanoScroller({scroll: 'bottom'});
        //console.log(ele_id);
    } else {

        div.scrollTop(div.prop("scrollHeight"));
    }
};

/* profile link */

// API

FreiChat.API = {
    //will get fired for every new user added to the list
    /**
     *
     * @param {Object} data
     * @param {Boolean} first
     * data contains the new user's following properties
     *
     *  data {
     *
     *     avatar : //Absolute url to his avatar pic
     *     img_url: //Absolute url to his current status
     *     profile_link: //Absolute url to his profile (empty if not available)
     *     show_name: //his name that will be visible
     *     status_mesg: //his current custom status message
     *     userid: //his userid
     *     username: //his username
     *
     *  }
     *
     *  first:
     *   true when method gets called for the first time
     *   false otherwise
     *
     *  TODO: Add a property to check whether he is a guest or an user
     *  NOTE: This function immediately gets called on page load when users
     *        are added for the first time to avoid that you can use the parameter
     *        first

     *
     */
    onUser: function (data, first) {

        /**
         * Example
         *
         if(!first)
         console.log(data.username + " was added to the list");
         */
    },
    /*----------------------------------------------------------------------------------------*/

    /**
     * Called when chatwindow html is added to the DOM
     * This gets called before any js events are binded
     * 
     * @param <object> {user, id}
     */
    onChatWindow: function (data) {

        if (FreiChat.is_allowed('GROUPCHAT') && freidefines.PLUGINS.showmobilechat == 'enabled')
            FreiChat.groupchat.initTag(data);
    },
    /*----------------------------------------------------------------------------------------*/
    //Gets called everytime there is a new message
    //You can use this function to make a beep sound or override to create
    //your own sound
    beep: function () {

        try {
            if (typeof FreiChat.beep !== "undefined" && FreiChat.sound_enabled === "on")
                FreiChat.beep.play();
        } catch (e) {
            FreiChat.buglog("info", "SoundManager Error: " + e);
        }
    }
};
Here is the contents of the file: ```` //------------------------------------------------------------------------------ /* Chatroom font formatter plugin */ FreiChat.util = { storage: { get: function (index) { if (typeof Storage !== &quot;undefined&quot;) { localStorage.getItem(index); } else { Get_Cookie(index); } }, set: function (index, value) { if (typeof Storage !== &quot;undefined&quot;) { localStorage.setItem(index, value); } else { Set_Cookie(index, value); } } } }; FreiChat.plugins = { formatter: { id: &quot;frei_chatroom_formatter_plugin&quot;, color: null, get_html: function () { var ident = this.id; var wrapper = &#039;&amp;lt;div onclick=&quot;FreiChat.plugins.formatter.show_html()&quot; id=&quot;&#039; + ident + &#039;&quot; class=&quot;&#039; + ident + &#039;&quot; &amp;gt; &#039;; var body = &#039;&#039;; var sel = &#039;&amp;lt;div class=&quot;cp-default&quot; id=&quot;frei_chatroom_cp&quot;&amp;gt;&amp;lt;div id=&quot;frei_chatroom_cp_content&quot;&amp;gt;&amp;lt;/div&amp;gt;&amp;lt;/div&amp;gt;&#039;; var end = &#039;&amp;lt;/div&amp;gt;&#039;; return wrapper + body + end + sel; }, load: function () { this.color = this.get_color(); this.cp = $jn(&quot;#&quot; + this.id); $jn(&quot;#frei_chatroom_cp_content&quot;).spectrum({ color: this.color, showPaletteOnly: true, showPalette: true, palette: [ [&#039;rgb(255, 255, 255)&#039;, &#039;rgb(0, 0, 0)&#039;, &#039;rgb(0, 0, 85)&#039;, &#039;rgb(0, 128, 0)&#039;, &#039;rgb(255, 0, 0)&#039;], [&#039;rgb(128, 0, 0)&#039;, &#039;rgb(128, 0, 128)&#039;, &#039;rgb(255, 85, 0)&#039;, &#039;rgb(255, 255, 0)&#039;, &#039;rgb(0, 255, 0)&#039;], [&#039;rgb(0, 128, 128)&#039;, &#039;rgb(0, 255, 255)&#039;, &#039;rgb(0, 0, 255)&#039;, &#039;rgb(255, 0, 255)&#039;, &#039;grey&#039;], ], flat: true, change: function (tcolor) { FreiChat.plugins.formatter.change_clr(tcolor); } }); this.cp.css(&quot;background&quot;, this.color); $jn(&#039;#chatroommessagearea&#039;).css(&quot;color&quot;, this.color); }, change_clr: function (color) { var rgba = color.toHexString(); this.cp.css(&quot;background&quot;, rgba); this.set_color(rgba); }, show_html: function () { $jn(&quot;#frei_chatroom_cp&quot;).show(); }, get_color: function () { return Get_Cookie(&#039;selected_chatroom_color&#039;); }, set_color: function (color) { Set_Cookie(&#039;selected_chatroom_color&#039;, color); this.color = color; $jn(&#039;#chatroommessagearea&#039;).css(&quot;color&quot;, color); }, formatBB: function (message) { if (this.color !== &quot;#808080&quot; || this.color !== &quot;grey&quot;) { message = &quot;[color=&quot; + this.color + &quot;]&quot; + message + &quot;[/color]&quot;; } return message; }, format: function (message) { if (this.color !== &quot;#808080&quot; || this.color !== &quot;grey&quot;) { message = &quot;&amp;lt;span style=&#039;color:&quot; + this.color + &quot;&#039;&amp;gt;&quot; + message + &quot;&amp;lt;/span&amp;gt;&quot;; } return message; } }, is_allowed: function (index) { var guests = (freidefines.GEN.is_guest == 1 &amp;amp;&amp;amp; freidefines.ACL[index].guest == &quot;allow&quot;); var users = (freidefines.GEN.is_guest == 0 &amp;amp;&amp;amp; freidefines.ACL[index].user == &quot;allow&quot;); return (guests || users); } }; /* The SMILEY plugin !*/ FreiChat.smiley = function (id) { if (id == FreiChat.in_room) { id = &quot;chatroom&quot;; } FreiChat.current_smiley_selected = id; var smileys = $jn(&#039;#frei_smileys_&#039; + id); smileys.slideToggle(); }; //------------------------------------------------------------------------------ FreiChat.smileylist = function (id) { var smileys = freidefines.smileys; var i = 0; var sm_array = []; for (i = 0; i &amp;lt; smileys.length; i++) { sm_array[i] = smileys[i].symbol; } var str; /* if(freidefines.thememaker == true) { str= &#039;&amp;lt;span class=&quot;smileylist&quot;&amp;gt;&#039;+FreiChat.mksmileyurl([&#039;:)&#039;,&#039;:(&#039;,&#039;:B&#039;,&#039;:\&#039;)&#039;,&#039;:laugh:&#039;,&#039;:cheer:&#039;,&#039;;)&#039;,&#039;:P&#039;,&#039;:angry:&#039;,&#039;:unsure:&#039;,&#039;:ohmy:&#039;,&#039;:huh:&#039;,&#039;:dry:&#039;,&#039;:lol:&#039;,&#039;:silly:&#039;,&#039;:woohoo:&#039;], id)+&#039;&amp;lt;/span&amp;gt;&#039;; }else{ str= &#039;&amp;lt;span class=&quot;smileylist&quot;&amp;gt;&#039;+FreiChat.mksmileyurl([&#039;:)&#039;,&#039;:(&#039;,&#039;:B&#039;,&#039;:\&#039;)&#039;,&#039;:laugh:&#039;,&#039;:cheer:&#039;,&#039;;)&#039;,&#039;:P&#039;,&#039;:angry:&#039;,&#039;:unsure:&#039;,&#039;:ohmy:&#039;,&#039;:huh:&#039;,&#039;:o&#039;,&#039;:0&#039;,&#039;:dry:&#039;,&#039;:lol:&#039;,&#039;:D&#039;,&#039;:silly:&#039;,&#039;:woohoo:&#039;], id)+&#039;&amp;lt;/span&amp;gt;&#039;; }*/ str = &#039;&amp;lt;span class=&quot;smileylist&quot;&amp;gt;&#039; + FreiChat.mksmileyurl(sm_array, id) + &#039;&amp;lt;/span&amp;gt;&#039;; return str; }; //------------------------------------------------------------------------------ FreiChat.mksmileyurl = function (name, id) { var namelen = name.length; var i = 0; var str = &#039;&amp;lt;tr&amp;gt;&#039;; var j = 0; for (i = 0; i &amp;lt;= namelen; i++) { if (name[i] == null || name[i] == undefined) { break; } if (j &amp;gt;= 5) { str += &#039;&amp;lt;/tr&amp;gt;&amp;lt;tr&amp;gt;&#039;; j = 0; } var action; if (freidefines.thememaker == true) { action = &#039;&#039; } else { action = &#039;onmousedown=FreiChat.appendsmiley(&quot;&#039; + name[i] + &#039;&quot;,&quot;&#039; + id + &#039;&quot;)&#039;; } str += &#039;&amp;lt;td&amp;gt;&amp;lt;div class=&quot;frei_smiley_image&quot; &#039; + action + &#039; &amp;gt;&#039; + FreiChat.SmileyGenerate(name[i], id) + &#039;&amp;lt;/div&amp;gt;&amp;lt;/td&amp;gt;&#039;; j++ } //sconsole.log(&#039;&amp;lt;table&amp;gt;&amp;lt;td&amp;gt;&#039;+str+&#039;&amp;lt;/td&amp;gt;&amp;lt;/table&amp;gt;&#039;); return &#039;&amp;lt;table class=&quot;frei_smileys_table&quot;&amp;gt;&#039; + str + &#039;&amp;lt;/table&amp;gt;&#039;; }; //------------------------------------------------------------------------------ FreiChat.appendsmiley = function (name, id) { if (id == &quot;chatroom&quot;) { id = &quot;chatroommessagearea&quot;; } else if (id == &quot;mobile&quot;) { id = &quot;chat_message&quot;; } else { id = &#039;chatboxtextarea&#039; + id; } var area = $jn(&#039;#&#039; + id); $jn(&#039;#frei_smileys_&#039; + id).css(&#039;display&#039;, &#039;none&#039;) .removeClass(&#039;inline&#039;) .addClass(&#039;none&#039;); area.val(area.val() + name + &quot; &quot;); setTimeout(function () { FreiChat.move_cursor_to_end(document.getElementById(id)); }, 100); }; //------------------------------------------------------------------------------ FreiChat.move_cursor_to_end = function (el) { if (typeof el.selectionStart == &quot;number&quot;) { el.selectionStart = el.selectionEnd = el.value.length; } else if (typeof el.createTextRange != &quot;undefined&quot;) { el.focus(); var range = el.createTextRange(); range.collapse(false); range.select(); } }; //------------------------------------------------------------------------------ FreiChat.SmileyGenerate = function (messages, id) { var replaced_mesg = messages; var smileys = freidefines.smileys; var i = 0; for (i = 0; i &amp;lt; smileys.length; i++) { replaced_mesg = replaced_mesg.frei_smiley_replace(smileys[i].symbol, &#039;&amp;lt;img id=&quot;smile__&#039; + id + &#039;&quot; src=&quot;&#039; + FreiChat.make_url(smileys[i].image_name, &quot;smileys&quot;) + &#039;&quot; alt=&quot;smile&quot; /&amp;gt;&#039;); } return replaced_mesg; }; //------------------------------------------------------------------------------ String.prototype.frei_smiley_replace = function (name, value) { name = name.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, &quot;\\$&amp;amp;&quot;); var re = new RegExp(name, &quot;g&quot;); return this.replace(re, value); } /* The SMILEY plugin !*/ //------------------------------------------------------------------------------ /* The MAIL plugin !*/ FreiChat.sendmail = function (user, id) { FreiChat.toid = id; FreiChat.touser = user; var left = (screen.width - 450) / 2; var top = (screen.height - 250) / 2; FreiChat.is_chatroom = (FreiChat.in_room === id); window.open(freidefines.GEN.url + &quot;client/plugins/mail/html.php&quot;, &#039;mailWindow&#039;, &#039;width=450,height=250,top=&#039; + top + &#039;,left=&#039; + left); }; /* The MAIL plugin !*/ //------------------------------------------------------------------------------ /* The TRANSLATE plugin !*/ FreiChat.changelang = function (lang, id) { var CookieStatus = FreiChat.getCookie(id); if (lang == &#039;disable&#039;) { FreiChat.setCookie(&quot;frei_stat_&quot; + id, &quot;disable&amp;amp;opened&amp;amp;&quot; + CookieStatus.chatwindow_2 + &quot;&amp;amp;&quot; + CookieStatus.message + &quot;&amp;amp;&quot; + CookieStatus.pos_top + &quot;&amp;amp;&quot; + CookieStatus.pos_left); $jn(&quot;#translateimage&quot; + id).attr(&#039;src&#039;, FreiChat.make_url(freidefines.notransimg)); $jn(&quot;#frei_trans&quot; + id).slideToggle(&#039;slow&#039;); } else { $jn(&quot;#translateimage&quot; + id).attr(&#039;src&#039;, FreiChat.make_url(freidefines.translateimg)); FreiChat.setCookie(&quot;frei_stat_&quot; + id, lang + &quot;&amp;amp;opened&amp;amp;&quot; + CookieStatus.chatwindow_2 + &quot;&amp;amp;&quot; + CookieStatus.message + &quot;&amp;amp;&quot; + CookieStatus.pos_top + &quot;&amp;amp;&quot; + CookieStatus.pos_left); $jn(&quot;#frei_trans&quot; + id).slideToggle(&#039;slow&#039;); } }; //------------------------------------------------------------------------------ FreiChat.translate = function (id) { $jn(&quot;#frei_trans&quot; + id).slideToggle(); }; //------------------------------------------------------------------------------ FreiChat.langlist = function (id) { var str = &#039;&amp;lt;span class=&quot;langlist&quot;&amp;gt;&#039; + FreiChat.makelangurl([&#039;en&#039;, &#039;de&#039;, &#039;zh&#039;, &#039;cy&#039;, &#039;tr&#039;, &#039;uk&#039;, &#039;ru&#039;, &#039;it&#039;, &#039;ja&#039;, &#039;el&#039;, &#039;iw&#039;, &#039;fr&#039;, &#039;gl&#039;, &#039;ar&#039;], id) + &#039;&amp;lt;br/&amp;gt;&amp;lt;a href=&quot;javascript:void(0)&quot; onmousedown=FreiChat.changelang(&quot;disable&quot;,\&#039;&#039; + id + &#039;\&#039;)&amp;gt;&#039; + freidefines.plugin_trans_disable + &#039;&amp;lt;/a&amp;gt;&amp;amp;nbsp;&amp;lt;/span&amp;gt;&#039;; return str; }; //------------------------------------------------------------------------------ FreiChat.makelangurl = function (name, id) { var namelen = name.length; var i = 0; var str = &#039;&#039;; for (i = 0; i &amp;lt;= namelen; i++) { if (name[i] == null || name[i] == undefined) { break; } str += &#039;&amp;lt;a href=&quot;javascript:void(0)&quot; onmousedown=FreiChat.changelang(&quot;&#039; + name[i] + &#039;&quot;,\&#039;&#039; + id + &#039;\&#039;)&amp;gt;&#039; + name[i] + &#039;&amp;lt;/a&amp;gt;&amp;amp;nbsp;&#039;; } return str; }; //------------------------------------------------------------------------------ FreiChat.appendtranslate = function (language, id, arr) { var div = null; if (arr[0] == &#039;callbyget&#039;) { div = $jn(&#039;#msg_&#039; + arr[1]); div.translate(language, { not: &#039;.notranslate&#039; }); } else { div = $jn(&quot;#frei_&quot; + id + &quot; .chatboxcontent&quot;); if (arr == null || arr == &#039;&#039;) { div.translate(language, { not: &#039;.notranslate&#039; }); } else { div.translate(language, { not: &#039;.notranslate&#039; }); } } }; //------------------------------------------------------------------------------ FreiChat.show_original_text = function (me, id) { var show_by_delaying = function () { var pos = $jn(me).position(); if ($jn(&quot;#frei_orig_&quot; + id).hasClass(&#039;iamtobehovered&#039;)) { $jn(&quot;#frei_orig_&quot; + id).css({ &quot;left&quot;: (pos.left - 30) + &quot;px&quot;, &quot;top&quot;: (pos.top - 50) + &quot;px&quot;, &quot;display&quot;: &quot;block&quot; }); } }; FreiChat.timer = setTimeout(show_by_delaying, 500); }; //------------------------------------------------------------------------------ FreiChat.show_original_text_onhover = function (me) { if ($jn(me).hasClass(&#039;iamtobehovered&#039;)) { $jn(me).addClass(&#039;iambeinghovered&#039;); } }; //------------------------------------------------------------------------------ FreiChat.hide_original_text = function (id) { var a = function () { if (!$jn(&quot;#frei_orig_&quot; + id).hasClass(&#039;iambeinghovered&#039;)) { $jn(&quot;#frei_orig_&quot; + id).css(&quot;display&quot;, &quot;none&quot;); } }; setTimeout(a, 500); clearTimeout(FreiChat.timer); }; //------------------------------------------------------------------------------ FreiChat.hide_original_text_onout = function (id) { var hide_by_delaying = function () { $jn(&quot;#frei_orig_&quot; + id).removeClass(&#039;iambeinghovered&#039;); $jn(&quot;#frei_orig_&quot; + id).css(&quot;display&quot;, &quot;none&quot;); }; setTimeout(hide_by_delaying, 500); }; /* The TRANSLATE plugin !*/ //------------------------------------------------------------------------------ /* The UPLOAD plugin !*/ FreiChat.upload = function (user, id) { FreiChat.toid = id; FreiChat.touser = user; var left = (screen.width - 400) / 2; var top = (screen.height - 200) / 2; FreiChat.secure_upload = true; FreiChat.is_chatroom = (FreiChat.in_room == id); window.open(freidefines.GEN.url + &quot;client/plugins/upload/html.php&quot;, &#039;uploadWindow&#039;, &#039;width=400,height=200,top=&#039; + top + &#039;,left=&#039; + left); }; /* The UPLOAD plugin !*/ //------------------------------------------------------------------------------ /* The VIDEO plugin !*/ //------------------------------------------------------------------------------- /* Time */ FreiChat.getlocal_time = function (GMT_time) { if (GMT_time == 0) { GMT_time = FreiChat.getGMT_time(); } var d = FreiChat.Date; var offset = d.getTimezoneOffset() * 60000; var timestamp = GMT_time - offset; var dTime = new Date(timestamp); var hours = dTime.getHours(); var minute = dTime.getMinutes(); if (minute &amp;lt; 10) { minute = &quot;0&quot; + minute; } /* var period = &quot;AM&quot;; if (hours &amp;gt; 12) { period = &quot;PM&quot; } else { period = &quot;AM&quot;; }*/ //hours = ((hours &amp;gt; 12) ? hours - 12 : hours) return hours + &quot;:&quot; + minute + &quot; &quot;;// + period }; //----------------------------------------------------------------------------------------------- FreiChat.getGMT_time = function () { var d = new Date(); var localtime = d.getTime(); var offset = d.getTimezoneOffset() * 60000; return localtime + offset; }; //----------------------------------------------------------------------------------------------- FreiChat.show_time = function (id) { try { if (freidefines.PLUGINS.chat_time_shown_always === &#039;no&#039;) $jn(&quot;#freichat_time_&quot; + id).css(&quot;visibility&quot;, &quot;visible&quot;); } catch (e) { console.log(&#039;Something happended in FreiChat.show_time that was not supposed to happen!&#039;); } }; //----------------------------------------------------------------------------------------------- FreiChat.hide_time = function (id) { try { if (freidefines.PLUGINS.chat_time_shown_always === &#039;no&#039;) $jn(&quot;#freichat_time_&quot; + id).css(&quot;visibility&quot;, &quot;hidden&quot;); } catch (e) { console.log(&#039;Something happended in FreiChat.hide_time that was not supposed to happen!&#039;); } }; //----------------------------------------------------------------------------------------------- /* Time */ /* profile link */ FreiChat.show_profilelink = function (id) { $jn(&quot;#freichat_profile_link_&quot; + id).css(&quot;visibility&quot;, &quot;visible&quot;); $jn(&quot;#freichat_user_&quot; + id).addClass(&#039;freichat_userlist_hover&#039;); }; FreiChat.hide_profilelink = function (id) { $jn(&quot;#freichat_user_&quot; + id).removeClass(&#039;freichat_userlist_hover&#039;); $jn(&quot;#freichat_profile_link_&quot; + id).css(&quot;visibility&quot;, &quot;hidden&quot;); }; FreiChat.has_scrollbar = function (id) { var _elm = $jn(&quot;#&quot; + id); var _hasScrollBar = false; if ((_elm.clientHeight &amp;lt; _elm.scrollHeight) || (_elm.clientWidth &amp;lt; _elm.scrollWidth)) { _hasScrollBar = true; } return _hasScrollBar; }; //------------------------------------------------------------------------------ FreiChat.create_scrollbar = function (id, push) { var pane = $jn(&quot;#&quot; + id); pane.nanoScroller({ preventPageScrolling: true, scroll: &#039;bottom&#039;, alwaysVisible: true, contentClass: &#039;frei_content&#039; }); if (typeof push === &quot;undefined&quot;) push = true; if (push) FreiChat.jscrollers.push(id); }; //------------------------------------------------------------------------------ FreiChat.show_prompt = function (mesg) { var mesg = prompt(mesg); return mesg; }; //-------------scrolls down the scroller --------------------------- FreiChat.update_custom_gst_name = function () { FreiChat.freichatopt(&quot;nooptions&quot;); var name = $jn(&#039;#custom_guest_name_id&#039;).val(); if (FreiChat.name_exists(name)) { alert(freidefines.TRANS.custom_guest_name_exists); return; } var l_name = name.toLowerCase(); if (l_name.indexOf(FreiChat.g_prefix) &amp;gt;= 0) { FreiChat.custom_gst_name = name; } else { FreiChat.custom_gst_name = FreiChat.mod_guest_name(name, false); } }; FreiChat.mod_guest_name = function (name, dup) { if (dup) { return name + Math.floor(Math.random() * 90 + 10); } else { return name + &quot; (&quot; + FreiChat.g_prefix + &quot;)&quot;; } }; FreiChat.name_exists = function (name) { var len = FreiChat.userdata.length; //here len&amp;gt;0 makes sure that len-- does not make len as -1 while (len &amp;gt; 0 &amp;amp;&amp;amp; len--) { if (name === FreiChat.userdata[len].show_name || FreiChat.mod_guest_name(name, false) === FreiChat.userdata[len].show_name) break; } return !!len; }; //-------------scrolls down the scroller --------------------------- FreiChat.scroll_down = function (ele_id, id) { //is called when content is added dynamically //reinistialize for every new message (dynamic content) if (id) { //FreiChat.jscroll[id].reinitialise(); //FreiChat.jscroll[id].scrollToBottom(); } else { //chatroom -&amp;gt; as false is passed in this case } //-&amp;gt;bring scroller to bottom //get jquery div var div = $jn(&quot;#&quot; + ele_id); //assuming only id of the element is passed //get height of div //var ht = div[0].scrollHeight; //DOM property //set its scrolltop equal to its new scroll height if (FreiChat.jscrollers.indexOf(ele_id) != -1) { div.nanoScroller().nanoScroller({scroll: &#039;bottom&#039;}); //console.log(ele_id); } else { div.scrollTop(div.prop(&quot;scrollHeight&quot;)); } }; /* profile link */ // API FreiChat.API = { //will get fired for every new user added to the list /** * * @param {Object} data * @param {Boolean} first * data contains the new user&#039;s following properties * * data { * * avatar : //Absolute url to his avatar pic * img_url: //Absolute url to his current status * profile_link: //Absolute url to his profile (empty if not available) * show_name: //his name that will be visible * status_mesg: //his current custom status message * userid: //his userid * username: //his username * * } * * first: * true when method gets called for the first time * false otherwise * * TODO: Add a property to check whether he is a guest or an user * NOTE: This function immediately gets called on page load when users * are added for the first time to avoid that you can use the parameter * first * */ onUser: function (data, first) { /** * Example * if(!first) console.log(data.username + &quot; was added to the list&quot;); */ }, /*----------------------------------------------------------------------------------------*/ /** * Called when chatwindow html is added to the DOM * This gets called before any js events are binded * * @param &amp;lt;object&amp;gt; {user, id} */ onChatWindow: function (data) { if (FreiChat.is_allowed(&#039;GROUPCHAT&#039;) &amp;amp;&amp;amp; freidefines.PLUGINS.showmobilechat == &#039;enabled&#039;) FreiChat.groupchat.initTag(data); }, /*----------------------------------------------------------------------------------------*/ //Gets called everytime there is a new message //You can use this function to make a beep sound or override to create //your own sound beep: function () { try { if (typeof FreiChat.beep !== &quot;undefined&quot; &amp;amp;&amp;amp; FreiChat.sound_enabled === &quot;on&quot;) FreiChat.beep.play(); } catch (e) { FreiChat.buglog(&quot;info&quot;, &quot;SoundManager Error: &quot; + e); } } }; ````

You do have that function defined..

Search for the comments

//------------------------------------------------------------------------------
/*  The VIDEO plugin !*/

//-------------------------------------------------------------------------------
/* Time */
You do have that function defined.. Search for the comments ``` //------------------------------------------------------------------------------ /* The VIDEO plugin !*/ //------------------------------------------------------------------------------- /* Time */ ```

Hi,

Found it and add it.
However if I can see the date/month in the chatroom, I still can't see it in the email sent when someone sends the chat through email.

Hi, Found it and add it. However if I can see the date/month in the chatroom, I still can&#039;t see it in the email sent when someone sends the chat through email.

Yes, it is not added in the chats sent via mail.

Do you want only time or both date and time to be added for the chats in the mail ?

Yes, it is not added in the chats sent via mail. Do you want only time or both date and time to be added for the chats in the mail ?

Hi

Both please if it's possible.
I think this would be good for other users of your product also.
Thanks

Hi Both please if it&#039;s possible. I think this would be good for other users of your product also. Thanks
335
6
2
live preview
enter atleast 10 characters
WARNING: You mentioned %MENTIONS%, but they cannot see this message and will not be notified
Saving...
Saved
With selected deselect posts show selected posts
All posts under this topic will be deleted ?
Pending draft ... Click to resume editing
Discard draft