• nitrous26

    (@nitrous26)


    This is really a great, lightweight chat plugin and it deserves more credit. I’ve modified it a bit to suit my site’s needs and I’ll share a couple of fixes.

    Autoscrolling the box was built in, but broke with newer versions of wordpress with jquery 1.6 and above. To fix this, edit the /javascript/wp_jschat.js file and change line 29 to:
    t.find('.wp_jschat_widget_text').prop({scrollTop: t.find('.wp_jschat_widget_text').prop('scrollHeight')});
    the “attr” tag is depreciated and “prop” replaces the functionality.

    To make it really fancy, you can stick in the animate function to make it slowly scroll and look like you paid money for the plugin or something by replacing line 29 with this:
    t.find('.wp_jschat_widget_text').animate({scrollTop: t.find('.wp_jschat_widget_text').prop('scrollHeight')}, 3000);

    To add in a time and date(just as part of the message, not grabbing from the db… cause I’m lazy), change the submit function on about line 49-78 to this:

    [Code moderated as per the Forum Rules. Please use the pastebin]

    Hope this helps…

    https://www.ads-software.com/extend/plugins/javascript-chat-for-wordpress/

Viewing 1 replies (of 1 total)
  • Thread Starter nitrous26

    (@nitrous26)

    …Too many lines of code, it got moderated out. Here’s the date code again.

    In the submit function after these lines:

    jQuery('.wp_jschat_widget_form').submit(function(){
            var t = jQuery(this);
            var obj = {};

    add this:

    var currentDate = new Date();var day = currentDate.getDate();var month = currentDate.getMonth() + 1;var year = currentDate.getFullYear();var hours = currentDate.getHours();var minutes = currentDate.getMinutes();
    if(minutes<10){	obj.wp_jschat_text = ' '+month+'/'+day+'/'+year+' '+hours+":0"+minutes+' : '+t.find('.wp_jschat_text').val(); }
    else{ obj.wp_jschat_text = ' '+month+'/'+day+'/'+year+' '+hours+":"+minutes+' : '+t.find('.wp_jschat_text').val(); }

    and delete this line:
    obj.wp_jschat_text = t.find('.wp_jschat_text').val();

Viewing 1 replies (of 1 total)
  • The topic ‘[Plugin: Javascript Chat for WordPress] Javascript Chat Plutin Fixes (autoscroll, date/time)’ is closed to new replies.