<commit_before>// // Place all the behaviors and hooks related to the matching controller here.
// // All this logic will automatically be available in application.js.
var ready = function() {
  $(".reply-button").hide();

  $(".reply-content").focus(function() {
    $(this).siblings(".reply-button").fadeIn("fast");
    var container = $(this);
    hideReplyContainer(container);
  });

  $(".reply-content").focusout(function() {
  	$(this).siblings(".reply-button").fadeOut("fast");
  });

  function hideReplyContainer(container) {
    $(document).mouseup(function(e) {
      var input = container.val().length;
      console.log(container.val().length);
      if (!container.is(e.target) && container.has(e.target).length === 0 && input === 0) {
          container.siblings(".reply-button").hide();
      }
    });
  }
}

$(document).ready(ready);
$(document).on("page:load", ready);
<commit_msg>Add refresh for each reply<commit_after>// // Place all the behaviors and hooks related to the matching controller here.
// // All this logic will automatically be available in application.js.
var ready = function() {
  $(".reply-button").hide();

  $(".reply-content").focus(function() {
    $(this).siblings(".reply-button").fadeIn("fast");
    var container = $(this);
    hideReplyContainer(container);
  });

  $(".reply-content").focusout(function() {
  	$(this).siblings(".reply-button").fadeOut("fast");
  });

  function hideReplyContainer(container) {
    $(document).mouseup(function(e) {
      var input = container.val().length;
      console.log(container.val().length);
      if (!container.is(e.target) && container.has(e.target).length === 0 && input === 0) {
          container.siblings(".reply-button").hide();
      }
    });
  }

  $(".reply-button").click(function() {
    // Refresh page for each reply until this gets more AJAX-y
    if ($(this).siblings(".reply-content").val().length > 0) {
      location.reload();
    }
  });
}

$(document).ready(ready);
$(document).on("page:load", ready);

{'fraction_non_alphanumeric': 0.20019772614928324, 'fraction_numerical': 0.002471576866040534, 'mean_word_length': 3.527964205816555, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 4, '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': '6253788', 'n_tokens_mistral': 614, 'n_tokens_neox': 595, 'n_words': 121}