PageSourceSearch

https://wdgpublichealth.ca/themes/custom/wdg/js/search-autocomplete.js?tlih5p

js wdgpublichealth.ca collected 2026-09-24 12:08:53 UTC 1,130 bytes, 43 lines download raw bytes

1/**
2 * @file
3 * Behaviors for WDG Public Health theme search autocomplete.
4 */
5
6(($, Drupal, once) => {
7  if (!Drupal.SearchApiAutocomplete) {
8    return;
9  }
10
11  /**
12   * Holds functions, methods, settings and other information for search autocomplete.
13   *
14   * @namespace
15   */
16  Drupal.wdgSearchAutocomplete = {
17    preInit(context = document) {
18      once('wdg-toolbar-search-autocomplete', '.masthead--search input.form-autocomplete', context).forEach(
19        (searchInput) => {
20          const $input = $(searchInput);
21
22          if ($input.data('ui-autocomplete') && typeof $input.autocomplete === 'function') {
23            $input.autocomplete('option', 'appendTo', $input.closest('.masthead'));
24          }
25        },
26      );
27    },
28  };
29
30  /**
31   * Attaches the WDG Public Health theme behaviors for search autocomplete.
32   *
33   * @type {Drupal~behavior}
34   *
35   * @prop {Drupal~behaviorAttach} attach
36   *   Call pre-init function when the DOM is ready.
37   */
38  Drupal.behaviors.wdgSearchAutocomplete = {
39    attach(context) {
40      Drupal.wdgSearchAutocomplete.preInit(context);
41    },
42  };
43})(jQuery, Drupal, once);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.