Advanced JavaScript for the booking shortcodes

This JavaScript is possible to use before the booking shortcode, like this:

[booking type=1 form_type='standard' nummonths=1]
in the edit post or edit page WordPress menu pages. In all examples below we will use that shortcode, but in your examples the parameters of the booking shortcode will be other, of course. Please read more how to insert and configure the booking shortcode into the post or page here.

Important! Please note, you be able to insert the JavaScript if you are logged in as admin user (the subscriber users have not rights to insert the JavaScript into the posts or pages) and turn the edit post content form into the "Text" mode instead of the "Visual" (you can activate this "Text tab" at the top right side of the edit post content form).

This customization is possible for the Business Small or higher versions of update 4.2 or newer.

Please note, for do not have any conflicts, please use this customizations, when you are insert into the post or page only single booking form. Its mean you are not insert the other booking shortcode into this page and do not have any booking widgets at this page.


Activating Single day selection mode.
Please use this code, for activating that type of days selection for the current booking form, if by default you are using the other type of days selections at the General Booking Settings page:

<script type="text/javascript">
   bk_days_selection_mode = 'single';
</script>
[booking type=1 form_type='standard' nummonths=1]


Activating Multiple days selection mode.
Please use this code, for activating that type of days selection for the current booking form, if by default you are using the other type of days selections at the General Booking Settings page:

<script type="text/javascript">
   bk_days_selection_mode = 'multiple';
</script>
[booking type=1 form_type='standard' nummonths=1]


Activating Range days selection as a FIXED number of days with 1 mouse click.
Please use this code, for activating that type of days selection for the current booking form, if by default you are using the other type of days selections at the General Booking Settings page:

<script type="text/javascript">
   bk_days_selection_mode    = 'fixed';
   bk_1click_mode_days_num   = 7;    // Number of days selection with 1 mouse click
   bk_1click_mode_days_start = [-1]; // { -1 - Any | 0 - Su,  1 - Mo,  2 - Tu, 3 - We, 4 - Th, 5 - Fr, 6 - Sat }
</script>
[booking type=1 form_type='standard' nummonths=1]

In this example we are used 2 new variables: bk_1click_mode_days_num and bk_1click_mode_days_start.

bk_1click_mode_days_num - its number of days selection with 1 mouse click. You can assign number of days selections to this variable. For example for having 5 days selections, please use this code:

bk_1click_mode_days_num   = 5;

bk_1click_mode_days_start - its array, where we can specify the start day of the range days selection.
If we are need to set the start day of range selection as any day of week, please use this code:

bk_1click_mode_days_start   = [-1];

If we are need to set the specific start day of week selections or multiple days of week as start day for the range selections, please assign these values:
0 - Sunday,
1 - Monday,
2 - Tuesday,
3 - Wednesday,
4 - Thursday,
5 - Friday,
6 - Saturday.
So if you are need to set the start day of range selection as Saturday, please use this code:
bk_1click_mode_days_start   = [6];

If you are need to set the start day of range selections as Monday and Friday, please use this code:
bk_1click_mode_days_start   = [1,5];

This code

bk_1click_mode_days_start   = [-1];

and this code:
bk_1click_mode_days_start   = [0,1,2,3,4,5,6];

is equivalent.


Activating Range days selection as a DYNAMIC range of days with 2 mouse clicks.
Please use this code, for activating that type of days selection for the current booking form, if by default you are using the other type of days selections at the General Booking Settings page:

<script type="text/javascript">
   bk_days_selection_mode    = 'dynamic';
   bk_2clicks_mode_days_min       = 1;    // Min. Number of days selection with 2 mouse clicks
   bk_2clicks_mode_days_max       = 10;   // Max. Number of days selection with 2 mouse clicks
   bk_2clicks_mode_days_specific  = [];   // Example [5,7]
   bk_2clicks_mode_days_start     = [-1]; // { -1 - Any | 0 - Su,  1 - Mo,  2 - Tu, 3 - We, 4 - Th, 5 - Fr, 6 - Sat }
</script>
[booking type=1 form_type='standard' nummonths=1]

In this example we are used 4 new variables: bk_2clicks_mode_days_min, bk_2clicks_mode_days_max, bk_2clicks_mode_days_specific and bk_2clicks_mode_days_start.

bk_2clicks_mode_days_min - Minimum number of days selection with 2 mouse clicks. You can assign number of days selections to this variable. For example for having minimum 7 days selections, please use this code:

bk_2clicks_mode_days_min   = 7;

bk_2clicks_mode_days_max - Maximum number of days selection with 2 mouse clicks. You can assign specific number of days selections to this variable. For example for having maximum 14 days selections, please use this code:

bk_2clicks_mode_days_max   = 14;

bk_2clicks_mode_days_specific - its array, where we can specify that is possible to select only specific number of days selection.
For having possibility to select any number of days, please use this code:

bk_2clicks_mode_days_specific   = [];

For having possibility to select only weeks - 7 days, 14 days, 21 days... please use this code:
bk_2clicks_mode_days_specific = [7];

For having possibility to select only - 5, 7, 10, 14, 20, 21 days... please use this code:
bk_2clicks_mode_days_specific = [5,7];

bk_2clicks_mode_days_start - its array, where we can specify the start day of the range days selection.
If we are need to set the start day of range selection as any day of week, please use this code:

bk_2clicks_mode_days_start   = [-1];

If we are need to set the specific start day of week selections or multiple days of week as start day for the range selections, please assign these values:
0 - Sunday,
1 - Monday,
2 - Tuesday,
3 - Wednesday,
4 - Thursday,
5 - Friday,
6 - Saturday.
So if you are need to set the start day of range selection as Saturday, please use this code:
bk_2clicks_mode_days_start   = [6];

If you are need to set the start day of range selections as Monday and Friday, please use this code:
bk_2clicks_mode_days_start   = [1,5];

This code

bk_2clicks_mode_days_start   = [-1];

and this code:
bk_2clicks_mode_days_start   = [0,1,2,3,4,5,6];

is equivalent.