PageSourceSearch

https://shootreviews.com/wp-content/plugins/listingpro-plugin/assets/js/child-term.js

js shootreviews.com collected 2026-10-08 20:43:38 UTC 19,924 bytes, 450 lines download raw bytes

1jQuery(window).on('load', function(){
2    // if (!jQuery('#lp-submit-form').hasClass("lpeditlistingform")) {
3        if(jQuery('#inputCategory').val()){
4			
5			$haveFeature = jQuery('#inputCategory').find(':selected').data('doajax');
6			if($haveFeature){
7					$catid = jQuery('#inputCategory').val();
8					$listingid = '';
9					if ( jQuery( "input[name='lp_post']" ).length ) {
10						$listingid = jQuery( "input[name='lp_post']" ).val();
11					}
12					jQuery('.lp-nested').hide();
13					jQuery('#inputCategory').attr("disabled", !0);
14					jQuery('#tags-by-cat').html(' ');
15					jQuery('label.featuresBycat').remove();
16					jQuery('form#lp-submit-form  div.pre-load:first').addClass('loader');
17					jQuery('#features-by-cat').html(' ');
18					jQuery(".chosen-select").prop('disabled', !0).trigger('chosen:updated');
19
20					jQuery.ajax({
21						type: 'POST',
22						dataType: 'json',
23						url: ajax_term_object.ajaxurl,
24						data: {
25							'action': 'ajax_term',
26							'term_id': $catid,
27							'listing_id': $listingid,
28						},
29						success: function(data) {
30							jQuery('#inputCategory').removeAttr("disabled");
31							if (data) {
32								if (data.hasfeatues == !0) {
33
34									jQuery('.featuresDataContainerOuterSubmit').show();
35									jQuery('.labelforfeatures.lp-nested').show();
36									jQuery('#tags-by-cat').show()
37								}
38								if (data.hasfields == !0) {
39									jQuery('#features-by-cat').show()
40								}
41								jQuery('form#lp-submit-form div.pre-load').removeClass('loader');
42								jQuery(".chosen-select").prop('disabled', !1).trigger('chosen:updated');
43								if (data.tags != null) {
44									jQuery('.lpfeatures_fields').prepend('<label for="inputTags" class="featuresBycat">' + data.featuretitle + '</label>');
45									jQuery.each(data.tags, function(i, v) {
46										var lpchecked = '';
47										if (data.lpselectedtags != null) {
48											jQuery.each(data.lpselectedtags, function(lk, ls) {
49												if (i.trim() == lk) {
50													lpchecked = 'checked'
51												}
52											})
53										}
54										jQuery('#tags-by-cat').append('<div class="col-md-2 col-sm-4 col-xs-6"><div class="checkbox pad-bottom-10"><input id="check_' + v + '" type="checkbox" name="lp_form_fields_inn[lp_feature][]" value="' + i + '" ' + lpchecked + '><label for="check_' + v + '">' + v + '</label></div></div>')
55									})
56								}
57								jQuery('#features-by-cat').append(data.fields)
58							}
59						}
60					});
61			}
62
63        }
64	// }
65});
66
67jQuery(document).ready(function($) {
68    jQuery("#inputCategory").change(function() {
69
70        $this = jQuery(this);
71        // jQuery('.featuresDataContainerOuterSubmit').hide();
72
73        jQuery('#tags-by-cat, #features-by-cat').hide();
74        
75        if ($this.find(':selected').length > 1) {
76            jQuery( $this.find(':selected') ).each(function(){
77                if( jQuery(this).data('doajax') != '' || jQuery(this).data('doajax') != false ){
78                    $haveFeature = jQuery(this).data('doajax');
79                }
80            });
81        }else{
82            $haveFeature = $this.find(':selected').data('doajax');
83        }
84
85        if($haveFeature){
86            var lpchecked   =   '';
87            jQuery('.featuresDataContainerOuterSubmit').show();
88            jQuery('.lp-nested').hide();
89            jQuery('#inputCategory').attr("disabled", !0);
90            jQuery('#tags-by-cat').html(' ');
91            jQuery('label.featuresBycat').remove();
92            jQuery('form#lp-submit-form  div.pre-load:first').addClass('loader');
93            jQuery('#features-by-cat').html(' ');
94            jQuery(".chosen-select").prop('disabled', !0).trigger('chosen:updated');
95            var $catTerms = [];
96            var $cTerms = jQuery('form#lp-submit-form #inputCategory').val();
97            $catTerms.push($cTerms);
98            if (document.getElementById("pre-selected-cat") !== null) {
99                var $preSelected = jQuery('#pre-selected-cat').val();
100                $catTerms.push($preSelected)
101            }
102
103            jQuery.ajax({
104                type: 'POST',
105                dataType: 'json',
106                url: ajax_term_object.ajaxurl,
107                data: {
108                    'action': 'ajax_term',
109                    'term_id': jQuery('form#lp-submit-form #inputCategory').val(),
110                    'listing_id': jQuery('input[name=lp_post]').val(),
111                },
112                success: function(data) {
113                    jQuery('#inputCategory').removeAttr("disabled");
114                    if (data) {
115                        if (data.hasfeatues == !0) {
116                            jQuery('.labelforfeatures.lp-nested').show();
117                            jQuery('#tags-by-cat').show()
118                        }
119                        if (data.hasfields == !0) {
120                            jQuery('#features-by-cat').show()
121                        }
122                        $('form#lp-submit-form div.pre-load').removeClass('loader');
123                        jQuery(".chosen-select").prop('disabled', !1).trigger('chosen:updated');
124                        if (data.tags != null) {
125                            jQuery('.lpfeatures_fields').prepend('<label for="inputTags" class="featuresBycat">' + data.featuretitle + '</label>');
126                            jQuery.each(data.tags, function(i, v) {
127                                if (data.lpselectedtags != null) {
128                                    jQuery.each(data.lpselectedtags, function(lk, ls) {
129                                        if (i.trim() == lk) {
130                                            lpchecked = 'checked'
131                                        }
132                                    })
133                                }
134                                jQuery('#tags-by-cat').append('<div class="col-md-2 col-sm-4 col-xs-6"><div class="checkbox pad-bottom-10"><input id="check_' + v + '" type="checkbox" name="lp_form_fields_inn[lp_feature][]" value="' + i + '" ' + lpchecked + '><label for="check_' + v + '">' + v + '</label></div></div>')
135                            })
136                        }
137                        if(jQuery('#lp-form-builder-is-enabled').length) {
138                            var catsVal =   jQuery('form#lp-submit-form #inputCategory').val();
139                            if(typeof catsVal=== 'object') {
140                                jQuery.each(catsVal, function (k, v) {
141                                    var targetFieldsClass   =   '.lp-form-builder-field-'+v;
142                                    jQuery('.lp-form-builder-field').fadeOut(500, function () {
143                                        if(jQuery(targetFieldsClass).length){
144                                            jQuery(targetFieldsClass).fadeIn();
145                                        }
146                                    });
147                                })
148                            } else {
149                                var targetFieldsClass   =   '.lp-form-builder-field-'+jQuery('form#lp-submit-form #inputCategory').val();
150                                jQuery('.lp-form-builder-field').fadeOut(500, function () {
151                                    if(jQuery(targetFieldsClass).length){
152                                        jQuery(targetFieldsClass).fadeIn();
153                                    }
154                                });
155                            }
156                        } else {
157                            jQuery('#features-by-cat').append(data.fields);
158                        }
159                    }
160                }
161
162            });
163        } else {
164            if(jQuery('.featuresDataContainerOuterSubmit').data('exclusive') == 'no') {
165                jQuery('.featuresDataContainerOuterSubmit').hide();
166            }
167            else if(jQuery('.featuresDataContainerOuterSubmit').data('exclusive') == 'yes'){
168                jQuery('.featuresDataContainerOuterSubmit').fadeIn();
169            }
170            if(jQuery('#lp-form-builder-is-enabled').length) {
171                jQuery('.featuresDataContainerOuterSubmit').hide();
172                jQuery('.lp-form-builder-field').fadeOut();
173            }
174        }
175    });
176    jQuery(".lp-slected-plan-cat").on('click', function() {
177        jQuery('.lp_show_hide_plans').removeClass('active');
178        jQuery('.lp_show_hide_plans').removeClass('isactive');
179        jQuery('.lp_plan_result_section').html('');
180        jQuery('.lp_hide_general_plans').html('');
181		jQuery('.lpmonthyearswitcher').hide();
182        $this = jQuery(this);
183		$durationType = '';
184		if ( jQuery( ".lpmonthyearswitcher a.switch-fields" ).length ) {
185			if(jQuery('.lpmonthyearswitcher a.switch-fields').hasClass('active')){
186				$durationType = 'yearly';
187			}else{
188				$durationType = 'monthly';
189			}
190		}
191        $currentStyle = jQuery('#select_style').data('style');
192        jQuery("body").addClass("listingpro-loading");
193        jQuery('#cats-selected-plans').html('');
194        jQuery.ajax({
195            type: 'POST',
196            dataType: 'json',
197            url: ajax_term_object.ajaxurl,
198            data: {
199                'action': 'listingpro_select_plan_by_cat',
200                'term_id': $this.val(),
201                'currentStyle': $currentStyle,
202				'duration_type': $durationType,
203            },
204            success: function(data) {
205                jQuery("body").removeClass("listingpro-loading");
206                if (data.plans) {
207                    if (data.switcher) {
208                        if (data.switcher == "1") {
209                            jQuery('.lpmonthyearswitcher').show()
210                        }
211                    }
212					//jQuery('.lp_plan_result_section').html(data.plans);
213					jQuery('.lp_plan_result_section[data-style=' + $currentStyle + ']').html(data.plans);
214                    jQuery('.lp_plan_result_section').addClass('lp-plan-view-border');
215                    var $hiddenField = '<input type="hidden" name="lp_pre_selected_cats" value="' + $this.val() + '" />';
216                    jQuery($hiddenField).appendTo(".price-plan-button")
217                }
218            }
219        })
220    });
221    jQuery(".lp_show_hide_by_duration").on('click', function() {
222        $this = jQuery(this);
223        $durationType = $this.data('durationtype');
224        $catID = jQuery('.lp-slected-plan-cat:checked').val();
225        jQuery("body").addClass("listingpro-loading");
226        jQuery('#cats-selected-plans').html('');
227        jQuery.ajax({
228            type: 'POST',
229            dataType: 'json',
230            url: ajax_term_object.ajaxurl,
231            data: {
232                'action': 'filter_pricingplan',
233                'term_id': $catID,
234                'duration_type': $durationType,
235            },
236            success: function(data) {
237                jQuery("body").removeClass("listingpro-loading");
238                if (data.plans) {
239                    jQuery('#cats-selected-plans').html(data.plans);
240                    var $hiddenField = '<input type="hidden" name="lp_pre_selected_cats" value="' + $this.val() + '" />';
241                    jQuery($hiddenField).appendTo(".price-plan-button")
242                }
243            }
244        })
245    });
246    jQuery('.lp_plans_switcher_btn').on('click', function() {
247        $this = jQuery(this);
248        jQuery('.lp_cats_on_plan_wrap').css({
249            "visibility": "hidden",
250            "height": "0px",
251            "padding-bottom": "0px"
252        });
253		
254		//$currentVal = jQuery('.lpmonthyearswitcher span.active').html();
255		//$duration_type = 'monthly';
256        /* if ($currentVal == "Monthly") {
257            $duration_type = 'monthly'
258        } else if ($currentVal == "Annually") {
259            $duration_type = 'yearly'
260        } */
261		
262		$duration_type = '';
263		if ( jQuery( ".lpmonthyearswitcher a.switch-fields" ).length ) {
264			if(jQuery('.lpmonthyearswitcher a.switch-fields').hasClass('active')){
265				$duration_type = 'yearly';
266			}else{
267				$duration_type = 'monthly';
268			}
269		}
270		
271        jQuery('.lp_plans_switcher_btn').removeClass('isactive');
272        jQuery('.lp_hide_general_plans').html('');
273        jQuery('.lp_hide_general_plans').removeClass('lp-plan-view-border');
274        jQuery('.lp_plan_result_section').html('');
275        $this.toggleClass('isactive');
276        if ($this.hasClass('isactive') && $this.data('val') == 'standard') {
277            $currentStyle = jQuery('#select_style').data('style');
278            jQuery("body").addClass("listingpro-loading");
279            //jQuery('input.lp-slected-plan-cat').prop('checked', !1);
280            jQuery('input.lp-slected-plan-cat').prop('checked', false);
281			jQuery('label.active-category-radio').removeClass('active-category-radio');
282            jQuery.ajax({
283                type: 'POST',
284                dataType: 'json',
285                url: ajax_term_object.ajaxurl,
286                data: {
287                    'action': 'listingpro_select_general_plans',
288                    'currentStyle': $currentStyle,
289					'duration_type': $duration_type,
290                },
291                success: function(data) {
292                    jQuery("body").removeClass("listingpro-loading");
293                    if (data.plans) {
294                        jQuery('.lpmonthyearswitcher').show();
295                        //jQuery('.lp_plan_result_section').html(data.plans);
296                        jQuery('.lp_plan_result_section[data-style=' + $currentStyle + ']').html(data.plans);
297                        jQuery('.lp_plan_result_section').addClass('lp-plan-view-border');
298                        var $hiddenField = '<input type="hidden" name="lp_pre_selected_cats" value="' + $this.val() + '" />';
299                        jQuery($hiddenField).appendTo(".price-plan-button")
300                    }
301                }
302            })
303        } else {
304            jQuery('.lp_cats_on_plan_wrap').css({
305                "visibility": "visible",
306                "height": "auto",
307                "padding-bottom": "40px"
308            });
309            jQuery('.lp_plan_result_sectiolp_cats_on_plan_wrapn').html('');
310            jQuery('.lp_plan_result_section').removeClass('lp-plan-view-border');
311            jQuery('.lpmonthyearswitcher').hide()
312        }
313    });
314    jQuery('ul.switch_month_year li span').on('click', function() {
315        jQuery("body").addClass("listingpro-loading");
316        $this = jQuery(this);
317        jQuery('ul.switch_month_year li span').removeClass('active_switch');
318        $this.toggleClass('active_switch');
319        $currentVal = $this.html();
320        $duration_type = '';
321        $currentStyle = jQuery('#select_style').data('style');
322        if ($currentVal == "Monthly") {
323            $duration_type = 'monthly'
324        } else if ($currentVal == "Annually") {
325            $duration_type = 'yearly'
326        }
327        $catID = '';
328        $planUsage = '';
329        if (jQuery('label').hasClass('active-category-radio')) {
330            $catID = jQuery('label.active-category-radio').find('input').val()
331        } else {
332            $planUsage = 'default'
333        }
334        jQuery('.lp_hide_general_plans').html('');
335        jQuery('.lp_plan_result_section').html('');
336        jQuery.ajax({
337            type: 'POST',
338            dataType: 'json',
339            url: ajax_term_object.ajaxurl,
340            data: {
341                'action': 'filter_pricingplan',
342                'cat_id': $catID,
343                'duration_type': $duration_type,
344                'currentStyle': $currentStyle,
345                'planUsage': $planUsage,
346            },
347            success: function(data) {
348                jQuery("body").removeClass("listingpro-loading");
349                if (data) {
350                    jQuery('.lp_plan_result_section:first').html(data.plans);
351                    var $hiddenField = '<input type="hidden" name="lp_pre_selected_cats" value="' + $this.val() + '" />';
352                    jQuery($hiddenField).appendTo(".price-plan-button");
353                }
354            }
355        })
356    });
357    jQuery('.lp_button_switcher span').on('click', function() {
358        jQuery('.lp_hide_general_plans').removeClass('lp-plan-view-border');
359        jQuery('.lp_button_switcher span').removeClass('active');
360        jQuery(this).toggleClass('active');
361        jQuery("body").addClass("listingpro-loading");
362        $this = jQuery(this);
363        $currentVal = $this.html();
364        $duration_type = '';
365        $currentStyle = jQuery('#select_style').data('style');
366        if ($currentVal == "Monthly") {
367            $duration_type = 'monthly';
368            jQuery('.switch-fields').removeClass('active')
369        } else if ($currentVal == "Annually") {
370            $duration_type = 'yearly';
371            jQuery('.switch-fields').addClass('active')
372        }
373        $catID = '';
374        $planUsage = '';
375        if (jQuery('label').hasClass('active-category-radio')) {
376            $catID = jQuery('label.active-category-radio').find('input').val()
377        } else {
378            $planUsage = 'default'
379        }
380        jQuery('.lp_hide_general_plans').html('');
381        jQuery('.lp_plan_result_section').html('');
382        jQuery.ajax({
383            type: 'POST',
384            dataType: 'json',
385            url: ajax_term_object.ajaxurl,
386            data: {
387                'action': 'filter_pricingplan',
388                'cat_id': $catID,
389                'duration_type': $duration_type,
390                'currentStyle': $currentStyle,
391                'planUsage': $planUsage,
392            },
393            success: function(data) {
394                jQuery("body").removeClass("listingpro-loading");
395                if (data) {
396                    jQuery('.lp_plan_result_section:first').html(data.plans);
397                    var $hiddenField = '<input type="hidden" name="lp_pre_selected_cats" value="' + $this.val() + '" />';
398                    jQuery($hiddenField).appendTo(".price-plan-button");
399                    jQuery('.lp_plan_result_section').addClass('lp-plan-view-border')
400                }
401            }
402        })
403    });
404    jQuery('.lp_button_switcher a').on('click', function() {
405        jQuery('.lp_hide_general_plans').removeClass('lp-plan-view-border');
406        $duration_type = '';
407        $currentStyle = jQuery('#select_style').data('style');
408        if (jQuery(this).hasClass('active')) {
409            jQuery('.lp-monthly-side').addClass('active');
410            jQuery('.lp-year-side').removeClass('active');
411            $duration_type = 'monthly'
412        } else {
413            $duration_type = 'yearly';
414            jQuery('.lp-year-side').addClass('active');
415            jQuery('.lp-monthly-side').removeClass('active')
416        }
417        jQuery("body").addClass("listingpro-loading");
418        $this = jQuery(this);
419        $catID = '';
420        $planUsage = '';
421        if (jQuery('label').hasClass('active-category-radio')) {
422            $catID = jQuery('label.active-category-radio').find('input').val()
423        } else {
424            $planUsage = 'listingonly'
425        }
426        jQuery('.lp_hide_general_plans').html('');
427        jQuery('.lp_plan_result_section').html('');
428        jQuery.ajax({
429            type: 'POST',
430            dataType: 'json',
431            url: ajax_term_object.ajaxurl,
432            data: {
433                'action': 'filter_pricingplan',
434                'cat_id': $catID,
435                'duration_type': $duration_type,
436                'currentStyle': $currentStyle,
437                'planUsage': $planUsage,
438            },
439            success: function(data) {
440                jQuery("body").removeClass("listingpro-loading");
441                if (data) {
442                    jQuery('.lp_plan_result_section:first').html(data.plans);
443                    var $hiddenField = '<input type="hidden" name="lp_pre_selected_cats" value="' + $this.val() + '" />';
444                    jQuery($hiddenField).appendTo(".price-plan-button");
445                    jQuery('.lp_plan_result_section').addClass('lp-plan-view-border')
446                }
447            }
448        })
449    })
450})

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.