Real Time Comments - Comment Edit

Real time comments is working very well; the page jump issue was due to having animation enabled.  There is only one problem I am experiencing; when a member goes to edit a comment they have left, the refresh interrupts the edit closing the edit box.  The refresh does not bother anything else; one can leave a replay to the comment without issue.  It is only when one wishes to edit a previous comment.  Is there some help you can provide to solve this issue?

Geeks, making the world a better place
Quote · 20 Jan 2018

As I remember the code I've provided in the past for the real-time comments take this situation into account. As the result, the block shouldn't refresh when someone is posting a reply. It should work with edit box as well, but if not, please post your code here and I will try to help to modify it to work with edit boxes as well.

Rules → http://www.boonex.com/terms
Quote · 23 Jan 2018

OK, maybe we can look at this before support ends.  I added a pause to the live comments.

The code I am using is this in the template file cmts_main.html :

<script>
$(document).ready(function(){
 start_comments();
});

var interval;
var a = '__html_id__'.split("-", 2);
var sCmtsClassName = 'oCmts' + a[0].charAt(0).toUpperCase() + a[0].slice(1) + a[1];

function start_comments()
{
 document.getElementById( "pausecomments" ).setAttribute( "onClick", "pause_comments();" );
 document.getElementById( "pausecomments" ).setAttribute( "value", "Pause Live Comments" );
 
 interval=setInterval(function(){
  if ($('#cmts-box-__html_id__ form:visible > input[name=CmtParent][value=0]') && (!$('#cmts-box-__html_id__ .cmt-text-post').size() || !$('#cmts-box-__html_id__ .cmt-text-post').val().length) && !$('#cmts-box-__html_id__ form:visible > input[name=CmtParent]:not([value=0])').size())
  window[sCmtsClassName]._getCmts($('a[name=cmta-__html_id__]'), 0, function () {});
  }, 20000);
}

function pause_comments()
{
 clearInterval(interval);
 document.getElementById( "pausecomments" ).setAttribute( "onClick", "start_comments();" );
 document.getElementById( "pausecomments" ).setAttribute( "value", "Start Live Comments" );
}
</script> 

and in BxDolCmts.js

 

// get comment replies via ajax request
BxDolCmts.prototype._getCmts = function (e, iCmtParentId, onLoad, iStart, iPerPage)
{
    var $this = this;
    var oData = this._getDefaultActions();
    oData['action'] = 'CmtsGet';
    oData['CmtParent'] = iCmtParentId;   
    oData['CmtOrder'] = this._sOrder;
    if(iStart) {
        oData['CmtStart'] = iStart;
        $this._iStartLast = iStart;
    } else if ($this._iStartLast) {
        oData['CmtStart'] = $this._iStartLast;
    }
    if(iPerPage) {
        oData['CmtPerPage'] = iPerPage;
        $this._iPerPageLast = iPerPage;
    } else if ($this._iPerPageLast) {
        oData['CmtPerPage'] = $this._iPerPageLast;
    }

    if(e)
        this._loading (e, true);

    jQuery.post (
        this._sActionsUrl,       
        oData,
        function(s) {
            if(iCmtParentId == 0) {
                $('#cmts-box-' + $this._sSystem + '-' + $this._iObjId + ' .cmts > ul').bxdolcmtanim('hide', $this._sAnimationEffect, $this._iAnimationSpeed, function() {
                    $(this).replaceWith(s).bxdolcmtanim('show', $this._sAnimationEffect, $this._iAnimationSpeed);
                });
            }
            else
                $('#cmt' + iCmtParentId).append($(s).filter('.cmts').addClass('cmts-margin').hide()).children('.cmts').bxdolcmtanim('show', $this._sAnimationEffect, $this._iAnimationSpeed);
            onLoad();
            $this._loading (e, false);
        }
    );
};

 

BxDolCmts.prototype.cmtEdit = function(e, iCmtId) {   
    var $this = this;
    var oData = this._getDefaultActions();
    oData['action'] = 'CmtEdit';
    oData['Cmt'] = iCmtId;

    if ($('#cmt' + iCmtId + ' .cmt-body > form').length) {
        $('#cmt' + iCmtId + ' .cmt-body').bxdolcmtanim(
            'hide',
            $this._sAnimationEffect,
            $this._iAnimationSpeed,
            function() {
                $(this).html($this._oSavedTexts[iCmtId]).bxdolcmtanim('show', $this._sAnimationEffect, $this._iAnimationSpeed);
            });
        return;
    }
    else
        this._oSavedTexts[iCmtId] = $('#cmt' + iCmtId + ' .cmt-body').html();
   
    jQuery.post (
        this._sActionsUrl,
        oData,
        function (s) {                               
           
            if ('err' == s.substring(0,3))
                alert (s.substring(3));
            else
                $('#cmt' + iCmtId + ' .cmt-body').bxdolcmtanim(
                    'hide',
                    $this._sAnimationEffect,
                    $this._iAnimationSpeed,
                    function() {
                        $(this).html(s).find('[name = CmtMood][value=' + $.trim($('#cmt' + iCmtId + ' .cmt-mood').html()) + ']').attr('checked', 'checked');
                        $(this).bxdolcmtanim('show', $this._sAnimationEffect, $this._iAnimationSpeed, function() {
                            if($this._iGlobAllowHtml == 1)
                                $this.createEditor(iCmtId, $('#cmt' + iCmtId + ' .cmt-body > form').find('[name=CmtText][tinypossible=true]'));
                        });
                    });
        }
    );
};

Geeks, making the world a better place
Quote · 20 Jul 2018
 
 
Below is the legacy version of the Boonex site, maintained for Dolphin.Pro 7.x support.
The new Dolphin solution is powered by UNA Community Management System.