PageSourceSearch

https://bakersfieldschoice.com/wp-content/themes/listingpro/assets/js/review-submit.js?ver=7.1.2

js bakersfieldschoice.com collected 2026-09-24 12:39:00 UTC 17,960 bytes, 459 lines download raw bytes

1jQuery(document).ready(function ($) {
2    if (jQuery('body').hasClass('logged-in')) {
3
4
5    } else {
6        jQuery('.reviewformwithnotice input[type=text], .reviewformwithnotice textarea').keyup(function (e) {
7            if (jQuery('body').hasClass('listing-app-view')) {
8                jQuery('#app-view-login-popup').modal();
9                jQuery('#app-view-login-popup').addClass('md-show');
10            } else {
11                jQuery('#modal-3').modal();
12                jQuery('#modal-3').addClass('md-show');
13            }
14        });
15    }
16    jQuery('#rewies_formm').on('submit', function (e) {
17        e.preventDefault();
18    });
19    jQuery('#rewies_form').on('submit', function (e) {
20        $this = jQuery(this);
21
22
23        var isCaptcha = $this.data('lp-recaptcha'),
24            siteKey = $this.data('lp-recaptcha-sitekey');
25
26        var multiState = $this.data('multi-rating');
27
28        $this.find('.review_status').text('');
29        $this.find(':input[type=submit]').prop('disabled', true);
30        errorMSG = $this.find(":input[name='errormessage']").val();
31        $title = jQuery('#post_title').val();
32        var flag = false;
33        if (multiState == '1') {
34            var $rating = '';
35            var multiFieldsCount = jQuery('.lp-multi-rating-val').length - 1;
36            var multiRatingSum = 0;
37            jQuery('.lp-multi-rating-val').each(function (index) {
38                var field_val = jQuery(this).val(),
39                    fieldID = jQuery(this).data('mrf');
40                multiRatingSum += Number(field_val);
41
42                console.log(field_val);
43                if (field_val == '' || field_val == 0 || field_val == null) {
44                    flag = true;
45                    e.preventDefault();
46                    e.stopPropagation();
47                    e.stopImmediatePropagation();
48                    return false;
49                }
50
51                if (index != multiFieldsCount) {
52                    var cSep = ',';
53                }
54                else {
55                    var cSep = '';
56                }
57
58                var ratingVal = fieldID + ':' + field_val + cSep;
59
60                $rating += ratingVal;
61            });
62        }
63        else {
64            $rating = jQuery('#review-rating').val();
65        }
66        if (flag) {
67            $this.find('.review_status').text(errorMSG);
68            $this.find('.review_status').addClass('error-msg');
69            $this.find(':input[type=submit]').prop('disabled', false);
70            $this.find('.loadinerSearch').removeClass('loadinerSearchblock');
71            return false;
72        }
73        var ratingCheck = $rating;
74        if (multiState == '1') {
75            ratingCheck = multiRatingSum;
76        }
77        $description = jQuery('#post_description').val();
78        var $umail = '';
79        $umail = $this.find(":input[type=email]").val();
80        if ($umail !== undefined) {
81            $this.find('.loadinerSearch').addClass('loadinerSearchblock');
82            e.preventDefault();
83            if ($title == '' || ratingCheck == '' || ratingCheck == 0 || $description == '' || $umail == '') {
84                $this.find('.review_status').text(errorMSG);
85                $this.find('.review_status').addClass('error-msg');
86                $this.find(':input[type=submit]').prop('disabled', false);
87                $this.find('.loadinerSearch').removeClass('loadinerSearchblock');
88            }
89            else {
90
91
92                var fd = new FormData(this);
93                if (!jQuery('input#filer_input2').val()) {
94                    if (detectIE() == false) {
95                        fd.delete('post_gallery[]');
96                    }
97                }
98                fd.append('action', 'ajax_review_submit');
99                fd.append('multiState', multiState);
100                if (multiState == '1') {
101                    fd.append('multirating', $rating);
102                }
103
104                fd.append('lpNonce', jQuery('#lpNonce').val());
105                if ((isCaptcha == '' || isCaptcha === null) || (siteKey == '' || siteKey === null)) {
106                    jQuery.ajax({
107                        type: 'POST',
108                        url: ajax_review_object.ajaxurl,
109                        data: fd,
110                        contentType: false,
111                        processData: false,
112
113                        success: function (res) {
114
115                            var res = jQuery.parseJSON(res);
116                            $this.find('.loadinerSearch').removeClass('loadinerSearchblock');
117                            $this.find(':input[type=submit]').prop('disabled', false);
118                            if (res.error) {
119                                $this.find('.review_status').addClass('error-msg');
120                                $this.find('.review_status').text(res.status);
121                            }
122                            else {
123
124                                $this.find('.review_status').text(res.status);
125                                $this.find('.review_status').removeClass('error-msg');
126                                $this.find('.review_status').addClass('success-msg');
127                                $this[0].reset();
128                                var timer = '';
129
130                                function redirectPageNow() {
131                                    location.reload(true);
132                                    clearTimeout(timer);
133                                }
134
135                                timer = setTimeout(redirectPageNow, 100);
136
137                            }
138
139                        },
140                        error: function (request, error) {
141
142                            alert(error);
143                        }
144                    });
145                } else {
146                    //for recpatcha
147                    grecaptcha.ready(function () {
148                        grecaptcha.execute(siteKey, {action: 'lp_review'}).then(function (token) {
149
150                            fd.append('recaptha-action', 'lp_review');
151                            fd.append('token', token);
152
153                            jQuery.ajax({
154                                type: 'POST',
155                                url: ajax_review_object.ajaxurl,
156                                data: fd,
157                                contentType: false,
158                                processData: false,
159
160                                success: function (res) {
161
162                                    var res = jQuery.parseJSON(res);
163                                    $this.find('.loadinerSearch').removeClass('loadinerSearchblock');
164                                    $this.find(':input[type=submit]').prop('disabled', false);
165                                    if (res.error) {
166                                        $this.find('.review_status').addClass('error-msg');
167                                        $this.find('.review_status').text(res.status);
168                                    }
169                                    else {
170
171                                        $this.find('.review_status').text(res.status);
172                                        $this.find('.review_status').removeClass('error-msg');
173                                        $this.find('.review_status').addClass('success-msg');
174                                        $this[0].reset();
175                                        var timer = '';
176
177                                        function redirectPageNow() {
178                                            location.reload(true);
179                                            clearTimeout(timer);
180                                        }
181
182                                        timer = setTimeout(redirectPageNow, 100);
183
184                                    }
185
186                                },
187                                error: function (request, error) {
188
189                                    alert(error);
190                                }
191                            });
192
193                        });
194                    })
195
196                }
197
198            }
199        }
200
201        else if ($title == '' || ratingCheck == '' || ratingCheck == 0 || $description == '') {
202            $this.find('.review_status').text(errorMSG);
203            $this.find('.review_status').addClass('error-msg');
204            $this.find(':input[type=submit]').prop('disabled', false);
205        }
206        else {
207            $this.find('.loadinerSearch').addClass('loadinerSearchblock');
208            e.preventDefault();
209
210            var fd = new FormData(this);
211            if (!jQuery('input#filer_input2').val()) {
212                if (detectIE() == false) {
213                    fd.delete('post_gallery[]');
214                }
215            }
216            fd.append('multiState', multiState);
217            if (multiState == '1') {
218                fd.append('multirating', $rating);
219            }
220            fd.append('action', 'ajax_review_submit');
221            fd.append('lpNonce', jQuery('#lpNonce').val());
222
223            jQuery.ajax({
224                type: 'POST',
225                url: ajax_review_object.ajaxurl,
226                data: fd,
227                contentType: false,
228                processData: false,
229
230                success: function (res) {
231
232
233                    $this.find('.loadinerSearch').removeClass('loadinerSearchblock');
234                    $this.find(':input[type=submit]').prop('disabled', false);
235                    var res = jQuery.parseJSON(res);
236                    if (res.error) {
237                        $this.find('.review_status').addClass('error-msg');
238                        $this.find('.review_status').text(res.status);
239                    }
240                    else {
241                        $this.find('.review_status').text(res.status);
242                        $this.find('.review_status').removeClass('error-msg');
243                        $this.find('.review_status').addClass('success-msg');
244                        $this[0].reset();
245                        var timer = '';
246
247                        function redirectPageNow() {
248                            location.reload(true);
249                            clearTimeout(timer);
250                        }
251
252                        timer = setTimeout(redirectPageNow, 100);
253                    }
254
255                },
256                error: function (request, error) {
257                    alert(error);
258
259                }
260            });
261
262        }
263        return false;
264    });
265
266    /* by zaheer on 16 march */
267
268    jQuery('.reviews-section a.review_actv').tooltip();
269
270    jQuery(document).on('click', '.reviews-section a.reviewRes', function (e) {
271        reviewID = '';
272        ajaxResErr = '';
273        var $this = jQuery(this);
274        if ($this.hasClass('review_actv')) {
275            $this.find('.lp_state').text($this.data('reacted'));
276            $this.find('.lp_state').slideToggle('slow');
277            var showStatDiv = function () {
278                $this.find('.lp_state').slideToggle('slow');
279            };
280            timVar = setTimeout(showStatDiv, 3000);
281            e.preventDefault();
282        }
283        else {
284            $this.find('.lp_state').hide();
285            $this.find('span.interests-score').text('');
286            $this.find('span.interests-score').append('<i class="fa fa-spinner fa-spin"></i>');
287            reviewID = $this.data('id');
288            var currentVal = $this.data('score');
289            var restype = $this.data('restype');
290
291            jQuery.ajax({
292                type: 'POST',
293                dataType: 'json',
294                url: ajax_review_object.ajaxurl,
295                data: {
296                    action: 'lp_reviews_interests',
297                    interest: currentVal,
298                    restype: restype,
299                    id: reviewID,
300                    'lpNonce': jQuery('#lpNonce').val()
301                },
302
303
304                success: function (res) {
305                    if (res.errors == "no") {
306                        ajaxResErr = 'no';
307                        var newscore = res.newScore;
308                        $this.data('score', newscore);
309                        $this.find('span.interests-score').empty('');
310                        $this.find('span.interests-score').text(newscore);
311                        if (restype == 'interesting') {
312                            $this.css({
313                                'background-color': '#417cdf',
314                                'color': '#fff'
315                            });
316                            $this.find('.interests-score').css({'color': '#fff'});
317                        }
318                        else if (restype == 'lol') {
319                            $this.css({
320                                'background-color': '#ff8e29',
321                                'color': '#fff'
322                            });
323                            $this.find('.interests-score').css({'color': '#fff'});
324                        }
325                        else if (restype == 'love') {
326                            $this.css({
327                                'background-color': '#ff2357',
328                                'color': '#fff'
329                            });
330                            $this.find('.interests-score').css({'color': '#fff'});
331                        }
332                        currentVal = false;
333                        $this.find('.lp_state').text(res.statuss);
334                        $this.find('.lp_state').slideToggle('slow');
335                        var showStatDiv = function () {
336                            $this.find('.lp_state').slideToggle('slow');
337                        };
338                        timVar = setTimeout(showStatDiv, 3000);
339                        $this.addClass('review_actv');
340
341                    }
342                    else {
343                        ajaxResErr = 'yes';
344                        var newscore = res.newScore;
345                        $this.find('span.interests-score').empty('');
346                        $this.find('span.interests-score').empty('');
347                        $this.find('span.interests-score').text(newscore);
348                        $this.find('.lp_state').text(res.statuss);
349                        $this.find('.lp_state').slideToggle('slow');
350                        var showStatDiv = function () {
351                            $this.find('.lp_state').slideToggle('slow');
352                            $this.addClass('review_actv');
353                        };
354                        timVar = setTimeout(showStatDiv, 3000);
355                        //clearTimeout(timVar);
356                    }
357                },
358                error: function (request, error) {
359                    alert(error);
360                }
361            });
362        }
363        e.preventDefault();
364    });
365
366
367    jQuery('.reviews-section a.lol').click(function (e) {
368        var currentVal = '';
369        currentVal = jQuery(this).data('score');
370    });
371
372    jQuery('.reviews-section a.love').click(function (e) {
373        var currentVal = '';
374        currentVal = jQuery(this).data('score');
375    });
376
377
378    /* end by zaheer on 16 march */
379
380
381    /* for update 2.0 */
382    $("body").on('change', '#rewies_form #filer_input2', function (event) {
383
384        var $this = jQuery(this);
385        if ($this.hasClass('dashboard-edit-filter-input2')) {
386            jQuery('.dashboard-edit-filter-input2').removeClass('active_filter_input2');
387            $this.addClass('active_filter_input2');
388
389            var files = event.target.files;
390            var outputt = document.getElementsByClassName('filediv');
391            var output = outputt[0];
392
393            var allowedimgz = $('#rewies_edit-form').data('imgcount');
394            var allowedsize = $('#rewies_edit-form').data('imgsize');
395            var noticecount = $('#rewies_edit-form').data('countnotice');
396            var noticesize = $('#rewies_edit-form').data('sizenotice');
397
398
399            var fp = $(".active_filter_input2");
400            var lg = fp[0].files.length; // get length
401            var items = fp[0].files;
402            var fileSize = 0;
403
404            if (lg > 0) {
405                if (lg <= allowedimgz) {
406
407                    for (var i = 0; i < lg; i++) {
408                        fileSize = fileSize + items[i].size; // get file size
409                    }
410                    if (fileSize > allowedsize) {
411
412                        alert(noticesize);
413                        $this.val('');
414                        $this.text('');
415                    }
416                } else {
417                    alert(noticecount);
418                    $this.val('');
419                    $this.text('');
420                }
421            }
422        }
423        else {
424            var files = event.target.files;
425            var outputt = document.getElementsByClassName('filediv');
426            var output = outputt[0];
427
428            var allowedimgz = $('#rewies_form').attr('data-imgcount');
429            var allowedsize = $('#rewies_form').attr('data-imgsize');
430            var noticecount = $('#rewies_form').attr('data-countnotice');
431            var noticesize = $('#rewies_form').attr('data-sizenotice');
432            var fp = $("#filer_input2");
433            var lg = fp[0].files.length; // get length
434            var items = fp[0].files;
435            var fileSize = 0;
436
437            if (lg > 0) {
438                if (lg <= allowedimgz) {
439
440                    for (var i = 0; i < lg; i++) {
441                        fileSize = fileSize + items[i].size; // get file size
442                    }
443                    if (fileSize > allowedsize) {
444
445                        alert(noticesize);
446                        $('#filer_input2').val('');
447                        $('.submit-images label').text('');
448                    }
449                } else {
450                    alert(noticecount);
451                    $('#filer_input2').val('');
452                    $('.submit-images label').text('');
453                }
454            }
455        }
456
457    });
458    /* end for update 2.0 */
459});

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.