PageSourceSearch

https://www.groupcal.app/wp-content/themes/24me/modules/theme/assets/js/search.js?ver=1790850291

js groupcal.app collected 2026-10-01 10:26:05 UTC 3,050 bytes, 91 lines download raw bytes

1jQuery(document).ready(function($) {
2    var $ajaxSearchInput = $('#ajaxSearchInput');
3    var $clearSearch = $('#clearSearch');
4    var modal = jQuery('#searchModal');
5
6    function toggleClearButton() {
7        if ($ajaxSearchInput && $ajaxSearchInput.length > 0) {
8            if ($ajaxSearchInput.val().length > 0) {
9                $clearSearch.show();
10            } else {
11                $clearSearch.hide();
12            }
13        }
14    }
15
16    function showModal() {
17        modal.addClass('show');
18        setTimeout(function(){
19            $ajaxSearchInput.focus();
20        }, 150);
21    }
22
23    function hideModal() {
24        modal.removeClass('show');
25    }
26
27    jQuery(document).on('keydown', function(event) {
28        if (event.key === 'Escape') {
29            hideModal();
30        }
31    });
32
33    // Listen for outside click
34    modal.on('click', function(event) {
35        if (!jQuery(event.target).closest('.modal-content').length) {
36            // If the clicked element is not within modalBody, hide the modal
37            hideModal();
38        }
39    });
40    jQuery('.guide-search-block').click(function() {
41        showModal();
42    });
43
44    $clearSearch.on('click', function() {
45        $ajaxSearchInput.val('').focus(); // Clear the input and focus it
46        toggleClearButton(); // Toggle the clear button visibility again
47        $('#searchResults').empty(); // Clear any search results
48        $('#searchTitle').html('Search results:');
49      });
50
51    toggleClearButton();
52
53    // This captures the Enter key press, prevents the default browser action,
54    // and triggers our existing keyup search logic.
55    $('#ajaxSearchInput').on('keydown', function(event) {
56        if (event.key === 'Enter') {
57            event.preventDefault(); // Stop the browser from trying to submit a form
58            $(this).trigger('keyup');   // Manually trigger the live search
59        }
60    });
61    
62    $('#ajaxSearchInput').on('keyup', function() {
63        toggleClearButton();
64        var searchTerm = $(this).val();
65
66        if (searchTerm.length === 0) {
67            // If the search term is empty, clear the results and don't make an AJAX call
68            $('#searchResults').empty();
69            $('#searchTitle').html('Search results:');
70        } else {
71            $.ajax({
72                url: search_object.ajax_url,
73                type: 'POST',
74                dataType: 'json',
75                data: {
76                    action: 'ajax_search',
77                    nonce: search_object.search_nonce, // <-- REVERT TO THIS
78                    searchTerm: searchTerm
79                },
80                success: function(data) {
81                    var results = data.data.results;
82                    var count = data.data.count;
83                    var isCount = count > 0;
84                    var isNotOne = count === 1;
85                    $('#searchResults').html(results);
86                    $('#searchTitle').html(`${isCount ? count : 'No'} result${isNotOne ? '' : 's'}`);
87                }
88            });
89        }
90    });
91});

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.