PageSourceSearch

https://mcgrathlbm.com.au/wp-content/plugins/epl-staff-directory/assets/js/front.js?ver=2.9.214

js mcgrathlbm.com.au collected 2026-10-09 00:58:55 UTC 14,000 bytes, 270 lines download raw bytes

1jQuery(document).ready( function($) {
2        
3        
4        /** Staff Listings */
5        $('.epl-sd-load-more').on('click', function(e) {
6                e.preventDefault();
7                var qty         = $(this).data('qty');
8                var paged 	= $(this).siblings('input[name="epl_sd_listing_paged"]');
9                var agent 	= $(this).siblings('input[name="epl_sd_author_id"]');
10                var parent 	= $(this).closest('.epl-sd-load-more-wrap');
11                var status 	= $(this).siblings('input[name="epl_sd_status"]');
12                var listings_wrapper = parent.siblings('.epl-sd-listings-inner');
13                var data = {
14                        
15                        'action' : 'epl_sd_load_agent_listings',
16                        'paged'	 : paged.val(),
17                        'agent'	 : agent.val(),
18                        'status' : status.val()
19                }
20                
21                $.ajax(
22                        {
23                                type: "POST",
24                                data: data,
25                                url: epl_frontend_vars.ajaxurl,
26                                success: function (response) {
27                                        if( '' !== response ) {
28                                                
29                                                listings_wrapper.append(response);
30                                                var paged_val = paged.val();
31                                                paged_val = parseInt(paged_val);
32                                                paged_val++;
33                                                paged.val( paged_val );
34
35                                                let returned_count = $('<div>'+response+'</div>').find('.epl-listing-post').length;
36                                                if( returned_count < qty ) {
37                                                        parent.hide();
38                                                }
39                                        } else {
40                                                parent.hide();
41                                        }
42                                }
43                        }
44                        );
45                });
46                
47                $('.epl-agent-search-form-ajax .in-field').change(function() {
48                        
49                        let form = $(this).closest('form');
50                        let data = form.serialize();
51                        let container = $( $(this).closest('.epl-agent-search-form-ajax').data('ajax-container') );
52                        
53                        data += '&action=epl_agent_search';
54                        
55                        $.ajax({
56                                type: "GET",
57                                data: data,
58                                dataType: 'json',
59                                url: epl_frontend_vars.ajaxurl,
60                                success: function (response) {
61                                        
62                                        if (response.html != '') {
63                                                
64                                                container.find('.epl-property-blog, .epl-search-not-found-title, .epl-search-not-found-message ').each(function() {
65                                                        $(this).remove();
66                                                        
67                                                });
68                                                
69                                                container.append(response.html);
70                                                
71                                        }
72                                        
73                                        if (response.pagination != '') {
74                                                $('.epl-pagination').replaceWith(response.pagination);
75                                        } else {
76                                                $('.epl-pagination').html('');
77                                        }
78                                        
79                                        EPL_Front_Js.switch_view();
80                                        EPL_Front_Js.set_default_view();
81                                        ajax_pagination( form );
82                                }
83                        });
84                        
85                        /** Ajax pagination */
86                        function ajax_pagination( form ) {
87                                
88                                $(document).on( 'click', '.epl-pagination a', function(e) {
89                                        
90                                        e.preventDefault();
91                                        var data = form.serialize();
92                                        paged_url = $(this).attr('href');
93                                        data += '&paged=' + get_var_from_url( paged_url, 'paged' );
94                                        
95                                        if( data != '' ) {
96                                                $.ajax({
97                                                        type: "GET",
98                                                        data: data,
99                                                        dataType: 'json',
100                                                        url: epl_frontend_vars.ajaxurl,
101                                                        success: function (response) {
102                                                                
103                                                                if (response.html != '') {
104                                                                        
105                                                                        container.find('.epl-listing-post, .epl-search-not-found-title, .epl-search-not-found-message ').each(function() {
106                                                                                $(this).remove();
107                                                                                
108                                                                        });
109                                                                        
110                                                                        container.append(response.html);
111                                                                        
112                                                                }
113                                                                
114                                                                if (response.pagination != '') {
115                                                                        $('.epl-pagination').replaceWith(response.pagination);
116                                                                } else {
117                                                                        $('.epl-pagination').html('');
118                                                                }
119                                                                
120                                                                EPL_Front_Js.switch_view();
121                                                                EPL_Front_Js.set_default_view();
122                                                                ajax_pagination( form );
123                                                        }
124                                                });
125                                        }
126                                });
127                        }
128                });
129
130                $(".epl-author-card").each( function() {
131
132                        $(this).attr( 'data-name', $(this).find( '.epl-author-title').text().trim().toLowerCase() );
133                        $(this).attr( 'data-office', $(this).find( '.epl-author-office').text().trim().toLowerCase() );
134                        $(this).attr( 'data-position', $(this).find( '.epl-author-position').text().trim().toLowerCase() );
135                });
136
137                function filter_staff() {
138                        
139                        let allFilters = {};
140
141                        let wrapper;
142
143                        if( $('.epl-sd-shortcode-content').length ) {
144                                wrapper = $('.epl-sd-shortcode-content');
145                        } else if( $('.epl-loop-content').length ) {
146                                wrapper = $('.epl-loop-content');
147                        }  else {
148                                wrapper = $('.loop-content');
149                        }
150                        
151
152                        wrapper.find(".epl-author-card:not(.epl-author-section-header)").hide();
153
154                        let selector = '';
155
156                        $(".epl-sd-filter").each( function() {
157                                let filterName = $(this).data('filter');
158                                let val = $(this).find('input').val() || '';
159
160                                if( '' == val ) {
161                                        val = $(this).find('select').val() || '';
162                                }
163
164                                allFilters[ filterName ] = val.toLowerCase();
165                        });
166
167                        jQuery.each( allFilters, function(i,v) {
168                                
169                                if( v != '' ) {
170                                        
171                                        selector = selector + '[data-'+i+'*="'+v+'"]';
172                                }
173                        });
174
175                        
176                        $(".epl-author-card"+selector).show();
177
178                        toggle_section_headers();
179                }
180
181                function toggle_section_headers() {
182
183                        jQuery('.epl-author-section-header').each( function() {
184
185                                let nextEl = jQuery(this).nextAll(':visible').eq(0);
186
187                                if( !nextEl.hasClass('epl-author-child') ) {
188                            
189                                    jQuery( this ).hide();
190                                    
191                                } else {
192                            
193                                    jQuery( this ).show();
194                                    
195                                }
196                                
197                        });
198                }
199
200                $(".epl-sd-filter input").on("keyup", filter_staff );
201
202                $(".epl-sd-filter select").on("change", filter_staff );
203
204                $(".epl-sd-filter input").on("change", function() {
205                        $(this).trigger('keyup');
206                });
207                $(".epl-sd-filter select").on("change", function() {
208                        $(this).trigger('keyup');
209                });
210
211                function get_staff_filter_data() {
212
213                        if( $('.epl-sd-filter-wrap').length == 0 ) {
214                                return false;
215                        }
216
217                        let wrapper;
218
219                        if( $('.epl-sd-shortcode-content').length ) {
220                                wrapper = $('.epl-sd-shortcode-content');
221                        } else if( $('.epl-loop-content').length ) {
222                                wrapper = $('.epl-loop-content');
223                        }  else {
224                                wrapper = $('.loop-content');
225                        }
226
227                        let ids = [];
228
229                        wrapper.find(".epl-author-card").each( function() {
230                                let id = $(this).attr('id');
231                                ids.push( id.split('-')[1] );
232                        });
233
234                        $.ajax(
235                                {
236                                        type: "POST",
237                                        data: {
238                                                'action' : 'get_staff_filter_data',
239                                                'staffs' : ids
240                                        },
241                                        dataType: 'json',
242                                        url: epl_frontend_vars.ajaxurl,
243                                        success: function (response) {
244
245                                                if( '' !== response ) {
246                                                        
247                                                        jQuery.each( response, function( i, v ) {
248                                                                jQuery.each( v, function( key, value ) {
249                                                                        
250                                                                        $('#post-'+i).attr('data-'+key, value);
251                                                                });
252                                                        });
253                                                }
254                                        }
255                                }
256                        );
257                }
258
259                get_staff_filter_data();
260
261                $('.epl-sd-filter-button').on( 'click', function() {
262
263                        $(this).siblings().removeClass( 'epl-sd-filter-active');
264                        val = $(this).data('value');
265                        $(this).closest('.epl-sd-filter').find('input').val( val ).trigger('change');
266                        $(this).addClass( 'epl-sd-filter-active');
267                        
268                });
269                
270        });

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.