PageSourceSearch

https://ruffey-le-chateau.fr/wp-content/plugins/booking/js/client.js?ver=10.3

js ruffey-le-chateau.fr collected 2026-10-02 23:03:34 UTC 34,648 bytes, 753 lines download raw bytes

1// == Submit Booking Data ==============================================================================================
2
3// Check fields at form and then send request
4function mybooking_submit( submit_form , bk_type, wpdev_active_locale){
5
6    var target_elm = jQuery( ".booking_form_div" ).trigger( "booking_form_submit_click", [bk_type, submit_form, wpdev_active_locale] );     //FixIn: 8.8.3.13
7    if  (
8            ( jQuery( target_elm ).find( 'input[name="booking_form_show_summary"]' ).length > 0 )
9         && ( 'pause_submit' === jQuery( target_elm ).find( 'input[name="booking_form_show_summary"]' ).val() )
10        )
11    {
12        return false;
13    }
14
15    //FixIn: 8.4.0.2
16    var is_error = wpbc_check_errors_in_booking_form( bk_type );
17    if ( is_error ) { return false; }
18
19    // Show message if no selected days in Calendar(s)
20    if (document.getElementById('date_booking' + bk_type).value == '')  {
21
22        var arr_of_selected_additional_calendars = wpbc_get_arr_of_selected_additional_calendars( bk_type );            //FixIn: 8.5.2.26
23
24        if ( arr_of_selected_additional_calendars.length == 0 ) {
25            wpbc_front_end__show_message__error_under_element( '#booking_form_div' + bk_type + ' .bk_calendar_frame', _wpbc.get_message( 'message_check_no_selected_dates' ), 3000 );
26            return;
27        }
28    }
29
30    var count = submit_form.elements.length;
31    var formdata = '';
32    var inp_value;
33    var element;
34    var el_type;
35
36
37    //FixIn:6.1.1.3
38    if( typeof( wpbc_is_this_time_selection_not_available ) == 'function' ) {
39
40        if ( document.getElementById('date_booking' + bk_type).value == '' )  {         // Primary calendar not selected.
41
42            if ( document.getElementById('additional_calendars' + bk_type ) != null ) { // Checking additional calendars.
43
44                var id_additional_str = document.getElementById('additional_calendars' + bk_type).value; //Loop have to be here based on , sign
45                var id_additional_arr = id_additional_str.split(',');
46                var is_times_dates_ok = false;
47                for ( var ia=0;ia<id_additional_arr.length;ia++ ) {
48                    if (
49                            ( document.getElementById('date_booking' + id_additional_arr[ia] ).value != '' )
50                         && ( ! wpbc_is_this_time_selection_not_available( id_additional_arr[ia], submit_form.elements ) )
51                       ){
52                        is_times_dates_ok = true;
53                    }
54                }
55                if ( ! is_times_dates_ok ) return;
56            }
57        } else {                                                                        //Primary calendar selected.
58            if ( wpbc_is_this_time_selection_not_available( bk_type, submit_form.elements ) )
59                return;
60        }
61    }
62
63
64
65    // Serialize form here
66    for ( var i = 0; i < count; i++ ){  //FixIn: 9.1.5.1
67        element = submit_form.elements[i];
68
69        if ( jQuery( element ).closest( '.booking_form_garbage' ).length ) {
70            continue;       // Skip elements from garbage                                           //FixIn: 7.1.2.14
71        }
72
73        if (
74               ( element.type !== 'button' )
75            && ( element.type !== 'hidden' )
76            && ( element.name !== ( 'date_booking' + bk_type ) )
77            // && ( jQuery( element ).is( ':visible' ) )                                            //FixIn: 7.2.1.12.2 // Its prevent of saving hints,  and some other hidden element
78        ) {           // Skip buttons and hidden element - type                                     //FixIn: 7.2.1.12
79
80
81            // Get Element Value
82            if ( element.type == 'checkbox' ){
83
84                if (element.value == '') {
85                    inp_value = element.checked;
86                } else {
87                    if (element.checked) inp_value = element.value;
88                    else inp_value = '';
89                }
90
91            } else if ( element.type == 'radio' ) {
92
93                if (element.checked) {
94                    inp_value = element.value;
95                } else {
96                        // Check  if this radio required,  and if it does not check,  then show warning, otherwise if it is not required or some other option checked skip this loop
97                        // We need to  check  it here, because radio have the several  options with  same name and type, and otherwise we will save several options with  selected and empty values.
98                    if (                                                        //FixIn: 7.0.1.62
99                           ( element.className.indexOf('wpdev-validates-as-required') !== -1 )
100                        && ( jQuery( element ).is( ':visible' ) )                                            //FixIn: 7.2.1.12.2 // Its prevent of saving hints,  and some other hidden element
101                        && ( ! jQuery(':radio[name="'+element.name+'"]', submit_form).is(":checked") ) ) {
102                        wpbc_front_end__show_message__warning( element, _wpbc.get_message( 'message_check_required_for_radio_box' ) );   		//FixIn: 8.5.1.3
103                        return;
104                    }
105                    continue;
106                }
107            } else {
108                inp_value = element.value;
109            }
110
111            // Get value in selectbox of multiple selection
112            if ( (element.type == 'selectbox-multiple') || (element.type == 'select-multiple') ){
113                inp_value = jQuery('[name="'+element.name+'"]').val() ;
114                if (( inp_value == null ) || (inp_value.toString() == '' ))
115                    inp_value='';
116            }
117
118            // Make validation  only  for visible elements
119            if ( jQuery( element ).is( ':visible' ) ) {                                             //FixIn: 7.2.1.12.2
120
121
122                // Recheck for max num. available visitors selection
123                if ( typeof (wpbc__is_less_than_required__of_max_available_slots__bl) == 'function' ){
124                    if ( wpbc__is_less_than_required__of_max_available_slots__bl( bk_type, element ) ){
125                        return;
126                    }
127                }
128
129
130                // Phone validation
131                /*if ( element.name == ('phone'+bk_type) ) {
132                    // we validate a phone number of 10 digits with no comma, no spaces, no punctuation and there will be no + sign in front the number - See more at: http://www.w3resource.com/javascript/form/phone-no-vali
132dation.php#sthash.U9FHwcdW.dpuf
133                    var reg =  /^\d{10}$/;
134                    var message_verif_phone = "Please enter correctly phone number";
135                    if ( inp_value != '' )
136                        if(reg.test(inp_value) == false) {wpbc_front_end__show_message__warning( element , message_verif_phone );return;}
137                }*/
138
139                // Validation Check --- Requred fields
140                if ( element.className.indexOf('wpdev-validates-as-required') !== -1 ){
141                    if  ((element.type =='checkbox') && ( element.checked === false)) {
142                        if ( ! jQuery(':checkbox[name="'+element.name+'"]', submit_form).is(":checked") ) {
143                            wpbc_front_end__show_message__warning( element , _wpbc.get_message( 'message_check_required_for_check_box' ) );   		//FixIn: 8.5.1.3
144                            return;
145                        }
146                    }
147                    if  (element.type =='radio') {
148                        if ( ! jQuery(':radio[name="'+element.name+'"]', submit_form).is(":checked") ) {
149                            wpbc_front_end__show_message__warning( element , _wpbc.get_message( 'message_check_required_for_radio_box' ) );   		//FixIn: 8.5.1.3
150                            return;
151                        }
152                    }
153
154                    if (  (element.type != 'checkbox') && (element.type != 'radio') && ( '' === wpbc_trim( inp_value ) )  ){       //FixIn: 8.8.1.3   //FixIn:7.0.1.39       //FixIn: 8.7.11.12
155                        wpbc_front_end__show_message__warning( element , _wpbc.get_message( 'message_check_required' ) );   		//FixIn: 8.5.1.3
156                        return;
157                    }
158                }
159
160                // Validation Check --- Email correct filling field
161                if ( element.className.indexOf('wpdev-validates-as-email') !== -1 ){
162                    inp_value = inp_value.replace(/^\s+|\s+$/gm,'');                // Trim  white space //FixIn: 5.4.5
163                    var reg = /^([A-Za-z0-9_\-\.\+])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,})$/;
164                    if ( inp_value != '' )
165                        if(reg.test(inp_value) == false) {
166                            wpbc_front_end__show_message__warning( element , _wpbc.get_message( 'message_check_email' ) );   		//FixIn: 8.5.1.3
167                            return;
168                        }
169                }
170
171                // Validation Check --- Same Email Field
172                if ( ( element.className.indexOf('wpdev-validates-as-email') !== -1 ) && ( element.className.indexOf('same_as_') !== -1 ) ) {
173
174                    // Get  the name of Primary Email field from the "same_as_NAME" class
175                    var primary_email_name = element.className.match(/same_as_([^\s])+/gi);
176                    if (primary_email_name != null) { // We found
177                        primary_email_name = primary_email_name[0].substr(8);
178
179                        // Recehck if such primary email field exist in the booking form
180                        if (jQuery('[name="' + primary_email_name + bk_type + '"]').length > 0) {
181
182                            // Recheck the values of the both emails, if they do  not equla show warning
183                            if ( jQuery('[name="' + primary_email_name + bk_type + '"]').val() !== inp_value ) {
184                                wpbc_front_end__show_message__warning( element , _wpbc.get_message( 'message_check_same_email' )  );   		//FixIn: 8.5.1.3
185                                return;
186                            }
187                        }
188                    }
189                    // Skip one loop for the email veryfication field
190                    continue;                                                                                           //FixIn: 8.1.2.15
191                }
192
193            }
194
195            // Get Form Data
196            if ( element.name !== ('captcha_input' + bk_type) ) {
197                if (formdata !=='') formdata +=  '~';                                                // next field element
198
199                el_type = element.type;
200                if ( element.className.indexOf('wpdev-validates-as-email') !== -1 )  el_type='email';
201                if ( element.className.indexOf('wpdev-validates-as-coupon') !== -1 ) el_type='coupon';
202
203                inp_value = inp_value + '';
204                inp_value = inp_value.replace(new RegExp("\\^",'g'), '&#94;'); // replace registered characters
205                inp_value = inp_value.replace(new RegExp("~",'g'), '&#126;'); // replace registered characters
206
207                inp_value = inp_value.replace(/"/g, '&#34;'); // replace double quot
208                inp_value = inp_value.replace(/'/g, '&#39;'); // replace single quot
209
210                if ( 'select-one' == el_type ){
211                    el_type = 'selectbox-one'
212                }
213                if ( 'select-multiple' == el_type ){
214                    el_type = 'selectbox-multiple'
215                }
216
217                formdata += el_type + '^' + element.name + '^' + inp_value ;                    // element attr
218            }
219        }
220
221    }  // End Fields Loop
222
223
224    // TODO: here was function  for 'Check if visitor finish  dates selection.
225
226
227    // Cpatch  verify
228    var captcha = document.getElementById('wpdev_captcha_challenge_' + bk_type);
229
230    //Disable Submit button
231    if (captcha != null)  form_submit_send( bk_type, formdata, captcha.value, document.getElementById('captcha_input' + bk_type).value ,wpdev_active_locale);
232    else                  form_submit_send( bk_type, formdata, '',            '' ,                                                      wpdev_active_locale);
233    return;
234}
235
236
237// Gathering params for sending Ajax request and then send it
238function form_submit_send( bk_type, formdata, captcha_chalange, user_captcha ,wpdev_active_locale){
239
240    var my_booking_form = '';
241    if ( document.getElementById( 'booking_form_type' + bk_type ) != undefined ){
242        my_booking_form = document.getElementById( 'booking_form_type' + bk_type ).value;
243    }
244
245    var my_booking_hash = '';
246    if ( _wpbc.get_other_param( 'this_page_booking_hash' ) != '' ){
247        my_booking_hash = _wpbc.get_other_param( 'this_page_booking_hash' );
248    }
249
250    var is_send_emeils = 1;
251    if ( jQuery('#is_send_email_for_pending').length ) {
252        is_send_emeils = jQuery( '#is_send_email_for_pending' ).is( ':checked' );       //FixIn: 8.7.9.5
253        if ( false === is_send_emeils ) { is_send_emeils = 0; }
254        else                            { is_send_emeils = 1; }
255    }
256
257    if ( document.getElementById( 'date_booking' + bk_type ).value != '' ){        //FixIn:6.1.1.3
258        send_ajax_submit( bk_type, formdata, captcha_chalange, user_captcha, is_send_emeils, my_booking_hash, my_booking_form, wpdev_active_locale ); // Ajax sending request
259    } else {
260        jQuery( '#booking_form_div' + bk_type ).hide();
261        jQuery( '#submiting' + bk_type ).hide();
262    }
263
264    var formdata_additional_arr;
265    var formdata_additional;
266    var my_form_field;
267    var id_additional;
268    var id_additional_str;
269    var id_additional_arr;
270    if ( document.getElementById( 'additional_calendars' + bk_type ) != null ){
271
272        id_additional_str = document.getElementById('additional_calendars' + bk_type).value;                            //Loop have to be here based on , sign
273        id_additional_arr = id_additional_str.split(',');
274
275        if ( ! jQuery( '#booking_form_div' + bk_type ).is( ':visible' ) ) {
276            wpbc_booking_form__spin_loader__show( bk_type );                                                            // Show Spinner
277        }
278
279        for ( var ia = 0; ia < id_additional_arr.length; ia++ ){
280            formdata_additional_arr = formdata;
281            formdata_additional = '';
282            id_additional = id_additional_arr[ia];
283
284
285            formdata_additional_arr = formdata_additional_arr.split('~');
286            for (var j=0;j<formdata_additional_arr.length;j++) {
287                my_form_field = formdata_additional_arr[j].split('^');
288                if (formdata_additional !=='') formdata_additional +=  '~';
289
290                if (my_form_field[1].substr( (my_form_field[1].length -2),2)=='[]')
291                  my_form_field[1] = my_form_field[1].substr(0, (my_form_field[1].length - (''+bk_type).length ) - 2 ) + id_additional + '[]';
292                else
293                  my_form_field[1] = my_form_field[1].substr(0, (my_form_field[1].length - (''+bk_type).length ) ) + id_additional ;
294
295
296                formdata_additional += my_form_field[0] + '^' + my_form_field[1] + '^' + my_form_field[2];
297            }
298
299            if ( jQuery('#gateway_payment_forms' + bk_type).length > 0 ) {         // If Payment form  for main  booking resources is showing then append payment form  for additional  calendars.
300                jQuery('#gateway_payment_forms' + bk_type).after('<div id="gateway_payment_forms'+id_additional+'"></div>');
301                jQuery('#gateway_payment_forms' + bk_type).after('<div id="ajax_respond_insert'+id_additional+'" style="display:none;"></div>');
302            }
303            //FixIn: 8.5.2.17
304            send_ajax_submit( id_additional ,formdata_additional,captcha_chalange,user_captcha,is_send_emeils,my_booking_hash,my_booking_form ,wpdev_active_locale  );  // Submit
305        }
306    }
307}
308
309
310//<![CDATA[
311function send_ajax_submit( resource_id, formdata, captcha_chalange, user_captcha, is_send_emeils, my_booking_hash, my_booking_form, wpdev_active_locale ){
312
313    // Disable Submit | Show spin loader
314    wpbc_booking_form__on_submit__ui_elements_disable( resource_id )
315
316    var is_exit = wpbc_ajx_booking__create( {
317                                'resource_id'              : resource_id,
318                                'dates_ddmmyy_csv'         : document.getElementById( 'date_booking' + resource_id ).value,
319                                'formdata'                 : formdata,
320                                'booking_hash'             : my_booking_hash,
321                                'custom_form'              : my_booking_form,
322                                'aggregate_resource_id_arr': ( ( null !== _wpbc.booking__get_param_value( resource_id, 'aggregate_resource_id_arr' ))
323                                                                        ? _wpbc.booking__get_param_value( resource_id, 'aggregate_resource_id_arr' ).join( ',' ) : ''),
324                                'captcha_chalange'   : captcha_chalange,
325                                'captcha_user_input' : user_captcha,
326
327                                'is_emails_send'     : is_send_emeils,
328                                'active_locale'      : wpdev_active_locale
329                            } );
330    if ( true === is_exit ){
331        return;
332    }
333}
334//]]>
335
336
337// Hint labels inside of input boxes
338jQuery(document).ready( function(){
339
340    jQuery('div.inside_hint').on( 'click', function(){                   //FixIn: 8.7.11.12
341            jQuery(this).css('visibility', 'hidden').siblings('.has-inside-hint').trigger( 'focus' );   //FixIn: 8.7.11.12
342    });
343
344    jQuery('input.has-inside-hint').on( 'blur', function(){                   //FixIn: 8.7.11.12
345        if ( this.value == '' )
346            jQuery(this).siblings('.inside_hint').css('visibility', '');
347    }).on( 'focus', function(){                                                 //FixIn: 8.7.11.12
348            jQuery(this).siblings('.inside_hint').css('visibility', 'hidden');
349    });
350
351    jQuery('.booking_form_div input[type=button]').prop("disabled", false);
352});
353
354
355//FixIn: 8.4.0.2
356/**
357 * Check errors in booking form  fields, and show warnings if some errors exist.
358 * Check  errors,  like not selected dates or not filled requred form  fields, or not correct entering email or phone fields,  etc...
359 *
360 * @param bk_type  int (ID of booking resource)
361 */
362function wpbc_check_errors_in_booking_form( bk_type ) {
363
364    var is_error_in_field = false;  // By default, all  is good - no error
365
366    var my_form = jQuery( '#booking_form' + bk_type );
367
368    if ( my_form.length ) {
369
370        var fields_with_errors_arr = [];
371
372        // Pseudo-selector that get form elements <input , <textarea , <select, <button...
373        my_form.find( ':input' ).each( function( index, el ) {
374
375            // Skip some elements
376            var skip_elements = [ 'hidden', 'button' ];
377
378            if (  -1 == skip_elements.indexOf( jQuery( el ).attr( 'type' ) )  ){
379
380				// Check Calendar Dates Selection
381                if ( ( 'date_booking' + bk_type ) == jQuery( el ).attr( 'name' ) ) {
382
383                    // Show Warning only  if the calendar visible ( we are at step with  calendar)
384                    if (
385                            (  ( jQuery( '#calendar_booking' + bk_type ).is( ':visible' )  ) && ( '' == jQuery( el ).val() )  )
386                         && ( wpbc_get_arr_of_selected_additional_calendars( bk_type ).length == 0 )                    //FixIn: 8.5.2.26
387                    ){            //FixIn: 8.4.4.5
388
389                        var notice_message_id = wpbc_front_end__show_message__error_under_element( '#booking_form_div' + bk_type + ' .bk_calendar_frame', _wpbc.get_message( 'message_check_no_selected_dates' ) , 3000 );
390
391						//wpbc_do_scroll('#calendar_booking' + bk_type);            // Scroll to the calendar    		//FixIn: 8.5.1.3
392						is_error_in_field = true;    // Error
393                    }
394                }
395
396                // Check only visible elements at this step
397                if ( jQuery( el ).is( ':visible' )  ){
398// console.log( '|id, type, val, visible|::', jQuery( el ).attr( 'name' ), '|' + jQuery( el ).attr( 'type' ) + '|', jQuery( el ).val(), jQuery( el ).is( ':visible' ) );
399
400					// Is Required
401					if ( jQuery( el ).hasClass( 'wpdev-validates-as-required' ) ){
402
403						// Checkboxes
404						if ( 'checkbox' == jQuery( el ).attr( 'type' ) ){
405
406                            if (
407                                    ( ! jQuery( el ).is( ':checked' ))
408                                 && ( ! jQuery( ':checkbox[name="' + el.name + '"]', my_form ).is( ":checked" ) )       //FixIn: 8.5.2.12
409                            ){
410                                var checkbox_parent_element;
411
412                                if ( jQuery( el ).parents( '.wpdev-form-control-wrap' ).length > 0 ){
413
414                                    checkbox_parent_element = jQuery( el ).parents( '.wpdev-form-control-wrap' );
415
416                                } else if ( jQuery( el ).parents( '.controls' ).length > 0 ){
417
418                                    checkbox_parent_element = jQuery( el ).parents( '.controls' );
419
420                                } else {
421
422                                    checkbox_parent_element = jQuery( el );
423                                }
424                                var notice_message_id = wpbc_front_end__show_message__warning( checkbox_parent_element, _wpbc.get_message( 'message_check_required_for_check_box' ) );
425
426                                fields_with_errors_arr.push( el );
427								is_error_in_field = true;    // Error
428							}
429
430							// Radio boxes
431						} else if ( 'radio' == jQuery( el ).attr( 'type' ) ){
432
433							if ( !jQuery( ':radio[name="' + jQuery( el ).attr( 'name' ) + '"]', my_form ).is( ':checked' ) ){
434                                var notice_message_id = wpbc_front_end__show_message__warning( jQuery( el ).parents('.wpdev-form-control-wrap'), _wpbc.get_message( 'message_check_required_for_radio_box' ) );
435                                fields_with_errors_arr.push( el );
436								is_error_in_field = true;    // Error
437							}
438
439							// Other elements
440						} else {
441
442							var inp_value = jQuery( el ).val();
443
444                            if ( '' === wpbc_trim( inp_value ) ){                                                       //FixIn: 8.8.1.3        //FixIn: 8.7.11.12
445
446                                var notice_message_id = wpbc_front_end__show_message__warning( el, _wpbc.get_message( 'message_check_required' ) );
447
448                                fields_with_errors_arr.push( el );
449								is_error_in_field = true;    // Error
450							}
451						}
452					}
453
454					// Validate Email
455					if ( jQuery( el ).hasClass( 'wpdev-validates-as-email' ) ){
456						var inp_value = jQuery( el ).val();
457						inp_value = inp_value.replace( /^\s+|\s+$/gm, '' );                // Trim  white space //FixIn: 5.4.5
458						var reg = /^([A-Za-z0-9_\-\.\+])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,})$/;
459						if ( (inp_value != '') && (reg.test( inp_value ) == false) ){
460
461                            var notice_message_id = wpbc_front_end__show_message__warning( el, _wpbc.get_message( 'message_check_email' ) );
462                            fields_with_errors_arr.push( el );
463							is_error_in_field = true;    // Error
464						}
465					}
466
467					// Validate For digit entering - for example for - Phone
468					// <p>Digit Field:<br />[text* dig_field class:validate_as_digit] </p>
469					// <p>Phone:<br />[text* phone class:validate_digit_8] </p>
470
471					var classList = jQuery( el ).attr( 'class' );
472
473					if ( classList ){
474
475						classList = classList.split( /\s+/ );
476
477                        jQuery.each( classList, function ( cl_index, cl_item ){
478
479                            ////////////////////////////////////////////////////////////////////////////////////////////
480
481                            // Validate field value as "Date"   [CSS class - 'validate_as_digit']
482                            if ( 'validate_as_date' === cl_item ) {
483
484                                // Valid values: 09-25-2018, 09/25/2018, 09-25-2018,  31-9-1918  ---   m/d/Y, m.d.Y, m-d-Y, d/m/Y, d.m.Y, d-m-Y
485                                var regex = new RegExp( '^[0-3]?\\d{1}[\\/\\.\\-]+[0-3]?\\d{1}[\\/\\.\\-]+[0-2]+\\d{3}$' );       // Check for Date 09/25/2018
486                                var message_verif_phone = 'This field must be valid date like this ' + '09/25/2018';
487                                var inp_value = jQuery( el ).val();
488
489                                if (  ( inp_value != '' ) && ( regex.test( inp_value ) == false )  ){
490                                    wpbc_front_end__show_message__warning( el, message_verif_phone );
491                                    fields_with_errors_arr.push( el );
492                                    is_error_in_field = true;    // Error
493                                }
494                            }
495
496                            ////////////////////////////////////////////////////////////////////////////////////////////
497
498                            // Validate field value as "DIGIT"   [CSS class - 'validate_as_digit']
499                            if ( 'validate_as_digit' === cl_item ) {
500
501                                var regex = new RegExp( '^[0-9]+\\.?[0-9]*$' );       // Check for digits
502                                var message_verif_phone = 'This field must contain only digits';
503                                var inp_value = jQuery( el ).val();
504
505                                if (  ( inp_value != '' ) && ( regex.test( inp_value ) == false )  ){
506                                    wpbc_front_end__show_message__warning( el, message_verif_phone );
507                                    fields_with_errors_arr.push( el );
508                                    is_error_in_field = true;    // Error
509                                }
510                            }
511
512                            ////////////////////////////////////////////////////////////////////////////////////////////
513
514                            // Validate field value as "Phone" number or any other valid number wth specific number of digits [CSS class - 'validate_digit_8' || 'validate_digit_10' ]
515                            var is_validate_digit = cl_item.substring( 0, 15 );
516
517                            // Check  if class start  with 'validate_digit_'
518                            if ( 'validate_digit_' === is_validate_digit ){
519
520                                // Get  number of digit in class: validate_digit_8 => 8 or validate_digit_10 => 10
521                                var digits_to_check = parseInt( cl_item.substring( 15 ) );
522
523                                // Check  about any errors in
524                                if ( !isNaN( digits_to_check ) ){
525
526                                    var regex = new RegExp( '^\\d{' + digits_to_check + '}$' );       // We was valid it as parseInt - only integer variable - digits_to_check
527                                    var message_verif_phone = 'This field must contain ' + digits_to_check + ' digits';
528                                    var inp_value = jQuery( el ).val();
529
530									if (  ( inp_value != '' ) && ( regex.test( inp_value ) == false )  ){
531                                        wpbc_front_end__show_message__warning( el, message_verif_phone );
532                                        fields_with_errors_arr.push( el );
533                                        is_error_in_field = true;    // Error
534                                    }
535                                }
536                            }
537
538                            ////////////////////////////////////////////////////////////////////////////////////////////
539
540                        });
541    				}
542                }
543			}
544        } );
545
546        if ( fields_with_errors_arr.length > 0 ){
547            jQuery( fields_with_errors_arr[ 0 ] ).trigger( 'focus' );    //FixIn: 9.3.1.9
548        }
549	}
550
551    return is_error_in_field;
552}
553
554
555//FixIn: 8.6.1.15
556/**
557 * Go to next  specific step in Wizard style booking form, with
558 * check all required elements specific step, otherwise show warning message!
559 *
560 * @param el
561 * @param step_num
562 * @returns {boolean}
563 */
564function wpbc_wizard_step( el, step_num, step_from ){
565    var br_id = jQuery( el ).closest( 'form' ).find( 'input[name^="bk_type"]' ).val();
566
567    //FixIn: 8.8.1.5
568    if ( ( undefined == step_from ) || ( step_num > step_from ) ){
569        if ( 1 != step_num ){                                                                       //FixIn: 8.7.7.8
570            var is_error = wpbc_check_errors_in_booking_form( br_id );
571            if ( is_error ){
572                return false;
573            }
574        }
575    }
576
577    if ( wpbc_is_some_elements_visible( br_id, ['rangetime', 'durationtime', 'starttime', 'endtime'] ) ){
578        if ( wpbc_is_this_time_selection_not_available( br_id, document.getElementById( 'booking_form' + br_id ) ) ){
579            return false;
580        }
581    }
582
583    if ( br_id != undefined ){
584        jQuery( "#booking_form" + br_id + " .wpbc_wizard_step" ).css( {"display": "none"} ).removeClass('wpbc_wizard_step_hidden');
585        jQuery( "#booking_form" + br_id + " .wpbc_wizard_step" + step_num ).css( {"display": "block"} );
586    }
587}
588
589//FixIn: 10.1.3.2
590jQuery( document ).ready( function (){
591
592    // CSS classes in Wizard Next / Prior links can  be like this:  <a class="wpbc_button_light wpbc_wizard_step_button wpbc_wizard_step_1">Step 1</a>   |  <a class="wpbc_button_light wpbc_wizard_step_button wpbc_wizard_step_2">Step 2</a>
593
594    jQuery( '.wpbc_wizard_step_button' ).attr( {
595        href: 'javascript:void(0)'
596    } );
597
598    jQuery( '.wpbc_wizard_step_button' ).on( 'click', function ( event ){
599
600        var found_steps_arr = jQuery( this ).attr( 'class' ).match( /wpbc\_wizard\_step\_([\d]+)([\s'"]+|$)/ );
601
602        if ( (null !== found_steps_arr) && (found_steps_arr.length > 2) ){
603            var step = parseInt( found_steps_arr[ 1 ] );
604            if ( step > 0 ){
605                wpbc_wizard_step( this, step );
606            }
607        }
608    } );
609
610} );
611
612
613//FixIn: 8.6.1.15
614/**
615 * Check if at least  one element from  array  of  elements names in booking form  visible  or not.
616 * Usage Example:   if ( wpbc_is_some_elements_visible( br_id, ['rangetime', 'durationtime', 'starttime', 'endtime'] ) ){ ... }
617 *
618 * @param bk_type
619 * @param elements_names
620 * @returns {boolean}
621 */
622function wpbc_is_some_elements_visible( bk_type, elements_names ){
623
624    var is_some_elements_visible = false;
625
626    var my_form = jQuery( '#booking_form' + bk_type );
627
628    if ( my_form.length ){
629
630        // Pseudo-selector that get form elements <input , <textarea , <select, <button...
631        my_form.find( ':input' ).each( function ( index, el ){
632
633            // Skip some elements
634            var skip_elements = ['hidden', 'button'];
635
636            if ( -1 == skip_elements.indexOf( jQuery( el ).attr( 'type' ) ) ){
637
638                for ( var ei = 0; ei < ( elements_names.length - 1) ; ei++ ){
639
640                    // Check Calendar Dates Selection
641                    if ( (elements_names[ ei ] + bk_type) == jQuery( el ).attr( 'name' ) ){
642
643                        if ( jQuery( el ).is( ':visible' ) ){
644                            is_some_elements_visible = true;
645                        }
646                    }
647                }
648            }
649        } );
650    }
651    return is_some_elements_visible;
652}
653
654// == Days Selections - support functions ==============================================================================
655
656/**
657 * Get first day of selection
658 *
659 * @param dates
660 * @returns {string|*}
661 */
662function get_first_day_of_selection(dates) {
663
664    // Multiple days selections
665    if ( dates.indexOf( ',' ) != -1 ){
666        var dates_array = dates.split( /,\s*/ );
667        var length = dates_array.length;
668        var element = null;
669        var new_dates_array = [];
670
671        for ( var i = 0; i < length; i++ ){
672
673            element = dates_array[ i ].split( /\./ );
674
675            new_dates_array[ new_dates_array.length ] = element[ 2 ] + '.' + element[ 1 ] + '.' + element[ 0 ];       //2013.12.20
676        }
677        new_dates_array.sort();
678
679        element = new_dates_array[ 0 ].split( /\./ );
680
681        return element[ 2 ] + '.' + element[ 1 ] + '.' + element[ 0 ];                    //20.12.2013
682    }
683
684    // Range days selection
685    if ( dates.indexOf( ' - ' ) != -1 ){
686        var start_end_date = dates.split( " - " );
687        return start_end_date[ 0 ];
688    }
689
690    // Single day selection
691    return dates;                                                               //20.12.2013
692}
693
694// Get last day of selection
695function get_last_day_of_selection(dates) {
696
697    // Multiple days selections
698    if ( dates.indexOf(',') != -1 ){
699        var dates_array =dates.split(/,\s*/);
700        var length = dates_array.length;
701        var element = null;
702        var new_dates_array = [];
703
704        for (var i = 0; i < length; i++) {
705
706          element = dates_array[i].split(/\./);
707
708          new_dates_array[new_dates_array.length] = element[2]+'.' + element[1]+'.' + element[0];       //2013.12.20
709        }
710        new_dates_array.sort();
711
712        element = new_dates_array[(new_dates_array.length-1)].split(/\./);
713
714        return element[2]+'.' + element[1]+'.' + element[0];                    //20.12.2013
715    }
716
717    // Range days selection
718    if ( dates.indexOf(' - ') != -1 ){
719        var start_end_date = dates.split(" - ");
720        return start_end_date[(start_end_date.length-1)];
721    }
722
723    // Single day selection
724    return dates;                                                               //20.12.2013
725}
726
727
728/**
729 * Check ID of selected additional calendars
730 *
731 * @param int bk_type
732 * @returns array
733 */
734function wpbc_get_arr_of_selected_additional_calendars( bk_type ){                                                      //FixIn: 8.5.2.26
735
736    var selected_additionl_calendars = [];
737
738    // Checking according additional calendars
739    if ( document.getElementById( 'additional_calendars' + bk_type ) != null ){
740
741        var id_additional_str = document.getElementById( 'additional_calendars' + bk_type ).value;
742        var id_additional_arr = id_additional_str.split( ',' );
743
744        var is_all_additional_days_unselected = true;
745
746        for ( var ia = 0; ia < id_additional_arr.length; ia++ ){
747            if ( document.getElementById( 'date_booking' + id_additional_arr[ ia ] ).value != '' ){
748                selected_additionl_calendars.push( id_additional_arr[ ia ] );
749            }
750        }
751    }
752    return selected_additionl_calendars;
753}

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.