PageSourceSearch

https://www.balharbourshops.com/wp-content/themes/balharbourshops-child/js/events.js?v=1790910009&ver=6.9.9

js balharbourshops.com collected 2026-10-02 03:01:21 UTC 4,970 bytes, 144 lines download raw bytes

1(function () {
2	jQuery(window).on('load', function () {
3
4		// Change your form ID or replace it to the .wpforms-form container.
5		jQuery('#wpforms-form-235344').on('wpformsAjaxSubmitFailed', function (e, response) {
6			if (response?.data?.errors.field["wpforms[fields][1]"]) {
7				jQuery('.sg-popup-id-238568').click()
8			}
9		});
10		jQuery('#wpforms-form-238800').on('wpformsAjaxSubmitFailed', function (e, response) {
11			if (response?.data?.errors.field["wpforms[fields][1]"]) {
12				jQuery('.sg-popup-id-238568').click()
13			}
14		});
15		jQuery('#wpforms-form-238776').on('wpformsAjaxSubmitFailed', function (e, response) {
16			if (response?.data?.errors.field["wpforms[fields][1]"]) {
17				jQuery('.sg-popup-id-238568').click()
18			}
19		});
20
21
22
23
24		if (jQuery('.text-frame .time-choise').length) {
25			console.log('Events form not found');
26			jQuery(document).ready(function ($) {
27				$('.jcf-ignore-field').children('select').addClass('jcf-ignore');
28				var formId = $('form.wpforms-form').data('formid');
29
30				$('.dates-field select, .participants-field select').change(function () {
31					var date = $('.dates-field select').val();
32					var participants = $('.participants-field select').val();
33
34					if (date == '' || participants == '') {
35						return;
36					}
37
38					$('.date-field input').val(date);
39					$('.time-choise').show();
40
41					$('.time-choises .time-choise-container').removeClass('available');
42					$('.time-choises .time-choise-container').removeClass('checked');
43
44					// Wordpress ajax request
45					$.ajax({
46						url: ajax_obj.ajax_url,
47						type: 'POST',
48						data: {
49							action: 'check_event_dates_reserved',
50							id: formId,
51							date: date,
52							nonce: ajax_obj.nonce,
53							participants: participants
54						},
55						dataType: 'json',
56						success: function (response) {
57							var reserved = response.data;
58							$('.time-choises .time-choise-container').removeClass('reserved');
59							$('.time-choises .time-choise-container').addClass('available');
60							$('.time-choise').find('input[type="radio"]').prop('checked', false);
61							if (reserved.length > 0) {
62								$.each(reserved, function (index, value) {
63									$('.time-choises .time-choise-container[data-value="' + value.hour + '"]').removeClass('available');
64									$('.time-choises .time-choise-container[data-value="' + value.hour + '"]').addClass('reserved');
65									/* $('.time-choises .time-choise-container').each(function() {
66										if($(this).data('time') == value) {
67											$(this).addClass('reserved');
68										}
69									}); */
70								});
71							}
72						}
73					});
74
75				});
76
77				$('.time-choise').each(function () {
78					var $this = $(this);
79					$this.hide();
80
81					var $field = $this.find('.wpforms-field-required');
82					var $description = $this.find('.wpforms-field-description');
83
84					$field.css({
85						'width': '0',
86						'height': '0',
87						'overflow': 'hidden',
88						'position': 'absolute',
89						'z-index': '-1'
90					});
91
92					// Append div next field
93					$wrapper = $('<div class="time-choise-wrapper"></div>');
94					$wrapper.insertAfter($description);
95
96					$instructions = $('<div class="time-choise-instructions"></div>');
97					$wrapper.append($instructions);
98
99					// Add available and reserved tooltips
100					$available = $('<div class="time-choise"><div class="time-choise-container available"><div class="time-choise-label"></div></div><div class="time-choise-tooltip">Available</div></div>');
101					$reserved = $('<div class="time-choise"><div class="time-choise-container reserved"><div class="time-choise-label"></div></div><div class="time-choise-tooltip">Reserved</div></div>');
102					$instructions.append($available);
103					$instructions.append($reserved);
104
105					$choises = $('<div class="time-choises"></div>');
106					$wrapper.append($choises);
107
108					// Get each values of time radio
109					$this.find('input[type="radio"]').each(function () {
110						var $this = $(this);
111						// Get the value of the radio
112						var value = $this.val();
113						// Get the label of the radio
114						var label = $this.parent().text();
115
116						// Create a new div for each radio
117						$choise = $('<div class="time-choise-container available" data-value="' + value + '"><div class="time-choise-label">' + label + '</div></div>');
118						$choises.append($choise);
119
120						// Add click event to each div
121						$choise.click(function () {
122							// Check if the div is available
123							if ($(this).hasClass('available')) {
124								// Data value
125								var value = $(this).data('value');
126								// Uncheck all radios
127								$this.parent().parent().find('input[type="radio"]').prop('checked', false);
128								// Check the radio
129								$this.parent().parent().find('input[type="radio"][value="' + value + '"]').prop('checked', true);
130								// Uncheck all divs
131								$choises.find('.time-choise-container').removeClass('checked');
132								// Check the div
133								$(this).addClass('checked');
134							}
135						});
136					});
137				});
138			});
139		}
140
141	});
142
143
144}());

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.