<commit_before><% if @check_message > 1 %>
	$(".registered_items").val("<%= @new_value %>");
	$("#field2 .check").html("<img src='/assets/admin/ok.png'>");
<% else %>
	alert("Produto indisponível!");
	$("#field2 .check").html("<img src='/assets/admin/not.png'>");
<% end %>

<% if @new_image %>
  $("#show-last-item").html("<img src='<%= @new_image %>' />");
<% else %>
  message = "<h1 style='text-align:center;margin-top:150px;font-size:3em;'>";
  message += "SEM IMAGEM<br />";
  message += "<span class='green'><%= @last_entry %></span>";
  <% if @check_message == 3 %>
    message += "<br /><span style='font-size:0.5em'>Item não cadastrado</span>";
  <% end %>
  message += "</h1>";
  $("#show-last-item").html(message);
<% end %>


setTimeout(function() {
  $("#stock_items").val("<%= @new_value %>");
  $("#stock_items").focus();
}, 0);<commit_msg>fix focus textarea<commit_after><% if @check_message > 1 %>
	$(".registered_items").val("<%= @new_value %>");
	$("#field2 .check").html("<img src='/assets/admin/ok.png'>");
<% else %>
	alert("Produto indisponível!");
	$("#field2 .check").html("<img src='/assets/admin/not.png'>");
<% end %>

<% if @new_image %>
  $("#show-last-item").html("<img src='<%= @new_image %>' />");
<% else %>
  message = "<h1 style='text-align:center;margin-top:150px;font-size:3em;'>";
  message += "SEM IMAGEM<br />";
  message += "<span class='green'><%= @last_entry %></span>";
  <% if @check_message == 3 %>
    message += "<br /><span style='font-size:0.5em'>Item não cadastrado</span>";
  <% end %>
  message += "</h1>";
  $("#show-last-item").html(message);
<% end %>

// http://stackoverflow.com/questions/6003300/how-to-place-cursor-at-end-of-text-in-textarea-when-tabbed-into
function focusEndOfTextarea(el) {
  if (typeof el.selectionStart == "number") {
    el.selectionStart = el.selectionEnd = el.value.length;
  } else if (typeof el.createTextRange != "undefined") {
    el.focus();
    var range = el.createTextRange();
    range.collapse(false);
    range.select();
  }
}

setTimeout(function() {
  $("#stock_items").val("<%= @new_value %>");
  var textarea = document.getElementById("stock_items");
  focusEndOfTextarea(textarea);
}, 1);
{'fraction_non_alphanumeric': 0.2634703196347032, 'fraction_numerical': 0.015068493150684932, 'mean_word_length': 4.676165803108808, 'pattern_counts': {'":': 0, '<': 49, '<?xml version=': 0, '>': 51, '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': '5101853', 'n_tokens_mistral': 839, 'n_tokens_neox': 779, 'n_words': 129}