<commit_before>IFS.core.autoComplete = (function () {
  'use strict'
  var s // private alias to settings
  return {
    settings: {
      autoCompleteWrapper: '.autocomplete__wrapper',
      autoCompleteElement: '[data-auto-complete]',
      autoCompleteSubmitElement: '[data-auto-complete-submit]',
      autoCompletePlugin: accessibleAutocomplete // eslint-disable-line
    },
    init: function () {
      s = this.settings
      var autoCompleteElement = jQuery(s.autoCompleteElement)
      var autoCompleteSubmitElement = jQuery(s.autoCompleteSubmitElement)
      if (autoCompleteElement.length > 0) {
        autoCompleteElement.val('')
        autoCompleteSubmitElement.prop('disabled', true)
        jQuery(document).on('keydown', s.autoCompleteWrapper, function (e) {
          if (e.which !== 13 && e.which !== 32) {
            autoCompleteSubmitElement.prop('disabled', true)
          }
        })
        var showAllValues = autoCompleteElement.children('option').length <= 20
        s.autoCompletePlugin.enhanceSelectElement({
          selectElement: autoCompleteElement[0],
          showAllValues: showAllValues,
          defaultValue: '',
          confirmOnBlur: false,
          onConfirm: function (confirmed) {
            autoCompleteElement.children('option').attr('selected', false)
            autoCompleteElement.children('option:contains(' + confirmed + ')').attr('selected', 'selected')
            autoCompleteSubmitElement.prop('disabled', false)
          }
        })
      }
    }
  }
})()<commit_msg>IFS-5245 Fix bug with selecting the same mo after using back button<commit_after>IFS.core.autoComplete = (function () {
  'use strict'
  var s // private alias to settings
  return {
    settings: {
      autoCompleteWrapper: '.autocomplete__wrapper',
      autoCompleteElement: '[data-auto-complete]',
      autoCompleteSubmitElement: '[data-auto-complete-submit]',
      autoCompletePlugin: accessibleAutocomplete // eslint-disable-line
    },
    init: function () {
      s = this.settings
      var autoCompleteElement = jQuery(s.autoCompleteElement)
      var autoCompleteSubmitElement = jQuery(s.autoCompleteSubmitElement)
      if (autoCompleteElement.length > 0) {
        autoCompleteElement.val('')
        autoCompleteSubmitElement.prop('disabled', true)
        jQuery(document).on('keydown', s.autoCompleteWrapper, function (e) {
          if (e.which !== 13 && e.which !== 32) {
            autoCompleteSubmitElement.prop('disabled', true)
          }
        })
        var showAllValues = autoCompleteElement.children('option').length <= 20
        s.autoCompletePlugin.enhanceSelectElement({
          selectElement: autoCompleteElement[0],
          showAllValues: showAllValues,
          defaultValue: '',
          confirmOnBlur: false,
          onConfirm: function (confirmed) {
            var selectedUserId = autoCompleteElement.children('option:contains(' + confirmed + ')').val()
            autoCompleteElement.val(selectedUserId)
            autoCompleteSubmitElement.prop('disabled', false)
          }
        })
      }
    }
  }
})()
{'fraction_non_alphanumeric': 0.11618925008046346, 'fraction_numerical': 0.006437077566784679, 'mean_word_length': 2.822878228782288, 'pattern_counts': {'":': 0, '<': 5, '<?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': '5567241', 'n_tokens_mistral': 818, 'n_tokens_neox': 797, 'n_words': 153}