PageSourceSearch

https://humancolony.org/wp-content/plugins/bwl-kb-manager/js/custom-search-scripts.js?ver=1.2.5

js humancolony.org collected 2026-10-02 06:31:14 UTC 3,399 bytes, 104 lines download raw bytes

1jQuery(document).ready(function() {
2
3
4    var bkb_filter_container = jQuery(".bkb_filter_container");
5
6    bkb_filter_container.each(function() {
7
8        var live_search_field = jQuery(this).find(".s");
9        var bkbm_btn_clear = jQuery(this).find(".bkbm-btn-clear");
10
11        live_search_field.val("").addClass('search_icon');
12
13        var filter_timeout;
14
15        live_search_field.on("keyup", function() {
16
17            live_search_field = jQuery(this);
18
19            var search_box_unique_id = live_search_field.data('search-box-unique-id');
20            var suggestions = bkb_filter_container.find("#suggestions_" + search_box_unique_id);
21            var suggestionsList = bkb_filter_container.find("#suggestionsList_" + search_box_unique_id);
22
23            live_search_field.addClass('load');
24            bkbm_btn_clear.addClass('bkbm-dn');
25
26            clearTimeout(filter_timeout);
27
28            var search_keywords = jQuery.trim(live_search_field.val());
29            var search_limit = jQuery.trim(live_search_field.data('search_limit'));
30            var disbale_only_title = jQuery.trim(live_search_field.data('disbale_only_title'));
31
32            if (search_keywords.length < 2) {
33                suggestions.fadeOut();
34                live_search_field.removeClass('load');
35                bkbm_btn_clear.addClass('bkbm-dn');    
36            }
37
38            filter_timeout = (search_keywords.length >= 2) && setTimeout(function() {
39
40                jQuery.when(handle_server_search_response( search_keywords, search_limit, disbale_only_title )).done(function(data) {
41
42                    suggestions.fadeIn();
43                    bkbm_btn_clear.removeClass('bkbm-dn');    
44                    var search_result_html = '<ul>';
45
46                    if (data.length > 0) {
47
48                        jQuery.each(data, function(index, result) {
49
50                            search_result_html += '<li><a href="' + result.link + '">' + result.title + '</a></li>';
51                        })
52
53                    } else {
54                        search_result_html += '<li class="nothing-found">' + bkb_search_no_results_msg + '</li>';
55                    }
56
57                    search_result_html += '</ul>';
58
59                    suggestionsList.html(search_result_html);
60                    live_search_field.removeClass('load');
61
62                });
63
64            }, 900);
65
66        });
67        
68        live_search_field.keypress(function( e ) {
69                
70            if ( e.keyCode === 13 ) {
71                return false;
72            }
73
74        })
75        
76        // Clear Button Click Event.
77        
78        bkbm_btn_clear.on("click", function(){
79            bkbm_btn_clear.addClass('bkbm-dn');        
80            live_search_field.val("").addClass('search_icon');
81            bkb_filter_container.find('.suggestionsBox').fadeOut();
82
83        });
84
85    });
86
87    function handle_server_search_response( search_keywords, search_limit, disbale_only_title  ) {
88
89        return jQuery.ajax({
90            url: ajaxurl,
91            type: 'POST',
92            dataType: 'JSON',
93            data: {
94                action: 'bkb_get_search_results', // action will be the function name
95                bwl_ajax_search: true,
96                s: search_keywords,
97                search_limit: search_limit,
98                disbale_only_title: disbale_only_title
99            }
100        });
101
102    }
103
104});

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.