<commit_before>jQuery(document).ready(function($) {
  if (jQuery().jquery < '1.8.0') {
    var error = 'ActiveScaffold requires jquery 1.8.0 or greater, please use jquery-rails 2.1.x gem or greater';
    if (typeof console != 'undefined') console.error(error);
    else alert(error);
  }

  jQuery(document).on('focus', function() { ActiveScaffold.last_focus = this; });
  jQuery(document).click(function(event) {
    jQuery('.action_group.dyn ul').remove();
  });
  jQuery(document).on('ajax:complete', '.action_group.dyn ul a', function(event) {
    var action_link = ActiveScaffold.find_action_link(event.target);
    if (action_link.loading_indicator) action_link.loading_indicator.css('visibility','hidden');  
    jQuery(event.target).closest('.action_group.dyn ul').remove();
  });
  jQuery(document).on('ajax:beforeSend', 'form.as_form', function(event) {
    var as_form = jQuery(this).closest("form");
    if (as_form.data('loading') == true) {
      ActiveScaffold.disable_form(as_form);
    }
    return true;
  });
  
  jQuery(document).on('ajax:complete', 'form.as_form', function(event) {
    var as_form = jQuery(this).closest("form");
    if (as_form.data('loading') == true) {
      ActiveScaffold.enable_form(as_form);
    }
  });
  jQuery(document).on('ajax:error', 'form.as_form', function(event, xhr, status, error) {
    var as_div = jQuery(this).closest("div.active-scaffold");
    if (as_div.length) {
      ActiveScaffold.report_500_response(as_div, xhr);<commit_msg>fix Keep focus on last field<commit_after>jQuery(document).ready(function($) {
  if (jQuery().jquery < '1.8.0') {
    var error = 'ActiveScaffold requires jquery 1.8.0 or greater, please use jquery-rails 2.1.x gem or greater';
    if (typeof console != 'undefined') console.error(error);
    else alert(error);
  }

  jQuery(document).on('focus', ':input', function() { ActiveScaffold.last_focus = this; });
  jQuery(document).click(function(event) {
    jQuery('.action_group.dyn ul').remove();
  });
  jQuery(document).on('ajax:complete', '.action_group.dyn ul a', function(event) {
    var action_link = ActiveScaffold.find_action_link(event.target);
    if (action_link.loading_indicator) action_link.loading_indicator.css('visibility','hidden');  
    jQuery(event.target).closest('.action_group.dyn ul').remove();
  });
  jQuery(document).on('ajax:beforeSend', 'form.as_form', function(event) {
    var as_form = jQuery(this).closest("form");
    if (as_form.data('loading') == true) {
      ActiveScaffold.disable_form(as_form);
    }
    return true;
  });
  
  jQuery(document).on('ajax:complete', 'form.as_form', function(event) {
    var as_form = jQuery(this).closest("form");
    if (as_form.data('loading') == true) {
      ActiveScaffold.enable_form(as_form);
    }
  });
  jQuery(document).on('ajax:error', 'form.as_form', function(event, xhr, status, error) {
    var as_div = jQuery(this).closest("div.active-scaffold");
    if (as_div.length) {
      ActiveScaffold.report_500_response(as_div, xhr);
{'fraction_non_alphanumeric': 0.17203586848223182, 'fraction_numerical': 0.0073065426768515445, 'mean_word_length': 4.567467652495379, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 3, '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': '5030981', 'n_tokens_mistral': 1016, 'n_tokens_neox': 996, 'n_words': 167}