PageSourceSearch

https://www.flooringexpo.com/wp-content/themes/carpetking/js/script.js?ver=1790675546

js flooringexpo.com collected 2026-09-29 11:49:59 UTC 20,872 bytes, 453 lines download raw bytes

1jQuery(document).ready(function($) {
2	    jQuery('#locvalue').html(" - " + jQuery('#input_3_1').val());
3		jQuery('.gform_page_footer .button').on('click', function(){
4		jQuery(window).scrollTop(0);
5	});
6    
7    jQuery(document).on('submit','form#order_status_get',function(e){
8        e.preventDefault();
9        var reference = jQuery(this).find('input[name="reference"]').val();
10        jQuery.ajax({
11            url: CRPKING.ajaxurl,
12            method : 'post',
13            data : {
14                action      : 'cpking_get_order_status',
15                reference   : reference
16            },
17            beforeSend: function() {
18                jQuery(document).find('.order_status.order_status_form').css('opacity','0.1');
19            },
20            success: function (data) {
21                jQuery(document).find('.order_status.order_status_form').css('opacity','1');
22                jQuery(document).find('.order_status.order_status_form').hide();
23                jQuery(document).find('.order_status.order_status_form').after(data);
24            }
25        });
26    });
27    jQuery(document).on('click','.serach_again',function(e){
28        e.preventDefault();
29        jQuery(this).parents('.order_status').remove();
30        jQuery(document).find('.order_status.order_status_form').show();
31        jQuery(document).find('.order_status.order_status_form').find('input[name="reference"]').val('');
32        jQuery('html,body').animate({
33            scrollTop: jQuery('.order_status.order_status_form').offset().top - jQuery(document).find('header').height() 
34        }, 500);
35    });
36    $(document).on('click', '.mailpoet_sub_cb', function() {
37        $(this).toggleClass('subscr_mail_cb');
38    });
39    
40    jQuery('.wpcf7 #appointment_time').val('');
41    jQuery('.wpcf7 #app_time').val('');
42    $('.product-category li').click(function() {
43        var cat_slug = $(this).children().attr('data-slug');
44        if (cat_slug != '') {
45            $('#ajax_loader').css('display', 'block');
46            jQuery.post(CRPKING.ajaxurl, {
47                cat_slug: cat_slug,
48                action: 'search_product_action'
49            }, function(response) {
50                $('#ajax_loader').css('display', 'none');
51                $("#product_list").html(response);
52            });
53        }
54    });
55    $('.sort_products span').click(function() {
56        var sort_type = $(this).attr('id');
57        if (sort_type == 'sort_featured') {
58            $('#ajax_loader').css('display', 'block');
59            jQuery.post(CRPKING.ajaxurl, {
60                action: 'sort_featured_product_action'
61            }, function(response) {
62                $('#ajax_loader').css('display', 'none');
63                if (response != '') {
64                    $("#product_list").html(response);
65                }
66            });
67        } else if (sort_type == 'sort_newest') {
68            $('#ajax_loader').css('display', 'block');
69            jQuery.post(CRPKING.ajaxurl, {
70                action: 'sort_newest_product_action'
71            }, function(response) {
72                $('#ajax_loader').css('display', 'none');
73                if (response != '') {
74                    $("#product_list").html(response);
75                }
76            });
77        } else if (sort_type == 'sort_name') {
78            $('#ajax_loader').css('display', 'block');
79            jQuery.post(CRPKING.ajaxurl, {
80                action: 'sort_name_product_action'
81            }, function(response) {
82                $('#ajax_loader').css('display', 'none');
83                if (response != '') {
84                    $("#product_list").html(response);
85                }
86            });
87        }
88    });
89	jQuery('input[name="appointment_date"], input[name="app_date"]').on('keydown', function() {
90		return false;
91	});
92    jQuery('input[name="appointment_date"]').change(function() {
93        jQuery('.schedule-loader').css('display', '');
94        jQuery('.schedule-loader').insertAfter('#appointment_date');
95        var date = jQuery(this).val();
96       console.log(date);
97        if (date != '') {
98            var temp_date = date.split("/");
99            var new_date = temp_date[2] + '/' + temp_date[0] + '/' + temp_date[1];
100            var new_date_format = temp_date[0] + '-' + temp_date[1] + '-' + temp_date[2];
101// 			var temp_date = date.split("-");
102// 			var new_date = date;
103// 			var new_date_format = temp_date[1] + '-' + temp_date[2] + '-' + temp_date[0];
104            jQuery('#appointment_date_format').val(new_date_format);	
105// 						console.log(new_date_format);
106// 			jQuery(this).val(new_date_format);
107            jQuery.post(CRPKING.ajaxurl, {
108                appointment_date: new_date,
109                action: 'change_time_slots_action'
110            }, function(response) {
111                jQuery('.schedule-loader').css('display', 'none');
112                if (response != '') {
113                    if (jQuery('#appointment_time').length > 0) {
114                        jQuery('#appointment_time').html(response);
115                    } else {
116                        var sel_element = '<span class="wpcf7-form-control-wrap appointment_time">' + '<select name="appointment_time" id="appointment_time" class="wpcf7-select wpcf7-validates-as-required" aria-required="true" aria-invalid="true">' + response + '</select>' + '</span>';
117                        jQuery('.appointment_time_wrap').children().append(sel_element);
118                    }
119                } else {
120                    if (jQuery('#appointment_time').length > 0) {
121                        jQuery('.wpcf7-form-control-wrap.appointment_time').remove();
122                    } else {
123                        swal("The time slot isn't available for selected date. Please select the different date.");
124                        return false;
125                    }
126                }
127            });
128        }
129    });
130    if ($('.appointment-form input[name="appointment_about_other"]').length > 0) {
131        $('.appointment-form input[name="appointment_about_other"]').hide();
132    }
133    if ($('.appointment-form input[name="appointment_about[]"]').length > 0) {
134        $(document).on('click', '.appointment-form input[name="appointment_about[]"]', function() {
135            if ($(this).attr('checked')) {
136                $('input[name="appointment_about[]"]').not(this).prop('checked', false);
137            }
138            if ((this.checked) && (this.value == 'Other')) {
139                $('.appointment-form input[name="appointment_about_other"]').show();
140            } else {
141                $('.appointment-form input[name="appointment_about_other"]').hide();
142            }
143        });
144    }
145    if ($('.project_description').length > 0) {
146        $('.project_description').hide();
147    }
148    $('.appointment-form input[name="appointment_project[]"]').click(function() {
149        var type = this.value;
150        var app_time = jQuery('.wpcf7 #appointment_time').val();
151        if ($(this).attr('checked')) {
152            $('input[name="appointment_project[]"]').not(this).prop('checked', false);
153            var $mail_val = $('input[id="email-' + $(this).attr('value') + '"]').val();
154            $('#mailto').val($mail_val);
155            var $mail_sub = $('input[id="subject-' + $(this).attr('value') + '"]').val();
156            $('#mailsubject').val($mail_sub);
157        }
158        if ((this.checked) && (type == 'Business')) {
159            $('.appointment-date').hide();
160            $('.rooms_option').hide();
161            $('.project_description').show();
162            $('.appointment-message').hide();
163            jQuery('.wpcf7 #appointment_time').val('');
164        } else {
165            $('.appointment-date').show();
166            $('.rooms_option').show();
167            $('.project_description').hide();
168            $('.appointment-message').show();
169            jQuery('.wpcf7 #appointment_time').val(app_time);
170        }
171        if ((this.checked) && (type == 'Home')) {
172            $('.appointment-date').show();
173            $('.rooms_option').show();
174            $('.project_description').hide();
175            jQuery('.wpcf7 #appointment_time').val(app_time);
176        }
177    });
178    if ($('#print_button').length > 0) {
179        $(document).on('click', '#print_button', function() {
180            PrintElem('cupon_codesec');
181        });
182    }
183    $(document).on('click', '#home_submit', function(e) {
184        $('.zipcode-form-loader').css('display', '');
185        var zipcode = $('#home_zipcode').val();
186        jQuery.post(CRPKING.ajaxurl, {
187            zipcode: zipcode,
188            action: 'check_home_page_zipcode'
189        }, function(response) {
190            $('.zipcode-form-loader').css('display', 'none');
191            if (response == 'Success') {
192                $('.home-zipcode-form').submit();
193            } else {
194                swal(response);
195                return false;
196            }
197        });
198        e.preventDefault();
199    });
200    jQuery(document).on('click change', '#appointment_time', function() {
201        var time = $(this).val();
202        jQuery.post(CRPKING.ajaxurl, {
203            time: time,
204            action: 'add_schedule_two_hours_more'
205        }, function(response) {
206            $('#appointment_two_hors_plus_date').val(response);
207        });
208    });
209    var enableDays = CRPKING.temp;
210
211    function enableAllTheseDays(date) {
212        var sdate = $.datepicker.formatDate('d-m-yy', date);
213        if ($.inArray(sdate, enableDays) != -1) {
214            return [true];
215        }
216        return [false];
217    }
218    jQuery('#appointment_date').datepicker({
219//         dateFormat: 'dd-mm-yy',
220		dateFormat: 'mm/dd/yy',
221        beforeShowDay: enableAllTheseDays
222    });
223    
224    /*
225     * Page appointment field changes
226     */
227    $(document).on('click', '.appointment-form input[name="app_project[]"]', function() {
228        $('.carpet_details').hide('normal');
229        var current_val = $(this).val();
230        var app_time = jQuery('.wpcf7 #app_time').val();
231        var app_date = jQuery('.wpcf7 #app_date').val();
232        if ($(this).attr('checked')) {
233            $('input[name="app_project[]"]').not(this).prop('checked', false);
234            var $mail_val = $('input[id="email-' + $(this).attr('value') + '"]').val();
235            $('#mailto').val($mail_val);
236            var $mail_sub = $('input[id="subject-' + $(this).attr('value') + '"]').val();
237            $('#mailsubject').val($mail_sub);
238        }
239        if ((this.checked) && (current_val == 'Business')) {
240            $('.carpet_details').show('normal');
241            $('.appointment-date').hide('normal');
242            $('.rooms_option').hide('normal');
243            $('.project_description').show('normal');
244            $('.appointment-message').hide('normal');
245            jQuery('.wpcf7 #app_time').val('');
246        }
247        if ((this.checked) && (current_val == 'Home') && (app_time !='') && (app_date != '') ) {
248            $('.carpet_details').show('normal');
249            $('.appointment-date').show('normal');
250            $('.rooms_option').show('normal');
251            $('.project_description').hide('normal');
252            jQuery('.wpcf7 #app_time').val(app_time);
253        } else if((this.checked) && (current_val == 'Home')){
254            $('#appointment_date_wrap').show('normal');
255        }
256    });
257    
258    $(document).on('click','#app_time',function(){
259        var app_time = jQuery('.wpcf7 #app_time').val();
260        var app_date = jQuery('.wpcf7 #app_date').val();
261        if(app_time !='' && app_date !=''){
262            $('.carpet_details').show('normal');
263            $('.appointment-date').show('normal');
264            $('.rooms_option').show('normal');
265            $('.project_description').hide('normal');
266            jQuery('.wpcf7 #app_time').val(app_time);
267        }
268    });
269            
270    if ($('.appointment-form input[name="app_about_other"]').length > 0) {
271        $('.appointment-form input[name="app_about_other"]').hide();
272    }
273    if ($('.appointment-form input[name="app_about[]"]').length > 0) {
274        $(document).on('click', '.appointment-form input[name="app_about[]"]', function() {
275            if ($(this).attr('checked')) {
276                $('input[name="app_about[]"]').not(this).prop('checked', false);
277            }
278            if ((this.checked) && (this.value == 'Other')) {
279                $('.appointment-form input[name="app_about_other"]').show('normal');
280            } else {
281                $('.appointment-form input[name="app_about_other"]').hide('normal');
282            }
283        });
284    }
285	
286    jQuery('input[name="app_date"]').change(function() {
287        console.log('in');
288        jQuery('.schedule-loader').css('display', '');
289        jQuery('.schedule-loader').insertAfter('#app_date');
290        var date = jQuery(this).val();
291        if (date != '') {
292            var temp_date = date.split("/");
293            var new_date = temp_date[2] + '/' + temp_date[0] + '/' + temp_date[1];
294            var new_date_format = temp_date[0] + '-' + temp_date[1] + '-' + temp_date[2];
295//             var temp_date = date.split("-");
296// 			var new_date = date;
297// 			var new_date_format = temp_date[1] + '-' + temp_date[2] + '-' + temp_date[0];
298            $('#app_date_format').val(new_date_format);
299            jQuery.post(CRPKING.ajaxurl, {
300                appointment_date: new_date,
301                action: 'change_time_slots_action'
302            }, function(response) {
303                $('.schedule-loader').css('display', 'none');
304                if (response != '') {
305                    if (jQuery('#app_time').length > 0) {
306                        jQuery('#app_time').html(response);
307                    } else {
308                        var sel_element = '<span class="wpcf7-form-control-wrap app_time">' + '<select name="app_time" id="app_time" class="wpcf7-select wpcf7-validates-as-required" aria-required="true" aria-invalid="true">' + response + '</select>' + '</span>';
309                        jQuery('.appointment_time_wrap').children().append(sel_element);
310                    }
311                } else {
312                    if (jQuery('#app_time').length > 0) {
313                        jQuery('.wpcf7-form-control-wrap.app_time').remove();
314                    } else {
315                        swal("The time slot isn't available for selected date. Please select the different date.");
316                        return false;
317                    }
318                }
319            });
320        }
321    });
322    $('#app_date').datepicker({
323        dateFormat: 'mm/dd/yy',
324        beforeShowDay: enableAllTheseDays
325    });
326    
327    $(document).on('click', '.land_app_form input[type="submit"]', function() {
328        $('#page').addClass( 'loader_active' );
329    });
330    $(".land_app_form .wpcf7").on('wpcf7:invalid', function(event){
331        $('#page').removeClass( 'loader_active' );
332    });
333    $(".land_app_form .wpcf7").on('wpcf7:mailsent', function(event){
334        $('#page').removeClass( 'loader_active' );
335    });
336    
337    document.addEventListener( 'wpcf7mailsent', function( event ) {
338        if ( '408' == event.detail.contactFormId ) {
339            crpking_redirect();
340        }
341        if ( '353' == event.detail.contactFormId ) {
342            crpking_financing_redirect();
343        }
344        if ( '837' == event.detail.contactFormId ) {
345            crpking_financing_redirect();
346        }
347        if ( '1703' == event.detail.contactFormId ) {
348            crpking_form_redirect();
349        }
350    }, false );
351});
352
353function crpking_redirect() {
354    var pro_date = jQuery('.wpcf7 input[name=appointment_date]').val();
355    var pro_time = jQuery('.wpcf7 #appointment_time').val();
356    var pro_end_time = jQuery('.wpcf7 #appointment_time').find('option:selected').attr('data-value');
357    var pro_type = jQuery('.wpcf7 #appointment_project :checkbox:checked').map(function() {
358        return jQuery(this).val();
359    }).get();
360    if (pro_type == 'Business') {
361        pro_time = '';
362    }
363    var pro_floors = jQuery('.wpcf7 #appointment_products :checkbox:checked').map(function() {
364        return jQuery(this).val();
365    }).get();
366    var pro_rooms = jQuery('.wpcf7 #appointment_rooms :checkbox:checked').map(function() {
367        return jQuery(this).val();
368    }).get();
369    var pro_firstname = jQuery('.wpcf7 input[name=appointment_first_name]').val();
370    var pro_lastname = jQuery('.wpcf7 input[name=appointment_last_name]').val();
371    var pro_address = jQuery('.wpcf7 input[name=appointment_address]').val();
372    var pro_city = jQuery('.wpcf7 input[name=appointment_city]').val();
373    var pro_state = jQuery('.wpcf7 input[name=appointment_state]').val();
374    var pro_zipcode = jQuery('.wpcf7 input[name=appointment_zipcode]').val();
375    var pro_email = jQuery('.wpcf7 input[name=appointment_email]').val();
376    var pro_phone = jQuery('.wpcf7 input[name=appointment_phone]').val();
377    
378    goog_report_conversion("https://www.carpetking.com/schedule-in-home-estimate/");
379    
380    location = CRPKING.site_url + '/appointment-confirmed/?pro_date=' + pro_date + '&pro_time=' + pro_time + '&pro_end_time=' + pro_end_time + '&pro_type=' + pro_type + '&pro_floors=' + pro_floors + '&pro_rooms=' + pro_rooms + '&pro_firstname=' + pro_firstname + '&pro_lastname=' + pro_lastname + '&pro_address=' + pro_address + '&pro_city=' + pro_city + '&pro_state=' + pro_state + '&pro_zipcode=' + pro_zipcode + '&pro_email=' + pro_email + '&pro_phone=' + pro_phone;
381}
382
383function crpking_form_redirect() {
384    var pro_date = jQuery('.wpcf7 input[name=app_date]').val();
385    var pro_time = jQuery('.wpcf7 #app_time').val();
386    var pro_end_time = jQuery('.wpcf7 #app_time').find('option:selected').attr('data-value');
387    var pro_type = jQuery('.wpcf7 #app_project :checkbox:checked').map(function() {
388        return jQuery(this).val();
389    }).get();
390    if (pro_type == 'Business') {
391        pro_time = '';
392    }
393    var pro_floors = jQuery('.wpcf7 #app_products :checkbox:checked').map(function() {
394        return jQuery(this).val();
395    }).get();
396    var pro_rooms = jQuery('.wpcf7 #app_rooms :checkbox:checked').map(function() {
397        return jQuery(this).val();
398    }).get();
399    var pro_firstname = jQuery('.wpcf7 input[name=app_first_name]').val();
400    var pro_lastname = jQuery('.wpcf7 input[name=app_last_name]').val();
401    var pro_address = jQuery('.wpcf7 input[name=app_address]').val();
402    var pro_city = jQuery('.wpcf7 input[name=app_city]').val();
403    var pro_state = jQuery('.wpcf7 input[name=app_state]').val();
404    var pro_zipcode = jQuery('.wpcf7 input[name=app_zipcode]').val();
405    var pro_email = jQuery('.wpcf7 input[name=your-email]').val();
406    var pro_phone = jQuery('.wpcf7 input[name=app_phone]').val();
407    
408    /* goog_report_conversion("https://www.carpetking.com/schedule-in-home-estimate/"); */
409    
410    location = CRPKING.site_url + '/appointment-confirmed/?pro_date=' + pro_date + '&pro_time=' + pro_time + '&pro_end_time=' + pro_end_time + '&pro_type=' + pro_type + '&pro_floors=' + pro_floors + '&pro_rooms=' + pro_rooms + '&pro_firstname=' + pro_firstname + '&pro_lastname=' + pro_lastname + '&pro_address=' + pro_address + '&pro_city=' + pro_city + '&pro_state=' + pro_state + '&pro_zipcode=' + pro_zipcode + '&pro_email=' + pro_email + '&pro_phone=' + pro_phone;
411}
412
413function crpking_financing_redirect() {
414    location = 'https://etail.mysynchrony.com/eapply/eapply.action?uniqueId=0A96374331BD70815088A5096F511363222142C0A3DB2455&client=Carpet_King';
415}
416
417function PrintElem(elem) {
418    var mywindow = window.open('', 'PRINT', 'height=400,width=600');
419    mywindow.document.write('<html><head><title>' + document.title + '</title>');
420    mywindow.document.write('</head><body >');
421    mywindow.document.write('<h1>' + document.title + '</h1>');
422    mywindow.document.write(document.getElementById(elem).innerHTML);
423    mywindow.document.write('</body></html>');
424    mywindow.document.close();
425    mywindow.focus();
426    mywindow.print();
427    mywindow.close();
428    return true;
429}
430
431function mytest() {
432    jQuery('.appointment_zipcode').find('.wpcf7-not-valid-tip').remove();
433    jQuery('.appointment_zipcode').append('<span role="alert" class="wpcf7-not-valid-tip">Unfortunately we currently don\'t service the zip code that you requested.</span>');
434    swal('Unfortunately we currently don\'t service the zip code that you requested.');
435}
436
437function form_zipcode_test() {
438    jQuery('.app_zipcode').find('.wpcf7-not-valid-tip').remove();
439    jQuery('.app_zipcode').append('<span role="alert" class="wpcf7-not-valid-tip">Unfortunately we currently don\'t service the zip code that you requested.</span>');
440    swal('Unfortunately we currently don\'t service the zip code that you requested.');
441}
442
443jQuery(document).ready(function($) {
444jQuery('#input_3_1').change(function() {
445	//alert('sdsd');
446     var val = jQuery(this).val();
447     if(val == 'Schedule a FREE In-Home Consultation'){
448
449         window.location.href = "https://www.flooringexpo.com/schedule-in-home-estimate";
450
451     }
452});
453	});

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.