PageSourceSearch

https://www.culturaltrust.org/wp-content/themes/oct/assets/js/custom.js?ver=1772802360

js culturaltrust.org collected 2026-10-01 12:20:03 UTC 1,963 bytes, 73 lines download raw bytes

1$(function() {
2  function handleEmptyState($menu) {
3    // Find dataset within the current menu
4    var $dataset = $menu.find('.tt-dataset-nonprofits');
5
6    if ($menu.hasClass('tt-empty')) {
7      // Force display:block !important
8      $menu.attr('style', function(i, s) {
9        s = s || '';
10        s = s.replace(/display\s*:\s*[^;]+;?/i, '');
11        return s + ' display: block !important;';
12      });
13
14      // Add message if not already there
15      if ($dataset.length && $dataset.next('.no-result-message').length === 0) {
16        $dataset.after('<div class="tt-suggestion tt-selectable no-result-message">No Result Found</div>');
17      }
18    } else {
19      // Remove message and reset display
20      $menu.find('.no-result-message').remove();
21      $menu.css('display', '');
22    }
23  }
24
25  function watchMenu($menu) {
26    if (!$menu.length) return;
27
28    handleEmptyState($menu);
29
30    var observer = new MutationObserver(function() {
31      handleEmptyState($menu);
32    });
33
34    observer.observe($menu[0], {
35      attributes: true,
36      attributeFilter: ['class']
37    });
38  }
39
40  function initWatcher() {
41    var $menus = $('.tt-menu');
42    if ($menus.length) {
43      $menus.each(function() {
44        watchMenu($(this));
45      });
46    } else {
47      // Retry until tt-menu exists (Typeahead injects it dynamically)
48      setTimeout(initWatcher, 300);
49    }
50  }
51
52  initWatcher();
53});
54
55 $(document).on('click', '.close', function () {
56    // Target the Typeahead container
57  const $typeahead = $('.twitter-typeahead');
58
59  // Clear the input
60  $typeahead.find('#search').val('');
61    $typeahead.find('.tt-menu').removeClass('tt-empty').hide();
62});
63
64document.addEventListener("DOMContentLoaded", function () {
65  const interval = setInterval(function () {
66    const popup = document.querySelector(".sgpb-main-popup-data-container-465499");
67    
68    if (popup) {
69      popup.setAttribute("aria-hidden", "true");
70      clearInterval(interval);
71    }
72  }, 500);
73});

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.