PageSourceSearch

https://www.townofbiscoe.gov/modules/custom/nc_bootstrap/js/portal-search.js?v=1.7

js townofbiscoe.gov collected 2026-10-09 17:06:12 UTC 2,253 bytes, 58 lines download raw bytes

1(function ($) {
2  "use strict";
3  Drupal.behaviors.portalSearch = {
4    attach: function (context, settings) {
5      const has_searchblock = drupalSettings.nc_search.searchblock;
6
7      // Alternate Search Icon Behavior on Homepage
8      if(has_searchblock) {
9        // Produce an array from the promoted nodes object
10        // consisting of node titles, and an object consisting of
11        // titles keyed to node URLs.
12        const titles = [];
13        const titleURL = {};
14        for (const key in settings.promotedlist) {
15          titles.push(settings.promotedlist[key][0]);
16          titleURL[settings.promotedlist[key][0]] = settings.promotedlist[key][1];
17        }
18
19        // Prevent autocomplete from obscuring auto search feature.
20        document.getElementById("edit-keys").setAttribute("autocomplete", "off");
21
22        $(document).on("keyup", "#edit-keys", function () {
23          $('#promotedlistresults').remove();
24          // Begin showing results after three entered characters
25          if ($(this).val().length > 2) {
26            var results = titles.filter(element => element.toLowerCase().includes($(this).val().toLowerCase()));
27
28            if (results.length > 0) {
29              $('<div id="promotedlistresults" class="list-group" aria-live="polite"></div>').insertAfter($(this));
30              results.forEach((element, index, array) => {
31                $('#promotedlistresults').append('<a class="list-group-item list-group-item-action" href="' + titleURL[element] + '">' + element + '<span><i class="bi bi-arrow-right-short"></i></span>' + '</a>');
32              });
33            }
34            else {
35              $('#promotedlistresults').remove();
36            }
37
38          }
39
40        });
41
42        // Adjusting Home Page Search Form Desktop & Mobile
43        $(window).on('load resize', function () {
44          if ($(window).width() < 993) {
45            $('.home-searchbox').find('#search-button').prop('value', '');
46          }
47          if ($(window).width() > 992) {
48            $('.home-searchbox').find('#search-button').prop('value', 'Search');
49          }
50        });
51      }
52      else {
53        // Show search icon on home page if no search box
54        $('#search-icon').show();
55      }
56    }
57  };
58}(jQuery));

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.