<commit_before>jQuery('.display-comment-form').unbind();
jQuery('.display-comment-form').click(function(){
  var $button = jQuery(this);
  toggleBox($button.parents('.post_comment_box'));
  jQuery('.display-comment-form').hide();
  $button.closest('.page-comment-form').find('input').first().focus();
  return false;
});

jQuery('#cancel-comment').die();
jQuery('#cancel-comment').live("click", function(){
  var $button = jQuery(this);
  toggleBox($button.parents('.post_comment_box'));
  show_display_comment_button();
  var page_comment_form = $button.parents('.page-comment-form');
  page_comment_form.find('.errorExplanation').remove();
  return false;
});

function toggleBox(div){
  if(div.hasClass('opened')) {
    div.removeClass('opened');
    div.addClass('closed');
  } else {
    div.removeClass('closed');
    div.addClass('opened');
  }
}

function save_comment(button) {
  var $ = jQuery;
  open_loading(DEFAULT_LOADING_MESSAGE);
  var $button = $(button);
  var form = $button.parents("form");
  var post_comment_box = $button.parents('.post_comment_box');
  var comment_div = $button.parents('.comments');
  var page_comment_form = $button.parents('.page-comment-form');
  $button.addClass('comment-button-loading');
  $.post(form.attr("action"), form.serialize(), function(data) {

    if(data.render_target == null) {
      //Comment for approval
      form.find("input[type='text']").add('textarea').each(function() {
        this.value = '';
      });
      page_comment_form.find('.errorExplanation').remove();
      show_display_comment_button();
    } else if(data.render_target == 'form') {
      //Comment with errors
      $.scrollTo(page_comment_form);
      page_comment_form.html(data.html);
      $('.display-comment-form').hide();
    } else if($('#' + data.render_target).size() > 0) {
      //Comment of reply
      $('#'+ data.render_target).replaceWith(data.html);
      $('#' + data.render_target).effect("highlight", {}, 3000);
      $.colorbox.close();
      show_display_comment_button();
    } else {
      //New comment of article
      comment_div.find('.article-comments-list').append(data.html);

      form.find("input[type='text']").add('textarea').each(function() {
        this.value = '';
      });

      page_comment_form.find('.errorExplanation').remove();
      $.colorbox.close();
      show_display_comment_button();
    }

    comment_div.find('.comment-count').add('#article-header .comment-count').each(function() {
      var count = parseInt($(this).html());
      update_comment_count($(this), count + 1);
    });

    if(jQuery('#recaptcha_response_field').val()){
      Recaptcha.reload();
    }

    if(data.msg != null) {
       display_notice(data.msg);
    }

    close_loading();
    toggleBox($button.closest('.post_comment_box'));
    $button.removeClass('comment-button-loading');
    $button.enable();
  }, 'json');
}

function show_display_comment_button() {
  if(jQuery('.post_comment_box.opened').length==0)
    jQuery('.display-comment-form').show();
}
<commit_msg>display send a comment button after reply a comment<commit_after>jQuery('.display-comment-form').unbind();
jQuery('.display-comment-form').click(function(){
  var $button = jQuery(this);
  toggleBox($button.parents('.post_comment_box'));
  jQuery('.display-comment-form').hide();
  $button.closest('.page-comment-form').find('input').first().focus();
  return false;
});

jQuery('#cancel-comment').die();
jQuery('#cancel-comment').live("click", function(){
  var $button = jQuery(this);
  toggleBox($button.parents('.post_comment_box'));
  show_display_comment_button();
  var page_comment_form = $button.parents('.page-comment-form');
  page_comment_form.find('.errorExplanation').remove();
  return false;
});

function toggleBox(div){
  if(div.hasClass('opened')) {
    div.removeClass('opened');
    div.addClass('closed');
  } else {
    div.removeClass('closed');
    div.addClass('opened');
  }
}

function save_comment(button) {
  var $ = jQuery;
  open_loading(DEFAULT_LOADING_MESSAGE);
  var $button = $(button);
  var form = $button.parents("form");
  var post_comment_box = $button.parents('.post_comment_box');
  var comment_div = $button.parents('.comments');
  var page_comment_form = $button.parents('.page-comment-form');
  $button.addClass('comment-button-loading');
  $.post(form.attr("action"), form.serialize(), function(data) {

    if(data.render_target == null) {
      //Comment for approval
      form.find("input[type='text']").add('textarea').each(function() {
        this.value = '';
      });
      page_comment_form.find('.errorExplanation').remove();
      show_display_comment_button();
    } else if(data.render_target == 'form') {
      //Comment with errors
      $.scrollTo(page_comment_form);
      page_comment_form.html(data.html);
      $('.display-comment-form').hide();
    } else if($('#' + data.render_target).size() > 0) {
      //Comment of reply
      $('#'+ data.render_target).replaceWith(data.html);
      $('#' + data.render_target).effect("highlight", {}, 3000);
      $.colorbox.close();
      show_display_comment_button();
    } else {
      //New comment of article
      comment_div.find('.article-comments-list').append(data.html);

      form.find("input[type='text']").add('textarea').each(function() {
        this.value = '';
      });

      page_comment_form.find('.errorExplanation').remove();
      $.colorbox.close();
      show_display_comment_button();
    }

    comment_div.find('.comment-count').add('#article-header .comment-count').each(function() {
      var count = parseInt($(this).html());
      update_comment_count($(this), count + 1);
    });

    if(jQuery('#recaptcha_response_field').val()){
      Recaptcha.reload();
    }

    if(data.msg != null) {
       display_notice(data.msg);
    }

    close_loading();
    toggleBox($button.closest('.post_comment_box'));
    $button.removeClass('comment-button-loading');
    $button.enable();
  }, 'json');
}

function show_display_comment_button() {
    jQuery('.display-comment-form').show();
}

{'fraction_non_alphanumeric': 0.19387250864766925, 'fraction_numerical': 0.0021413276231263384, 'mean_word_length': 3.964840556009812, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2212684', 'n_tokens_mistral': 1878, 'n_tokens_neox': 1844, 'n_words': 245}