PageSourceSearch

https://bakersfieldschoice.com/wp-content/plugins/listingpro-plugin/assets/js/child-term.js?ver=7.1.2

js bakersfieldschoice.com collected 2026-09-24 12:39:03 UTC 23,630 bytes, 495 lines download raw bytes

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

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.