wire/modules/Fieldtype/FieldtypeComments/comments.js
/**
 * Event handler for reply button click in threaded comments
 * 
 */
Event handler for reply button click in threaded comments
Event handler for reply button click in threaded comments
function CommentActionReplyClick() {
	var $this = jQuery(this);
	var $item = $this.closest('.CommentListItem');
	var $form = $this.parent().next('form.CommentForm');
	var commentID = $item.attr('data-comment');
	if($form.length == 0) {
		$form = $item.find('.CommentForm' + commentID);
	}
	if($form.length == 0) {
		$form = jQuery('#CommentForm form').clone().removeAttr('id');
		$form.addClass('CommentForm' + commentID);
		$form.hide().find('.CommentFormParent').val(commentID);
		var $formPlaceholder = $item.find('form:not(.CommentFormReply):eq(0)');
		if($formPlaceholder.length) {
			$formPlaceholder.replaceWith($form);
		} else {
			$this.parent().after($form);
		}
		$form.addClass('CommentFormReply');
		if($form.is('form[hidden]')) {
			$form.removeAttr('hidden');
		} else if(!$form.is(':visible')) {
			$form.slideDown();
		}
		$form.trigger('CommentFormReplyAdd');
		$form.trigger('CommentFormReplyShow');
	} else if(!$form.is(':visible')) {
		$form.slideDown();
		$form.trigger('CommentFormReplyShow');
	} else {
		$form.slideUp();
		$form.trigger('CommentFormReplyHide');
	}
	return false;
}
function CommentActionReplyClick ( ) { var $this = jQuery ( this ) ; var $item = $this . closest ( '.CommentListItem' ) ; var $form = $this . parent ( ) . next ( 'form.CommentForm' ) ; var commentID = $item . attr ( 'data-comment' ) ; if ( $form . length == 0 ) { $form = $item . find ( '.CommentForm' + commentID ) ; } if ( $form . length == 0 ) { $form = jQuery ( '#CommentForm form' ) . clone ( ) . removeAttr ( 'id' ) ; $form . addClass ( 'CommentForm' + commentID ) ; $form . hide ( ) . find ( '.CommentFormParent' ) . val ( commentID ) ; var $formPlaceholder = $item . find ( 'form:not(.CommentFormReply):eq(0)' ) ; if ( $formPlaceholder . length ) { $formPlaceholder . replaceWith ( $form ) ; } else { $this . parent ( ) . after ( $form ) ; } $form . addClass ( 'CommentFormReply' ) ; if ( $form . is ( 'form[hidden]' ) ) { $form . removeAttr ( 'hidden' ) ; } else if ( ! $form . is ( ':visible' ) ) { $form . slideDown ( ) ; } $form . trigger ( 'CommentFormReplyAdd' ) ; $form . trigger ( 'CommentFormReplyShow' ) ; } else if ( ! $form . is ( ':visible' ) ) { $form . slideDown ( ) ; $form . trigger ( 'CommentFormReplyShow' ) ; } else { $form . slideUp ( ) ; $form . trigger ( 'CommentFormReplyHide' ) ; } return false ; }
Event handler for reply button click in threaded comments
Event handler for reply button click in threaded comments
// if form is not parent's next item, see if we can // find it wthin the .CommentListItem somewhere // form does not yet exist for this reply // clone the main CommentForm // use existing <form></form> placed in there as optional target for reply form