<commit_before>const onDOMReady = function() {
  //
  // Use ActiveAdmin.modal_dialog to prompt user if
  // confirmation is required for current Batch Action
  //
  $('.batch_actions_selector li a').click(function(event){
    let message;
    event.stopPropagation(); // prevent Rails UJS click event
    event.preventDefault();
    if ((message = $(this).data('confirm'))) {
      ActiveAdmin.modal_dialog(message, $(this).data('inputs'), inputs => {
        $(this).trigger('confirm:complete', inputs);
      });
    } else {
      $(this).trigger('confirm:complete');
    }
  });

  $('.batch_actions_selector li a').on('confirm:complete', function(event, inputs){
    let val;
    if ((val = JSON.stringify(inputs))) {
      $('#batch_action_inputs').removeAttr('disabled').val(val);
    } else {
      $('#batch_action_inputs').attr('disabled', 'disabled');
    }

    $('#batch_action').val($(this).data('action'));
    $('#collection_selection').submit();
  });

  //<commit_msg>Detach previous batch_action click handler before attaching new one<commit_after>const onDOMReady = function() {
  //
  // Use ActiveAdmin.modal_dialog to prompt user if
  // confirmation is required for current Batch Action
  //
  $('.batch_actions_selector li a').off('click').on('click', function(event){
    let message;
    event.stopPropagation(); // prevent Rails UJS click event
    event.preventDefault();
    if ((message = $(this).data('confirm'))) {
      ActiveAdmin.modal_dialog(message, $(this).data('inputs'), inputs => {
        $(this).trigger('confirm:complete', inputs);
      });
    } else {
      $(this).trigger('confirm:complete');
    }
  });

  $('.batch_actions_selector li a').on('confirm:complete', function(event, inputs){
    let val;
    if ((val = JSON.stringify(inputs))) {
      $('#batch_action_inputs').removeAttr('disabled').val(val);
    } else {
      $('#batch_action_inputs').attr('disabled', 'disabled');
    }

    $('#batch_action').val($(this).data('action'));
    $('#collection_selection').submit();
  });

  //
{'fraction_non_alphanumeric': 0.1885686370297997, 'fraction_numerical': 0.0, 'mean_word_length': 3.665148063781321, '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': '5009066', 'n_tokens_mistral': 587, 'n_tokens_neox': 589, 'n_words': 117}