PageSourceSearch

https://saibt.sa.edu.au/wp-content/plugins/navitas-agents/assets/js/custom.js?ver=6.9.9

js saibt.sa.edu.au collected 2026-10-03 21:37:29 UTC 9,817 bytes, 288 lines download raw bytes

1jQuery(document).ready(function($) {
2
3    // ajax top level search agent by keyword and field
4    jQuery('.find-agent-btn').on('click', function(e) {
5
6        e.preventDefault();
7
8        jQuery('.agent-nvt-loading-icon').show();
9
10        var ajaxurl = admin_url.ajax_url ; // get ajaxurl
11
12        var keyword = jQuery('input[name="keyword"]').val();
13        var field = jQuery('.agent-select-field:checked').val();
14
15
16        jQuery.ajax({
17            type: "POST",
18            url: ajaxurl,
19            data: {
20                keyword: keyword,
21                field: field,
22                action: 'agent_search_result' },
23
24            success: function (response) {
25                var data = response.data;
26                console.log(response);
27                //if (response.data.success == true) {
28                    jQuery('.agent-results').html(data.result);
29                    jQuery('.agent-results-filters').html(data.filter);
30
31
32                //}
33
34            }, // success
35        })
36        .done(function (data) {
37            jQuery('.agent-nvt-loading-icon').hide();
38            agent_country_filter();
39            agent_city_filter();
40        });
41    });
42
43    jQuery(document).on("click", '.agent-filter-btn', function(e) {
44        e.preventDefault();
45
46        jQuery('.agent-nvt-loading-icon').show();
47
48        var ajaxurl = admin_url.ajax_url ; // get ajaxurl
49        //var keyword = jQuery('.agent-search-input').val();
50        //var field = jQuery('.agent-select-field').find(":selected").val();
51        var keyword = '';
52        var field = '';
53        var selected_countries = [];
54        var selected_cities = [];
55
56
57        var sortby = '';//jQuery('.filter-selected-sortby option:selected').val();
58
59        var button_value = $(this).val();
60
61        keyword = jQuery('.agent-filter-keyword').val();
62            field = jQuery('.agent-filter-field').val();
63
64        if (button_value == 'Apply Filter') {
65
66            jQuery('.agent-filter-country').each(function() {
67                if ($(this).prop('checked')) {
68                    selected_countries.push($(this).val());
69                }
70            });
71
72            jQuery('.agent-filter-city').each(function() {
73                if ($(this).prop('checked')) {
74                    selected_cities.push($(this).val());
75                }
76            });
77
78        } else {
79            selected_countries = [];
80            selected_cities = [];
81            sortby = '';
82        }
83
84        jQuery.ajax({
85            type: "POST",
86            url: ajaxurl,
87            data: {
88                keyword: keyword,
89                field: field,
90                selected_countries: selected_countries,
91                selected_cities: selected_cities,
92                sortby: sortby,
93                action: 'filter_agent_search_result' },
94
95            success: function (response) {
96                var data = response.data;
97                //console.log(response);
98                //if (response.data.success == true) {
99
100                    jQuery('.agent-results').html(data.result);
101                    jQuery('.agent-results-filters').html(data.filter);
102                //}
103
104            }, // success
105        })
106        .done(function (data) {
107            jQuery('.agent-nvt-loading-icon').hide();
108            agent_country_filter();
109            agent_city_filter();
110        });
111    });
112
113    //jQuery( ".agent-result-column" ).on('click', function() {
114    $(document).on('click', '.agent-result-column', function() {
115        var table_body_class = 'agent-result-table-content';
116        var column = $(this);
117        var attr_sort = column.attr('data-sort');
118        var column_field = column.attr('data-field');
119        var attr_order = column.attr('data-order');
120
121        var sort_icon = 'fa-solid fa-sort';
122        var asc_icon = 'fa-duotone fa-sort';
123        var desc_icon = 'fa-duotone fa-sort fa-swap-opacity';
124
125        //$('.agent-result-column:after' ).css('font-family', 'Font Awesome 6 Free');
126        //$('.agent-result-column:after' ).css('content', sort_icon);
127        $('.nvt-find-agent .agent-sort-icon' ).removeClass('fa-solid fa-sort fa-duotone fa-sort fa-swap-opacity');
128        $('.nvt-find-agent .agent-sort-icon' ).addClass('fa-solid fa-sort');
129
130        if (attr_sort == 'asc') {
131            //$('.nvt-find-agent .' + column_field + '-col:after' ).css('font-family', 'Font Awesome 6 Duotone');
132            //$('.nvt-find-agent .' + column_field + '-col:after' ).css('content', asc_icon);
133
134            $('.nvt-find-agent  .' + column_field + '-col .agent-sort-icon' ).removeClass('fa-solid fa-sort');
135            $('.nvt-find-agent  .' + column_field + '-col .agent-sort-icon' ).addClass( asc_icon );
136        } else {
137            //$('.nvt-find-agent .' + column_field + '-col:after' ).css('font-family', 'Font Awesome 6 Duotone');
138            //$('.nvt-find-agent .' + column_field + '-col:after' ).css('content', desc_icon);
139            $('.nvt-find-agent  .' + column_field + '-col .agent-sort-icon' ).removeClass('fa-solid fa-sort');
140            $('.nvt-find-agent  .' + column_field + '-col .agent-sort-icon' ).addClass( desc_icon );
141        }
142
143        agent_table_sort(table_body_class, column_field, attr_sort, attr_order);
144
145
146    });
147
148    jQuery(document).on("change", '.agent-delete-filter', function(e) {
149        e.preventDefault();
150
151        jQuery('.agent-nvt-loading-icon').show();
152
153        var ajaxurl = admin_url.ajax_url ; // get ajaxurl
154        var keyword = '';
155        var field = '';
156        var selected_countries = [];
157        var selected_cities = [];
158        var sortby = '';
159
160        jQuery(this).removeClass("checked");
161
162        jQuery('.agent-result-filter-country').each(function() {
163            if ($(this).prop('checked')) {
164                selected_countries.push($(this).val());
165            }
166        });
167
168        jQuery('.agent-result-filter-city').each(function() {
169            if ($(this).prop('checked')) {
170                selected_cities.push($(this).val());
171            }
172        });
173
174        keyword = jQuery('.agent-result-filter-keyword').val();
175        field = jQuery('.agent-result-filter-field').val();
176
177        jQuery.ajax({
178            type: "POST",
179            url: ajaxurl,
180            data: {
181                keyword: keyword,
182                field: field,
183                selected_countries: selected_countries,
184                selected_cities: selected_cities,
185                sortby: sortby,
186                action: 'filter_agent_search_result' },
187
188            success: function (response) {
189                var data = response.data;
190                console.log(response);
191                //if (response.data.success == true) {
192
193                    jQuery('.agent-results').html(data.result);
194                    jQuery('.agent-results-filters').html(data.filter);
195                //}
196
197            }, // success
198        })
199        .done(function (data) {
200            jQuery('.agent-nvt-loading-icon').hide();
201            agent_country_filter();
202            agent_city_filter();
203        });
204    });
205
206});
207
208function agent_table_sort(table_body_class, column_field, attr_sort, attr_order) {
209    var tbody = jQuery( '.' + table_body_class );
210
211    tbody.find( 'tr' ).sort( function( a, b ) {
212
213        if (attr_sort == 'asc') {
214            return jQuery( 'td:eq(' + attr_order + ')', a ).text().localeCompare( jQuery( 'td:eq(' + attr_order + ')', b ).text() );
215        } else {
216            return jQuery( 'td:eq(' + attr_order + ')', b ).text().localeCompare( jQuery( 'td:eq(' + attr_order + ')', a ).text() );
217        }
218    } ).appendTo( tbody );
219
220    if ( attr_sort == "asc" ) {
221        jQuery('.' + column_field + '-col').attr('data-sort', 'desc');
222    }
223
224    if ( attr_sort == "desc" ) {
225        jQuery('.' + column_field + '-col').attr('data-sort', 'asc');
226    }
227}
228
229function agent_country_filter() {
230
231    var initialDisplay = 5;
232    country_size_li = jQuery("#agent-country-list li").length;
233
234    jQuery('#agent-country-list li:lt(' + initialDisplay + ')').show();
235
236    if (country_size_li > initialDisplay) {
237        jQuery('#agent-show-more-country').show();
238    }
239
240    jQuery('#agent-show-more-country').click(function () {
241        //x = (x + 5 <= size_li) ? x + 5 : size_li;
242        initialDisplay = country_size_li;
243        jQuery('#agent-country-list li:lt(' + initialDisplay + ')').show();
244        jQuery('#agent-show-less-country').show();
245        if (initialDisplay == country_size_li) {
246            jQuery('#agent-show-more-country').hide();
247        }
248    });
249
250    jQuery('#agent-show-less-country').click(function () {
251        //x = (x - 5 < 0) ? 3 : x - 5;
252        initialDisplay = 5;
253        jQuery('#agent-country-list li').not(':lt(' + initialDisplay + ')').hide();
254        jQuery('#agent-show-more-country').show();
255        jQuery('#agent-show-less-country').hide();
256    });
257}
258
259function agent_city_filter() {
260
261    var initialDisplay = 5;
262    city_size_li = jQuery("#agent-city-list li").length;
263
264    jQuery('#agent-city-list li:lt(' + initialDisplay + ')').show();
265
266    if (city_size_li > initialDisplay) {
267        jQuery('#agent-show-more-city').show();
268    }
269
270    jQuery('#agent-show-more-city').click(function () {
271        //x = (x + 5 <= size_li) ? x + 5 : size_li;
272        initialDisplay = city_size_li;
273        jQuery('#agent-city-list li:lt(' + initialDisplay + ')').show();
274        jQuery('#agent-show-less-city').show();
275        if (initialDisplay == city_size_li) {
276            jQuery('#agent-show-more-city').hide();
277        }
278    });
279
280    jQuery('#agent-show-less-city').click(function () {
281        //x = (x - 5 < 0) ? 3 : x - 5;
282        initialDisplay = 5;
283        jQuery('#agent-city-list li').not(':lt(' + initialDisplay + ')').hide();
284        jQuery('#agent-show-more-city').show();
285        jQuery('#agent-show-less-city').hide();
286    });
287}
288

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.