autocomplete.js 1002 B

1234567891011121314151617181920212223242526272829
  1. /**
  2. * DO NOT EDIT THIS FILE.
  3. * See the following change record for more information,
  4. * https://www.drupal.org/node/2815083
  5. * @preserve
  6. **/
  7. (function ($, Drupal) {
  8. Drupal.behaviors.claroAutoCompete = {
  9. attach: function attach(context) {
  10. $(context).find('input.form-autocomplete').once('claroAutoComplete').each(function (index, value) {
  11. var $input = $(value);
  12. var timeout = 400;
  13. var classRemoveTimeout = void 0;
  14. var classRemove = function classRemove($autoCompleteElem) {
  15. $autoCompleteElem.removeClass('is-autocompleting');
  16. };
  17. $input.on('input autocompletesearch autocompleteresponses', function (event) {
  18. if (event && event.type && event.type === 'autocompletesearch') {
  19. $(event.target).addClass('is-autocompleting');
  20. }
  21. clearTimeout(classRemoveTimeout);
  22. classRemoveTimeout = setTimeout(classRemove, timeout, $(event.target));
  23. });
  24. });
  25. }
  26. };
  27. })(jQuery, Drupal);