<commit_before>/* global Fae */

'use strict';

/**
 * Fae form text
 * @namespace form.text
 * @memberof form
 */
Fae.form.text = {

  init: function() {
    this.slugger();
  },

  /**
   * Attach listeners to inputs and update slug fields with original safe values from the original inputs
   */
  slugger: function() {
    var $form = $('.slug').closest('form');
    var $sluggers = $form.find('.slugger');
    var $slug = $form.find('.slug');
    var $select_slugger = $('.select.slugger');
    var _this = this;

    if ($slug.val() !== '') {
      $sluggers.removeClass('slugger');

    } else {
      // If it's a text field, listen for type input
      $sluggers.keyup(function(){
        var text = _this._digestSlug( $sluggers );
        $slug.val( text );
      });

      // If it's a select field, listen for the change
      if ($select_slugger.length) {
        $select_slugger.change(function(){
          var text = _this._digestSlug( $sluggers );
          $slug.val( text );
        });

      };
    }
  },

  /**
   * Convert a group of selects or text fields into one slug string
   * @access protected
   * @param {jQuery} $sluggers - Input or inputs that should be converted into a URL-safe string
   * @return {String}
   */
  _digestSlug: function($sluggers) {
    var slug_text = []

    $sluggers.each(function() {
      var $this = $(this);

      if ($this.val().length) {

        if ($this.is('input')) {
          slug_text.push( $this.val() );

        } else {
          slug_text.push( $this.find('option:selected').text() );<commit_msg>fix slug test<commit_after>/* global Fae */

'use strict';

/**
 * Fae form text
 * @namespace form.text
 * @memberof form
 */
Fae.form.text = {

  init: function() {
    this.slugger();
  },

  /**
   * Attach listeners to inputs and update slug fields with original safe values from the original inputs
   */
  slugger: function() {
    var _this = this;

    $('.slug').each(function() {
      var $form = $(this).closest('form');
      var $sluggers = $form.find('.slugger');
      var $slug = $form.find('.slug');
      var $select_slugger = $('.select.slugger');

      if ($slug.val() !== '') {
        $sluggers.removeClass('slugger');

      } else {
        // If it's a text field, listen for type input
        $sluggers.keyup(function(){
          var text = _this._digestSlug( $sluggers );
          $slug.val( text );
        });

        // If it's a select field, listen for the change
        if ($select_slugger.length) {
          $select_slugger.change(function(){
            var text = _this._digestSlug( $sluggers );
            $slug.val( text );
          });

        };
      }
    });
  },

  /**
   * Convert a group of selects or text fields into one slug string
   * @access protected
   * @param {jQuery} $sluggers - Input or inputs that should be converted into a URL-safe string
   * @return {String}
   */
  _digestSlug: function($sluggers) {
    var slug_text = []

    $sluggers.each(function() {
      var $this = $(this);

      if ($this.val().length) {

        if ($this.is('input')) {
          slug_text.push( $this.val() );

        } else {
          slug_text.push( $this.find('option:selected').text() );
{'fraction_non_alphanumeric': 0.15835140997830802, 'fraction_numerical': 0.0, 'mean_word_length': 2.2344689378757514, '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': '1553852', 'n_tokens_mistral': 1038, 'n_tokens_neox': 1036, 'n_words': 271}