PageSourceSearch

https://www.santuarioincoronatamontoro.it/wp-content/plugins/bookn…/step_information.js?v=1.3.5&ver=1.3.5

js santuarioincoronatamontoro.it collected 2026-09-28 03:22:56 UTC 13,725 bytes, 317 lines download raw bytes

1let activeCustomerCheckingRequestsCount = 0;
2(function($)
3{
4
5    let customerIdentifierInputListener = null;
6
7    const checkIfCustomerExist = function ( booknetic )
8    {
9        let booking_panel_js = booknetic.panel_js;
10        booking_panel_js.find('.bkntc_input_identifier_loading').show();
11        activeCustomerCheckingRequestsCount++;
12
13        let saveIdentifierInputValueBeforeAjax = booking_panel_js.find('.bkntc_input_identifier_input').val();
14
15        booknetic.ajax('check_customer_exist', booknetic.ajaxParameters(), function( result )
16        {
17            activeCustomerCheckingRequestsCount--;
18
19            if( ! activeCustomerCheckingRequestsCount )
20                booking_panel_js.find('.bkntc_input_identifier_loading').hide();
21
22            let customerIdAlreadySet = booking_panel_js.find('.bkntc_input_identifier_input').data('customer-id');
23
24            if( ! customerIdAlreadySet )
25            {
26                if( result.customer_id )
27                {
28                    booking_panel_js.find('[data-bkntc-customer-info="true"]').hide();
29
30                    booking_panel_js.find('.bkntc_input_identifier_input').closest('[data-bkntc-customer-info="true"]').show();
31                    booking_panel_js.find('.bkntc_input_identifier_input').attr('disabled', true);
32                    booking_panel_js.find('.bkntc_input_identifier_input').data('customer-id', result.customer_id);
33                    booking_panel_js.find('.bkntc_input_identifier_clear').show();
34                    booking_panel_js.find('.bkntc_input_identifier_input').val( saveIdentifierInputValueBeforeAjax );
35
36                    booking_panel_js.find('[data-bkntc-customer-id="true"]').show();
37                }
38                else
39                {
40                    booking_panel_js.find('[data-bkntc-customer-info="true"]:not(.bkntc_hidden_lastname)').show();
41                    booking_panel_js.find('[data-bkntc-customer-id="true"]').hide();
42                    booking_panel_js.find('.bkntc_input_identifier_input').attr('disabled', false);
43                    booking_panel_js.find('.bkntc_input_identifier_input').data('customer-id', '');
44                }
45            }
46
47        }, false, function()
48        {
49            activeCustomerCheckingRequestsCount--;
50
51            if( ! activeCustomerCheckingRequestsCount )
52                booking_panel_js.find('.bkntc_input_identifier_loading').hide();
53        });
54    }
55
56    bookneticHooks.addAction('booking_panel_loaded', function ( booknetic )
57    {
58        let booking_panel_js = booknetic.panel_js;
59        let identifierInput = booking_panel_js.find('.bkntc_input_identifier_clear').parent().find('input');
60
61        booking_panel_js.on('keyup change', '#bkntc_input_name, #bkntc_input_surname, #bkntc_input_email, #bkntc_input_email_confirm, #bkntc_input_phone', function ()
62        {
63            $(this).removeClass('booknetic_input_error');
64        }).on('click', '.booknetic_social_login_facebook, .booknetic_social_login_google', function ()
65        {
66            let login_window = window.open($(this).data('href'), 'booknetic_social_login', 'width=1000,height=700');
67
68            let while_fn = function ()
69            {
70                var dataType = 'undefined';
71
72                try {
73                    dataType = typeof login_window.booknetic_user_data;
74                }
75                catch (err){}
76
77                if( dataType != 'undefined' )
78                {
79                    if( booking_panel_js.find('#bkntc_input_surname').parent('div').hasClass('booknetic_hidden') )
80                    {
81                        booking_panel_js.find('#bkntc_input_name').val( login_window.booknetic_user_data['first_name'] + ' ' + login_window.booknetic_user_data['last_name'] );
82                    }
83                    else
84                    {
85                        booking_panel_js.find('#bkntc_input_name').val( login_window.booknetic_user_data['first_name'] );
86                        booking_panel_js.find('#bkntc_input_surname').val( login_window.booknetic_user_data['last_name'] );
87                    }
88
89                    booking_panel_js.find('#bkntc_input_email').val( login_window.booknetic_user_data['email'] );
90                    let confirmEmailInput = booking_panel_js.find('#bkntc_input_email_confirm');
91                    if( confirmEmailInput.length )
92                    {
93                        confirmEmailInput.val( login_window.booknetic_user_data['email'] );
94                    }
95                    login_window.close();
96                    return;
97                }
98
99                if( !login_window.closed )
100                {
101                    setTimeout( while_fn, 1000 );
102                }
103            }
104
105            while_fn();
106        }).on('focusout blur keyup keypress change input', '.bkntc_input_identifier_input', function ( event )
107        {
108            let isFocusOutEvent = (event.type == 'blur' || event.type == 'focusout');
109
110            if( $(this).data('last_val') === $(this).val() )
111                return;
112
113            $(this).data('last_val', $(this).val());
114
115            if( customerIdentifierInputListener !== null )
116            {
117                clearTimeout( customerIdentifierInputListener );
118                customerIdentifierInputListener = null
119            }
120
121            if( $(this).val() != '' )
122            {
123                customerIdentifierInputListener = setTimeout( function ()
124                {
125                    checkIfCustomerExist( booknetic );
126                }, isFocusOutEvent ? 100 : 500 );
127            }
128        }).on('click', '.bkntc_input_identifier_clear', function ()
129        {
130            $(this).hide();
131
132            booking_panel_js.find('[data-bkntc-customer-info="true"]:not(.bkntc_hidden_lastname)').show();
133            booking_panel_js.find('[data-bkntc-customer-id="true"]').hide();
134            booking_panel_js.find('.bkntc_input_identifier_input').attr('disabled', false);
135            booking_panel_js.find('.bkntc_input_identifier_input').data('customer-id', '');
136
137            booking_panel_js.find('.bkntc_input_identifier_input').data('last_val', '');
138
139            booking_panel_js.find('#bkntc_input_email').val("");
140            booking_panel_js.find('#bkntc_input_email').prop('disabled', false);
141            booking_panel_js.find('#bkntc_input_email_confirm').val("");
142            booking_panel_js.find('#bkntc_input_email_confirm').prop('disabled', false);
143
144            booking_panel_js.find('#bkntc_input_phone').val("");
145            booking_panel_js.find('#bkntc_input_phone').prop('disabled', false);
146
147            booking_panel_js.find('#bkntc_input_name').val("");
148            booking_panel_js.find('#bkntc_input_name').prop('disabled', false);
149
150            booking_panel_js.find('#bkntc_input_surname').val("");
151            booking_panel_js.find('#bkntc_input_surname').prop('disabled', false);
152
153
154        });
155    });
156
157    bookneticHooks.addFilter('step_validation_information' , function ( result , booknetic )
158    {
159        let booking_panel_js = booknetic.panel_js;
160        var hasError = false;
161
162        booking_panel_js.find( 'label[for="bkntc_input_name"], label[for="bkntc_input_surname"], label[for="bkntc_input_email"], label[for="bkntc_input_phone"]' ).each( function ()
163        {
164            var el = $( this ).next();
165            var required = $( this ).is( '[data-required="true"]' );
166
167            // doit bunu axi hechvaxt yoxlamayacag?
168            if ( el.is( '.booknetic_number_of_brought_customers_quantity' ) )
169            {
170                el = el.find( 'input' );
171                if ( el.data( 'max-quantity' ) < el.val() )
172                {
173                    if( booking_panel_js.find("#booknetic_bring_someone_checkbox").is(":checked") )
174                    {
175                        el.addClass( 'booknetic_input_error' );
176                        hasError =  booknetic.__( 'You have exceed the maximum value for number of people' );
177                    }
178                }
179            }
180            if( el.is('.bkntc_input_phone-container') )
181            {
182                el = el.find('#bkntc_input_phone');
183            }
184
185            if( ! ( booknetic.getSelected.customerId() > 0 ) )
186            {
187                if( el.is('#bkntc_input_name , #bkntc_input_surname , #bkntc_input_email, #bkntc_input_phone') )
188                {
189                    var value = el.val();
190
191                    if( required && (value.trim() == '' || value == null) )
192                    {
193                        if( el.is('select') )
194                        {
195                            el.next().find('.select2-selection').addClass('booknetic_input_error');
196                        }
197                        else if( el.is('input[type="file"]') )
198                        {
199                            el.next().addClass('booknetic_input_error');
200                        }
201                        else
202                        {
203                            el.addClass('booknetic_input_error');
204                        }
205                        hasError = booknetic.__('fill_all_required');
206                    }
207                    else if( el.attr('name') === 'email' )
208                    {
209                        var email_regexp = /^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;
210                        var checkEmail = email_regexp.test(String(value.trim()).toLowerCase());
211
212                        if( !( (value == '' && !required) || checkEmail ) )
213                        {
214                            el.addClass('booknetic_input_error');
215                            hasError = booknetic.__('email_is_not_valid');
216                        }
217                    }
218                    else if (el.attr('name') === 'phone') {
219                        const itiInstance = booking_panel_js.find('#bkntc_input_phone').data('iti');
220                        const phoneValue = el.val().trim();
221                        const isEmpty = phoneValue === '';
222                        const needsValidation = required || !isEmpty;
223
224                        if (needsValidation && !isEmpty) {
225                            const utilsReady = !!(window.bookneticIntlTelInput && window.bookneticIntlTelInput.utils);
226                            let isValid;
227
228                            if (itiInstance && utilsReady) {
229                                isValid = itiInstance.isValidNumber();
230                            } else {
231                                const phoneRegex = /^\+?(\d{1,3})?[-. \(\)]?\d{1,4}[-. \(\)]?\d{1,4}[-. \(\)]?\d{1,9}$/;
232                                isValid = phoneValue.length >= 6 && phoneValue.length <= 20 && phoneRegex.test(phoneValue);
233                            }
234
235                            if (!isValid) {
236                                el.addClass('booknetic_input_error');
237                                hasError = booknetic.__('phone_is_not_valid');
238                            }
239                        }
240                    }
241                }
242            }
243        });
244
245        if( hasError === false && BookneticData.require_email_confirmation )
246        {
247            let emailInput = booking_panel_js.find('#bkntc_input_email');
248            let confirmEmailInput = booking_panel_js.find('#bkntc_input_email_confirm');
249            let confirmVisible = confirmEmailInput.length && confirmEmailInput.is(':visible') && !confirmEmailInput.prop('disabled');
250
251            if( confirmVisible )
252            {
253                let emailValue = ( emailInput.val() || '' ).trim();
254                let confirmValue = ( confirmEmailInput.val() || '' ).trim();
255
256                if( emailValue !== '' || confirmValue !== '' )
257                {
258                    if( emailValue === '' || confirmValue === '' )
259                    {
260                        emailInput.addClass('booknetic_input_error');
261                        confirmEmailInput.addClass('booknetic_input_error');
262                        hasError = booknetic.__('fill_all_required');
263                    }
264                    else if( emailValue.toLowerCase() !== confirmValue.toLowerCase() )
265                    {
266                        emailInput.addClass('booknetic_input_error');
267                        confirmEmailInput.addClass('booknetic_input_error');
268                        hasError = booknetic.__('email_does_not_match');
269                    }
270                }
271            }
272        }
273
274        if( hasError !== false )
275        {
276            return {
277                status: false,
278                errorMsg: hasError
279            };
280        }
281
282        return result
283    });
284
285    bookneticHooks.addAction('before_step_loading', function( booknetic, new_step_id, old_step_i
285d )
286    {
287        if( new_step_id !== 'information' )
288            return;
289
290        booknetic.stepManager.loadStandartSteps( new_step_id, old_step_id );
291    });
292
293    bookneticHooks.addAction('loaded_step', function( booknetic, new_step_id )
294    {
295        if( new_step_id !== 'information' )
296            return;
297
298        let booking_panel_js = booknetic.panel_js;
299
300        var phone_input = booking_panel_js.find('#bkntc_input_phone');
301
302        let iti = window.bookneticIntlTelInput(phone_input[0], {
303            initialCountry: phone_input.data('country-code') || 'us',
304            separateDialCode: true,
305        });
306
307        phone_input.data('iti', iti);
308
309        if (document.fonts && document.fonts.ready) {
310            document.fonts.ready.then(function() {
311                let countryData = iti.getSelectedCountryData();
312                countryData.iso2 && iti.setCountry(countryData.iso2);
313            });
314        }
315    });
316
317})(jQuery);

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.