<commit_before>var Validator = {

  init: function () {
    this.validate();
    this.form_validate();
  },

  vars: {
    IS_VALID: ''
  },

  // validate the entire form on submit and stop it if the form is invalid
  form_validate: function () {
    var self = this;
    $('form').on('submit', function (e) {
      self.vars.IS_VALID = true;
      $('[data-validate]').each(function () {
        if ($(this).data('validate').length) {
          self.judge_it($(this));
        }
      });
      if (self.vars.IS_VALID === false) {
        e.preventDefault();
      }
    });
  },

  // validate individual judge elements on the blur event
  validate: function () {
    var self = this;<commit_msg>refs #44878 - scroll to first error when you submit an invalid form<commit_after>var Validator = {

  init: function () {
    this.validate();
    this.form_validate();
  },

  vars: {
    IS_VALID: ''
  },

  // validate the entire form on submit and stop it if the form is invalid
  form_validate: function () {
    var self = this;
    $('form').on('submit', function (e) {
      self.vars.IS_VALID = true;
      $('[data-validate]').each(function () {
        if ($(this).data('validate').length) {
          self.judge_it($(this));
        }
      });
      if (self.vars.IS_VALID === false) {
        Admin.scroll_to($('span.error').first());
        e.preventDefault();
      }
    });
  },

  // validate individual judge elements on the blur event
  validate: function () {
    var self = this;
{'fraction_non_alphanumeric': 0.1604527296937417, 'fraction_numerical': 0.003328894806924101, 'mean_word_length': 2.3549107142857144, 'pattern_counts': {'":': 0, '<': 3, '<?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': '7473608', 'n_tokens_mistral': 470, 'n_tokens_neox': 454, 'n_words': 117}