PageSourceSearch

https://careeramaze.com/wp-content/plugins/wp-jobsearch/js/search-box-autocomplete.js?ver=2.6.3

js careeramaze.com collected 2026-10-04 08:27:45 UTC 4,522 bytes, 94 lines download raw bytes

1jQuery.fn.extend({
2    JobsearchSearchBoxAutocomplete: function (options) {
3
4        return this.each(function () {
5
6            var srchboxFilterAjax;
7
8            var input = jQuery(this), opts = jQuery.extend({}, jQuery.JobsearchSearchBoxAutocomplete);
9            var predictionsDropDown = jQuery('<div class="sugg-search-results"></div>').appendTo(jQuery(this).parent());
10            var request_var = 1;
11            input.keyup(function () {
12
13                jQuery(this).parent(".jobsearch-sugges-search").find('.sugg-search-loader').html("<i class='fa fa-refresh fa-spin'></i>");
14                if (request_var == 1) {
15                    var searchStr = jQuery(this).val();
16                    var post_type = jQuery(this).attr('data-type');
17                    // Min Number of characters
18                    var num_of_chars = 0;
19                    if (searchStr != ' ' && searchStr != '  ' && searchStr.length > num_of_chars) {
20                        // AJAX GET results
21                        var dataString = 'action=jobsearch_get_search_box_posts_results' + '&_nonce=' + jobsearch_comon_script_vars.nonce + '&keyword=' + searchStr + '&post_type=' + post_type;
22                        var plugin_url = jobsearch_plugin_vars.ajax_url;
23
24                        if (typeof (srchboxFilterAjax) != 'undefined') {
25                            srchboxFilterAjax.abort();
26                        }
27
28                        srchboxFilterAjax = jQuery.ajax({
29                            type: "POST",
30                            url: plugin_url,
31                            _nonce: jobsearch_comon_script_vars.nonce,
32                            data: dataString,
33                        });
34
35                        srchboxFilterAjax.done(function (data) {
36                            jQuery(".jobsearch-sugges-search").find('.sugg-search-loader').html('');
37                            var results = jQuery.parseJSON(data);
38                            predictionsDropDown.empty();
39                            if (results != '') {
40                                jQuery(results).each(function (key, value) {
41                                    if (typeof value.item_all !== 'undefined') {
42                                        predictionsDropDown.append(value.item_all);
43                                    } else {
44                                        predictionsDropDown.append('<div class="search-res-item">' + value.item + '</div>');
45                                    }
46                                })
47                            }
48                            var search_stragin = input.val();
49                            if (search_stragin == '') {
50                                jQuery('.jobsearch-sugges-search').find('.sugg-search-results').html('');
51                            }
52                            request_var = 1;
53                        });
54
55                        srchboxFilterAjax.fail(function (jqXHR, textStatus) {
56                            //jQuery(".jobsearch-sugges-search").find('.sugg-search-loader').html('');
57                        });
58
59                        predictionsDropDown.show();
60                    } else {
61                        jQuery(".jobsearch-sugges-search").find('.sugg-search-loader').html('');
62                        jQuery('.jobsearch-sugges-search').find('.sugg-search-results').hide();
63                        jQuery('.jobsearch-sugges-search').find('.sugg-search-results').html('');
64                    }
65                }
66            });
67            return input;
68        });
69    }
70});
71
72jQuery(document).on('click', '.jobsearch-sugges-search input[type="text"]', function() {
73    jQuery('.jobsearch-sugges-search input[type="text"]').JobsearchSearchBoxAutocomplete();
74});
75
76jQuery(function ($) {
77    $('body').click(function (e) {
78        var clickedOn = $(e.target);
79        if (clickedOn.parents().addBack().is('.jobsearch-sugges-search')) {
80            //
81        } else {
82            jQuery('.jobsearch-sugges-search').find('.sugg-search-results').hide();
83        }
84    });
85    
86    jQuery(document).on('click', '.jobsearch-sugges-search .show-all-results a', function() {
87        $(this).parents('form').submit();
88    });
89    
90    jQuery(document).on('click', '.jobsearch-sugges-search .search-res-item', function() {
91        var anc_location = $(this).find('.post-title a').attr('href');
92        window.location.href = anc_location;
93    });
94});

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.