PageSourceSearch

https://schwimmbad-messen.ch/wp-content/plugins/booking-calendar-com/inc/js/biz_s.js

js schwimmbad-messen.ch collected 2026-10-03 00:55:19 UTC 28,670 bytes, 669 lines download raw bytes

1
2/**
3 *  >= Business Small ...
4 */
5
6	/**
7	 * Hover dates in calendar, when mouse over
8	 *
9	 * @param sql_class_day
10	 * @param date
11	 * @param resource_id
12	 */
13	function wpbc__calendar__do_days_highlight__bs( sql_class_day, date, resource_id ){
14
15		var inst = jQuery.datepick._getInst( document.getElementById( 'calendar_booking' + resource_id ) );
16
17		if ( 'function' === typeof (wpbc__conditions__for_range_days__first_date__bm) ){
18			wpbc__conditions__for_range_days__first_date__bm( date, resource_id );				// Highlight dates based on the conditions
19		}
20
21
22		var td_overs = [];
23		var i;
24		var start_day_num;
25		var working_date;
26
27		// Fixed Days Selection mode - 1 mouse click
28		if ( 'fixed' == _wpbc.calendar__get_param_value( resource_id, 'days_select_mode' ) ){
29
30			wpbc_calendars__clear_days_highlighting();																		// Clear days highlighting in all  calendar
31
32			// Set START_WEEK_DAY 	depends on season
33			if ( 'function' === typeof ( wpbc__conditions__set_START_WEEK_DAY__depend_on_season__bm ) ){ wpbc__conditions__set_START_WEEK_DAY__depend_on_season__bm( resource_id, date, 'start' ); }
34
35			// 1. Find the closest start WeekDay to the hover day
36			if ( -1 != _wpbc.calendar__get_param_value( resource_id, 'fixed__week_days__start' ) ){
37
38				start_day_num = wpbc_get_abs_closest_value_in_arr( date.getDay(), _wpbc.calendar__get_param_value( resource_id, 'fixed__week_days__start' ) );
39				date.setDate( date.getDate() - (date.getDay() - start_day_num) );
40
41				// Update NUMBER_OF_DAYS_TO_SELECT    depends on    week_day / season
42				if ( 'function' === typeof (wpbc__conditions__set_NUMBER_OF_DAYS_TO_SELECT__depend_on_date__bm)  ){ wpbc__conditions__set_NUMBER_OF_DAYS_TO_SELECT__depend_on_date__bm( date, resource_id ); }
43			}
44
45			// Go back of    START_WEEK_DAY 	to original shortcode
46			if ( 'function' === typeof ( wpbc__conditions__set_START_WEEK_DAY__depend_on_season__bm ) ){ wpbc__conditions__set_START_WEEK_DAY__depend_on_season__bm( resource_id, date, 'end' ); }
47
48
49			// 2. When we are mouseover the date, that selected. Do not highlight it.
50			if ( wpbc_is_this_day_among_selected_days( date, inst.dates ) ){
51				return false;
52			}
53
54
55			for ( i = 0; i < _wpbc.calendar__get_param_value( resource_id, 'fixed__days_num' ); i++ ){                                                      			// Recheck  if all days are available for the booking
56
57				sql_class_day = wpbc__get__sql_class_date( date );
58
59				if ( ! wpbc_is_this_day_selectable( resource_id, sql_class_day ) ){											// Check if day is selectable
60					document.body.style.cursor = 'default';
61					return false;
62				}
63
64				td_overs[ td_overs.length ] = '#calendar_booking' + resource_id + ' .cal4date-' + wpbc__get__td_class_date( date );
65
66				date.setDate( date.getDate() + 1 );                                                               			// set next date
67			}
68
69			// Highlight days
70			for ( i = 0; i < td_overs.length; i++ ){
71				jQuery( td_overs[ i ] ).addClass( 'datepick-days-cell-over' );
72			}
73			return true;
74
75		} // End Fixed days selection
76
77
78		// Range Days Selection mode - 2 mouse clicks
79		if ( 'dynamic' == _wpbc.calendar__get_param_value( resource_id, 'days_select_mode' ) ){
80
81			wpbc_calendars__clear_days_highlighting();																		// Clear days highlighting in all  calendar
82
83			// Highlight days before selection
84			if ( 1 !== inst.dates.length ){         	// Situation, when we do not click 1 time. Not selected at all, or made selection.
85
86				// Get this first mouse over date
87				working_date = new Date();
88				working_date.setFullYear( date.getFullYear(), (date.getMonth()), (date.getDate()) );
89
90				// We are mouseover selected date - do not highlight it
91				if ( wpbc_is_this_day_among_selected_days( working_date, inst.dates ) ){
92					return false;
93				}
94
95				// Set START_WEEK_DAY 	depends on season
96				if ( 'function' === typeof ( wpbc__conditions__set_START_WEEK_DAY__depend_on_season__bm ) ){ wpbc__conditions__set_START_WEEK_DAY__depend_on_season__bm( resource_id, date, 'start' ); }
97
98				if (  -1 != _wpbc.calendar__get_param_value( resource_id, 'dynamic__week_days__start' ) ){
99
100					start_day_num = wpbc_get_abs_closest_value_in_arr( date.getDay(), _wpbc.calendar__get_param_value( resource_id, 'dynamic__week_days__start' ) );
101					working_date.setDate( date.getDate() - (date.getDay() - start_day_num) );
102
103					// Update NUMBER_OF_DAYS_TO_SELECT    depends on    week_day / season
104					if ( 'function' === typeof (wpbc__conditions__set_NUMBER_OF_DAYS_TO_SELECT__depend_on_date__bm)  ){ wpbc__conditions__set_NUMBER_OF_DAYS_TO_SELECT__depend_on_date__bm( working_date, resource_id ); }
105
106				}
107
108				// Go back of    START_WEEK_DAY 	to original shortcode
109				if ( 'function' === typeof ( wpbc__conditions__set_START_WEEK_DAY__depend_on_season__bm ) ){ wpbc__conditions__set_START_WEEK_DAY__depend_on_season__bm( resource_id, date, 'end' ); }
110
111				i = 0;
112
113				// Get dates to select		// FixIn: 9.9.0.29.
114				while ( i < parseInt( _wpbc.calendar__get_param_value( resource_id, 'dynamic__days_min' ) ) ){
115					i++;
116					sql_class_day = wpbc__get__sql_class_date( working_date );
117					if ( ! wpbc_is_this_day_selectable( resource_id, sql_class_day ) ){										// Check if day is selectable
118						document.body.style.cursor = 'default';
119						return false;
120					}
121					td_overs[ td_overs.length ] = '#calendar_booking' + resource_id + ' .cal4date-' + wpbc__get__td_class_date( working_date );
122
123					working_date.setDate( working_date.getDate() + 1 );                                       				// set next date
124				}
125
126
127			} else { 					// First day clicked in calendar e.g. -- (inst.dates.length == 1)
128
129				/**
130				 * If we already clicked 1st time on date in calendar, then we need to highlight dates starting from
131				 * this first selected date, that's why  we start operation  here from  first  selected date,  e.g.:
132				 * inst.dates[ 0 ]
133				 */
134
135				working_date = new Date();
136				working_date.setFullYear( inst.dates[ 0 ].getFullYear(), (inst.dates[ 0 ].getMonth()), (inst.dates[ 0 ].getDate()) ); 	// Get "FIRST SELECTED DATE"
137				var is_check = true;
138				i = 0;
139												// FixIn: 9.9.0.29.
140				while ( ( is_check ) || ( i < parseInt( _wpbc.calendar__get_param_value( resource_id, 'dynamic__days_min' ) ) ) ){                                         		// Until rich MIN days number.
141					i++;
142					sql_class_day = wpbc__get__sql_class_date( working_date );
143
144					if ( ! wpbc_is_this_day_selectable( resource_id, sql_class_day ) ){										// Check if day is selectable
145						document.body.style.cursor = 'default';
146						return false;
147					}
148
149					td_overs[ td_overs.length ] = '#calendar_booking' + resource_id + ' .cal4date-' + wpbc__get__td_class_date( working_date );
150
151					// Check  for SEPARATE / DISCRETE DAYS, if we among them
152					var is_discrete_ok = true;
153					if ( _wpbc.calendar__get_param_value( resource_id, 'dynamic__days_specific' ).length > 0 ){              					// check if we set some discrete dates
154						is_discrete_ok = false;
155						for ( var di = 0; di < _wpbc.calendar__get_param_value( resource_id, 'dynamic__days_specific' ).length; di++ ){   		// check if current number of days inside discrete one
156
157							if ( i == _wpbc.calendar__get_param_value( resource_id, 'dynamic__days_specific' )[ di ] ){
158								is_discrete_ok = true;
159								break;
160							}
161						}
162					}
163
164					// Current Hovering date,  which  in [discrete]
165					if (   (is_discrete_ok)
166						&& (date.getMonth() == working_date.getMonth())
167						&& (date.getDate() == working_date.getDate())
168						&& (date.getFullYear() == working_date.getFullYear())
169					){
170						is_check = false;
171					}
172
173					// Inside  [min...max] and in [discrete]		// FixIn: 9.9.0.29.
174					if (   ( is_discrete_ok )
175						&& ( working_date > date )
176						&& ( i >= parseInt(_wpbc.calendar__get_param_value( resource_id, 'dynamic__days_min' ) ) )
177						&& (  i < parseInt(_wpbc.calendar__get_param_value( resource_id, 'dynamic__days_max' ) ) )
178					){
179						is_check = false;
180					}
181
182					// = Max day		// FixIn: 9.9.0.29.
183					if ( i >= parseInt(_wpbc.calendar__get_param_value( resource_id, 'dynamic__days_max' ) ) ){
184						is_check = false;
185					}
186
187					working_date.setDate( working_date.getDate() + 1 );                                       				// set next date
188				}
189			}
190
191
192			// Highlight days
193			for ( i = 0; i < td_overs.length; i++ ){
194				jQuery( td_overs[ i ] ).addClass( 'datepick-days-cell-over' );
195			}
196			return true;
197
198		} // End Range days selection
199
200	}
201
202
203	/**
204	 * Do dates selection in calendar
205	 *
206	 * @param selected_dates
207	 * @param resource_id
208	 */
209	function wpbc__calendar__do_days_select__bs(selected_dates, resource_id) {
210
211		if ( typeof (wpbc__conditions__for_range_days__first_date__bm) == 'function' ) { wpbc__conditions__for_range_days__first_date__bm( selected_dates, resource_id ); }
212
213		wpbc__calendar_range_days_select__bs( selected_dates, resource_id );
214
215		/**
216		 * Conditional showing form elements,     basically  can be SKIPed in REFACTOR,  but better  to  REFACTOR  it
217		 * too
218		 *
219		 * We are need to  get the dates from  the textarea and not from  all_dates variable, because in the range days
220		 * selection  the dates can be changed
221		 */
222		if ( 'function' === typeof ( check_condition_sections_in_bkform ) ) {
223			check_condition_sections_in_bkform( jQuery( '#date_booking' + resource_id ).val(), resource_id );
224		}
225
226		if ( typeof (wpbc_show_cost_hints_after_few_seconds) == 'function' ) { wpbc_show_cost_hints_after_few_seconds( resource_id ); }	//Calculate the cost and show inside of form.
227	}
228
229
230
231
232
233//TODO: this function  need to  R E F A C T O R  and make it simpler
234
235/**
236 * Force range days selection functionality  for FIXED and DYNAMIC days selection
237 *
238 * @param selected_dates	DYNAMIC :: '19.08.2023 - 19.08.2023' / '19.08.2023 - 27.08.2023'  		FIXED ::
239 *     '19.08.2023'
240 * @param resource_id		'1'
241 * @returns {boolean}
242 */
243function wpbc__calendar_range_days_select__bs( selected_dates, resource_id ){
244
245	if (
246		   (  'fixed' !== _wpbc.calendar__get_param_value( resource_id, 'days_select_mode' ))
247		&& ('dynamic' !== _wpbc.calendar__get_param_value( resource_id, 'days_select_mode' ))
248	){
249		return false;
250	}
251
252
253	var td_class;
254	var sql_class_day;
255	var inst = jQuery.datepick._getInst( document.getElementById( 'calendar_booking' + resource_id ) );
256	var internal__days_num__to_select = _wpbc.calendar__get_param_value( resource_id, 'fixed__days_num' );
257
258
259	/**
260	 * If 2 clicks,  then  dates can  be '19.08.2023 - 19.08.2023'  or "19.08.2023 - 27.08.2023" and then  we need to
261	 * check if it's possible to  finish  selection on 27/08/2023 If 1 click    then  we have       '19.08.2023',  and
262	 * after that  we need to  count how many  days to  select
263	 */
264
265
266	// Dynamic for 2 mouse clicks ======================================================================================
267	if ( -1 != selected_dates.indexOf( ' - ' ) ){
268
269			var start_end_date = selected_dates.split( " - " );
270
271			var is_start_same_as_last_day__for_dynamic = true;
272			if (
273				   ( inst.dates.length > 1 ) 																			// inst.date = [ Date('26 Aug.') ]
274				&& ( 'dynamic' === _wpbc.calendar__get_param_value( resource_id, 'days_select_mode' ) )
275			){
276				is_start_same_as_last_day__for_dynamic = false;
277			}
278
279			var is_only_first_click = ( (start_end_date[ 0 ] == start_end_date[ 1 ]) && (is_start_same_as_last_day__for_dynamic === true) );
280
281			// FIRST_DAY_CLICK  --------------------------------------------------------------------------------------------
282			if ( is_only_first_click ){
283
284				var start_dynamic_date 		= start_end_date[ 0 ].split( "." );
285				var date_js__check_in = new Date( parseInt( start_dynamic_date[ 2 ] ), (parseInt( start_dynamic_date[ 1 ] ) - 1), parseInt( start_dynamic_date[ 0 ] ) );
286
287				// Unselect  dates in calendar, if first time clicked on "Check In"  date. // FixIn: 10.15.5.8.
288				if ( jQuery( '#calendar_booking' + resource_id + ' .datepick-days-cell.cal4date-' + wpbc__get__td_class_date( date_js__check_in ) ).hasClass( 'check_in_time' ) ) {
289					wpbc_calendar__unselect_all_dates( resource_id );                    // Unselect Dates.
290					jQuery( '.wpbc_only_calendar .popover_calendar_hover' ).remove();    // Hide.
291					return false;
292				}
293
294				if ( typeof (wpbc__conditions__set_START_WEEK_DAY__depend_on_season__bm) == 'function' ){ wpbc__conditions__set_START_WEEK_DAY__depend_on_season__bm( resource_id, date_js__check_in, 'start' ); }
295
296				// START selection on SPECIFIC WEEK DAYS
297				if ( -1 != _wpbc.calendar__get_param_value( resource_id, 'dynamic__week_days__start' ) ){
298
299					if ( date_js__check_in.getDay() != _wpbc.calendar__get_param_value( resource_id, 'dynamic__week_days__start' ) ){
300
301						var startDay = wpbc_get_abs_closest_value_in_arr( date_js__check_in.getDay(), _wpbc.calendar__get_param_value( resource_id, 'dynamic__week_days__start' ) );
302						date_js__check_in.setDate( date_js__check_in.getDate() - (date_js__check_in.getDay() - startDay) );
303
304
305						selected_dates = jQuery.datepick._formatDate( inst, date_js__check_in );
306						selected_dates += ' - ' + selected_dates;
307						jQuery( '#date_booking' + resource_id ).val( selected_dates ); // Fill the input box
308
309						if ( typeof (wpbc__conditions__for_range_days__first_date__bm) == 'function' ){ wpbc__conditions__for_range_days__first_date__bm( selected_dates, resource_id ); } // Highlight dates based on the conditions
310
311						// Check this day for already booked
312						var selceted_first_day = new Date;
313						selceted_first_day.setFullYear( date_js__check_in.getFullYear(), (date_js__check_in.getMonth()), (date_js__check_in.getDate()) );
314						i = 0;
315						// FixIn: 9.9.0.29.
316						while ( i < parseInt( _wpbc.calendar__get_param_value( resource_id, 'dynamic__days_min' ) ) ) {
317
318							sql_class_day = wpbc__get__sql_class_date( selceted_first_day );
319							td_class      = wpbc__get__td_class_date( selceted_first_day );
320
321							if ( ! wpbc_is_this_day_selectable( resource_id, sql_class_day ) ){
322
323								wpbc_calendar__unselect_all_dates( resource_id );										// Unselect all dates and set  properties of Datepick
324
325								return false;
326							}
327
328							selceted_first_day.setFullYear( selceted_first_day.getFullYear(), (selceted_first_day.getMonth()), (selceted_first_day.getDate() + 1) );
329							i++;
330						}
331
332						// Selection of the day
333						inst.cursorDate.setFullYear( date_js__check_in.getFullYear(), (date_js__check_in.getMonth()), (date_js__check_in.getDate()) );
334						inst.dates = [inst.cursorDate];
335						jQuery.datepick._updateDatepick( inst );
336					}
337
338				} else { // Set correct date, if only single date is selected, and possible press send button then.
339
340					inst.cursorDate.setFullYear( date_js__check_in.getFullYear(), (date_js__check_in.getMonth()), (date_js__check_in.getDate()) );
341					inst.dates = [inst.cursorDate];
342					jQuery.datepick._updateDatepick( inst );
343					jQuery( '#date_booking' + resource_id ).val( start_end_date[ 0 ] );
344				}
345
346				if ( typeof (wpbc__conditions__set_START_WEEK_DAY__depend_on_season__bm) == 'function' ){ wpbc__conditions__set_START_WEEK_DAY__depend_on_season__bm( resource_id, '', 'end' ); }
347
348				// Disable the submit button	// FixIn: 9.9.0.29.
349				if ( parseInt( _wpbc.calendar__get_param_value( resource_id, 'dynamic__days_min' ) ) > 1 ){
350					wpbc_disable_submit_button_in_booking_form( resource_id );
351				}
352				setTimeout( function (){
353										jQuery( '#calendar_booking' + resource_id + ' .datepick-unselectable.timespartly.check_out_time'
354											  +',#calendar_booking' + resource_id + ' .datepick-unselectable.timespartly.check_in_time' ).removeClass( 'datepick-unselectable' );
355							}, 500 );
356
357				return false;
358
359			}
360
361			// LAST_DAY_CLICK  ---------------------------------------------------------------------------------------------
362			if ( ! is_only_first_click ){
363
364				wpbc_restore_submit_button_in_booking_form( resource_id );
365
366				var start_dynamic_date = start_end_date[ 0 ].split( "." );
367				var date_js__check_in = new Date();
368				date_js__check_in.setFullYear( start_dynamic_date[ 2 ], start_dynamic_date[ 1 ] - 1, start_dynamic_date[ 0 ] );    // get date
369
370				var end_dynamic_date = start_end_date[ 1 ].split( "." );
371				var real_end_dynamic_date = new Date();
372				real_end_dynamic_date.setFullYear( end_dynamic_date[ 2 ], end_dynamic_date[ 1 ] - 1, end_dynamic_date[ 0 ] );    // get date
373
374				internal__days_num__to_select = 1; // need to count how many days right now
375
376				var temp_date_for_count = new Date();
377
378				// FixIn: 8.8.2.7.
379				for ( var j1 = 0; j1 < 3 * 365; j1++ ){
380					temp_date_for_count = new Date();
381					temp_date_for_count.setFullYear( date_js__check_in.getFullYear(), (date_js__check_in.getMonth()), (date_js__check_in.getDate() + j1) );
382
383					if ( (temp_date_for_count.getFullYear() == real_end_dynamic_date.getFullYear()) && (temp_date_for_count.getMonth() == real_end_dynamic_date.getMonth()) && (temp_date_for_count.getDate() == real_end_dynamic_date.getDate()) ){
384						internal__days_num__to_select = j1;
385						j1 = 1000;
386					}
387				}
388				internal__days_num__to_select++;
389				selected_dates = start_end_date[ 0 ];
390				// FixIn: 9.9.0.29.
391				if ( internal__days_num__to_select < parseInt( _wpbc.calendar__get_param_value( resource_id, 'dynamic__days_min' ) ) ){
392					internal__days_num__to_select = parseInt( _wpbc.calendar__get_param_value( resource_id, 'dynamic__days_min' ) );
393				}
394
395				var is_backward_direction = false;
396				if ( _wpbc.calendar__get_param_value( resource_id, 'dynamic__days_specific' ).length > 0 ){              // check if we set some discreet dates
397
398					var is_discreet_ok = false;
399					while ( is_discreet_ok === false ){
400
401						for ( var di = 0; di < _wpbc.calendar__get_param_value( resource_id, 'dynamic__days_specific' ).length; di++ ){   // check if current number of days inside of discreet one
402							// FixIn: 9.9.0.29.
403							if (
404								(internal__days_num__to_select == parseInt( _wpbc.calendar__get_param_value( resource_id, 'dynamic__days_specific' )[ di ]) ) &&
405								(internal__days_num__to_select <= parseInt( _wpbc.calendar__get_param_value( resource_id, 'dynamic__days_max' ) ) )
406							){
407								is_discreet_ok = true;
408								di = (_wpbc.calendar__get_param_value( resource_id, 'dynamic__days_specific' ).length + 1);
409							}
410						}
411						if ( is_backward_direction === false ){
412							if ( is_discreet_ok === false ){
413								internal__days_num__to_select++;
414							}
415						}
416
417						// BackWard directions, if we set more than maximum days		// FixIn: 9.9.0.29.
418						if ( internal__days_num__to_select >= parseInt( _wpbc.calendar__get_param_value( resource_id, 'dynamic__days_max' ) ) ){
419							is_backward_direction = true;
420						}
421
422						if ( is_backward_direction === true ){
423							if ( is_discreet_ok === false ){
424								internal__days_num__to_select--;
425							}
426						}
427						// FixIn: 9.9.0.29.
428						if ( internal__days_num__to_select < parseInt( _wpbc.calendar__get_param_value( resource_id, 'dynamic__days_min' ) ) ){
429							is_discreet_ok = true;
430						}
431					}
432
433				} else {
434					// FixIn: 9.9.0.29.
435					if ( internal__days_num__to_select > parseInt( _wpbc.calendar__get_param_value( resource_id, 'dynamic__days_max' ) ) ){
436						internal__days_num__to_select = parseInt( _wpbc.calendar__get_param_value( resource_id, 'dynamic__days_max' ) );
437					}
438				}
439
440
441			}
442	}
443	// Dynamic for 2 mouse clicks  E N D  ==============================================================================
444
445
446
447	// DO DAYS SELECTION INTENTIONALLY +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
448
449
450	var temp_saved__days_selection_mode = _wpbc.calendar__get_param_value( resource_id, 'days_select_mode' );
451	_wpbc.calendar__set_param_value( resource_id, 'days_select_mode', 'multiple' );
452
453		inst.dates = [];                                        // Empty dates in datepicker
454		var all_dates_array;
455		var date_array;
456		var date;
457		var date_to_ins;
458
459		// Get array of dates
460		if ( selected_dates.indexOf( ',' ) == -1 ){
461			all_dates_array = [selected_dates];
462		} else {
463			all_dates_array = selected_dates.split( "," );
464		}
465
466		var original_array = [];
467		var isMakeSelection = false;
468
469		// F I X E D
470		if ( 'dynamic' != temp_saved__days_selection_mode ){
471			// Gathering original (already selected dates) date array
472			for ( var j = 0; j < all_dates_array.length; j++ ){                           //loop array of dates
473				all_dates_array[ j ] = all_dates_array[ j ].replace( /(^\s+)|(\s+$)/g, "" );  // trim white spaces in date string
474
475				date_array = all_dates_array[ j ].split( "." );                             // get single date array
476
477				date = new Date();
478				date.setFullYear( date_array[ 2 ], date_array[ 1 ] - 1, date_array[ 0 ] );    // get date
479
480				if ( (date.getFullYear() == inst.cursorDate.getFullYear()) && (date.getMonth() == inst.cursorDate.getMonth()) && (date.getDate() == inst.cursorDate.getDate()) ){
481					isMakeSelection = true;
482
483					if ( typeof (wpbc__conditions__set_START_WEEK_DAY__depend_on_season__bm) == 'function' ){ wpbc__conditions__set_START_WEEK_DAY__depend_on_season__bm( resource_id, inst.cursorDate, 'start' ); }
484
485					if (   -1 != _wpbc.calendar__get_param_value( resource_id, 'fixed__week_days__start' ) ){
486
487						var startDay = wpbc_get_abs_closest_value_in_arr( inst.cursorDate.getDay(), _wpbc.calendar__get_param_value( resource_id, 'fixed__week_days__start' ) );
488
489						inst.cursorDate.setDate( inst.cursorDate.getDate() - (inst.cursorDate.getDay() - startDay) );
490
491						_wpbc.calendar__set_param_value( resource_id, 'days_select_mode' , temp_saved__days_selection_mode );
492
493						if ( typeof (wpbc__conditions__set_NUMBER_OF_DAYS_TO_SELECT__depend_on_date__bm) == 'function' ){ wpbc__conditions__set_NUMBER_OF_DAYS_TO_SELECT__depend_on_date__bm( inst.cursorDate, resource_id ); } // Highlight dates based on the conditions
494
495						temp_saved__days_selection_mode = _wpbc.calendar__get_param_value( resource_id, 'days_select_mode' );
496						_wpbc.calendar__set_param_value( resource_id, 'days_select_mode', 'multiple' );
497
498						internal__days_num__to_select = _wpbc.calendar__get_param_value( resource_id, 'fixed__days_num' );
499					}
500
501					if ( typeof (wpbc__conditions__set_START_WEEK_DAY__depend_on_season__bm) == 'function' ){ wpbc__conditions__set_START_WEEK_DAY__depend_on_season__bm( resource_id, inst.cursorDate, 'end' ); }
502				}
503			}
504		} else {
505			isMakeSelection = true;                                                         // Dynamic range selection
506		}
507
508		var isEmptySelection = false;
509		if ( isMakeSelection ){
510			var date_start_range = inst.cursorDate;
511
512			if ( 'dynamic' != temp_saved__days_selection_mode ){
513				original_array.push( jQuery.datepick._restrictMinMax( inst, jQuery.datepick._determineDate( inst, inst.cursorDate, null ) ) ); 			//add date
514			} else {
515				original_array.push( jQuery.datepick._restrictMinMax( inst, jQuery.datepick._determineDate( inst, date_js__check_in, null ) ) ); 	//set 1st date from dynamic range
516				date_start_range = date_js__check_in;
517			}
518			var dates_array = [];
519			var range_array = [];
520			var td;
521
522			// Add dates to the range array
523			for ( var i = 1; i < internal__days_num__to_select; i++ ){
524
525				dates_array[ i ] = new Date();
526
527				dates_array[ i ].setFullYear( date_start_range.getFullYear(), (date_start_range.getMonth()), (date_start_range.getDate() + i) );
528
529				td_class = (dates_array[ i ].getMonth() + 1) + '-' + dates_array[ i ].getDate() + '-' + dates_array[ i ].getFullYear();
530				sql_class_day = wpbc__get__sql_class_date( dates_array[ i ] );
531
532				td = '#calendar_booking' + resource_id + ' .cal4date-' + td_class;
533
534				if ( jQuery( td ).hasClass( 'datepick-unselectable' ) ){ // If we find some unselect option so then make no selection at all in this range
535					jQuery( td ).removeClass( 'datepick-current-day' );
536					isEmptySelection = true;
537				}
538
539				//Check if in selection range are reserved days, if so then do not make selection
540				if ( ! wpbc_is_this_day_selectable( resource_id, sql_class_day ) ){
541					isEmptySelection = true;
542				}
543
544				/////////////////////////////////////////////////////////////////////////////////////
545
546				date_to_ins = jQuery.datepick._restrictMinMax( inst, jQuery.datepick._determineDate( inst, dates_array[ i ], null ) );
547
548				range_array.push( date_to_ins );
549			}
550
551			// check if some dates are the same in the arrays so the remove them from both
552			for ( i = 0; i < range_array.length; i++ ){
553				for ( j = 0; j < original_array.length; j++ ){       //loop array of dates
554
555					if ( (original_array[ j ] != -1) && (range_array[ i ] != -1) )
556						if (
557							   (range_array[ i ].getFullYear() == original_array[ j ].getFullYear())
558							&& (range_array[ i ].getMonth() == original_array[ j ].getMonth())
559							&& (range_array[ i ].getDate() == original_array[ j ].getDate())
560						){
561							range_array[ i ] = -1;
562							original_array[ j ] = -1;
563						}
564				}
565			}
566
567			// Add to the dates array
568			for ( j = 0; j < original_array.length; j++ ){       //loop array of dates
569				if ( original_array[ j ] != -1 ){
570					inst.dates.push( original_array[ j ] );
571				}
572			}
573			for ( i = 0; i < range_array.length; i++ ){
574				if ( range_array[ i ] != -1 ){
575					inst.dates.push( range_array[ i ] );
576				}
577			}
578		}
579
580		if ( !isEmptySelection ){
581
582			for ( j = 0; j < inst.dates.length; j++ ){
583				sql_class_day = wpbc__get__sql_class_date( inst.dates[ j ] );
584				if ( ! wpbc_is_this_day_selectable( resource_id, sql_class_day ) ){
585					isEmptySelection = true;
586					break;
587				}
588			}
589		}
590
591		if ( isEmptySelection ){
592			inst.dates = [];
593		}
594
595
596		if ( 'dynamic' != temp_saved__days_selection_mode ){
597			jQuery.datepick._updateInput( '#calendar_booking' + resource_id );
598		} else {
599			if ( isEmptySelection ){
600				jQuery.datepick._updateInput( '#calendar_booking' + resource_id );
601			} else {       // Dynamic range selections, transform days from jQuery.datepick
602				var dateStr = (inst.dates.length == 0 ? '' : jQuery.datepick._formatDate( inst, inst.dates[ 0 ] )); // Get first date
603				for ( i = 1; i < inst.dates.length; i++ ){
604					dateStr += jQuery.datepick._get( inst, 'multiSeparator' ) + jQuery.datepick._formatDate( inst, inst.dates[ i ] );
605				}
606				jQuery( '#date_booking' + resource_id ).val( dateStr ); // Fill the input box
607			}
608		}
609
610		if ( (is_start_same_as_last_day__for_dynamic === false) && (start_end_date[ 0 ] == start_end_date[ 1 ]) ){
611			if ( inst.dates.length == 1 ){
612				inst.dates.push( inst.dates[ 0 ] );
613			}
614		}
615		jQuery.datepick._notifyChange( inst );																			// Call  this 'onChangeMonthYear' from  datepicker.
616		jQuery.datepick._adjustInstDate( inst );
617		jQuery.datepick._showDate( inst );																				// Update the input field with the current date(s)
618
619	_wpbc.calendar__set_param_value( resource_id, 'days_select_mode', temp_saved__days_selection_mode );
620}
621
622
623	/**
624	 * Disable submit button  in booking form
625	 * @param resource_id		resource ID
626	 */
627	function wpbc_disable_submit_button_in_booking_form( resource_id ){
628
629		// FixIn: 10.5.2.3.
630		jQuery( '#booking_form_div' + resource_id + ' input[type="button"]' ).attr( 'saved-button-color' , jQuery( '#booking_form_div' + resource_id + ' input[type="button"]' ).css( 'color' ) );
631		jQuery( '#booking_form_div' + resource_id + ' input[type="button"]' ).attr( 'disabled', 'disabled' );
632		jQuery( '#booking_form_div' + resource_id + ' input[type="button"]' ).css( 'color', '#aaa' );
633	}
634
635
636	/**
637	 * Restore disabled submit button  in booking form
638	 * @param resource_id		resource ID
639	 */
640	function wpbc_restore_submit_button_in_booking_form( resource_id ){
641
642		jQuery( '#booking_form_div' + resource_id + ' input[type="button"]' ).prop( 'disabled', false );
643
644		if ( undefined != jQuery( '#booking_form_div' + resource_id + ' input[type="button"]' ).attr( 'saved-button-color' ) ){     // FixIn: 9.5.1.2.
645			jQuery( '#booking_form_div' + resource_id + ' input[type="button"]' ).css( 'color', jQuery( '#booking_form_div' + resource_id + ' input[type="button"]' ).attr( 'saved-button-color' ) );
646		}
647	}
648
649
650/**
651 * Tests :
652 * 			var inst= wpbc_calendar__get_inst(3); wpbc__calendar_range_days_select__bs('20.08.2023 - 27.08.2023' , 3
653 * );  jQuery.datepick._updateDatepick( inst );
654 *
655 * 		    var inst= wpbc_calendar__get_inst(3); inst.dates=[]; wpbc__calendar_range_days_select__bs('20.09.2023 -
656 * 20.09.2023' , 3 );  jQuery.datepick._updateDatepick( inst );
657 */
658
659/**
660 * Load payment scrip async with callback  event
661 * @param url
662 * @param callback
663 */
664function wpbc_load_js_async( url, callback ){
665	var s = document.createElement( 'script' );
666	s.setAttribute( 'src', url );
667	s.onload = callback;
668	document.head.insertBefore( s, document.head.firstElementChild );
669}

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.