PageSourceSearch

https://biznesmarket.com.ua/wp-content/themes/adforest/assests/js/firebase-custom.js?ver=7.1.3

js biznesmarket.com.ua collected 2026-10-07 22:27:36 UTC 27,166 bytes, 518 lines download raw bytes

1(function ($) {
2
3    if ($('#sb-verify-phone-firebase').length > 0) {
4        projectID = $('#sb-fb-projectid').val();
5        appID = $('#sb-fb-appid').val();
6        senderID = $('#sb-fb-senderid').val();
7        apiKey = $('#sb-fb-apikey').val();
8
9        var firebaseConfig = {
10            apiKey: apiKey,
11            projectId: projectID,
12            messagingSenderId: senderID,
13            appId: appID
14        };
15        // Initialize Firebase
16        firebase.initializeApp(firebaseConfig);
17        firebase.analytics();
18        firebase.auth().languageCode = document.documentElement.lang;
19        var loginphone = $('#sb-verify-phone-firebase');
20        if (loginphone.length > 0) {
21            var otpNum = $("#user-otp-num").val();
22            loginphone.on('click', function () {
23                window.recaptchaVerifier = new firebase.auth.RecaptchaVerifier('firebase-recaptcha', {
24                    'size': 'normal',
25                    'callback': function (response) {
26                        // reCAPTCHA solved, allow signInWithPhoneNumber.
27                        // ...
28                    },
29                    'expired-callback': function () {
30                        // Response expired. Ask user to solve reCAPTCHA aga
31                        // ...
32                    }
33                });
34                var cverify = window.recaptchaVerifier;
35                firebase.auth().signInWithPhoneNumber(otpNum, cverify).then(function (response) {
36                    $('#verification_modal').modal('show');
37                    var notice = $('#verification-notice').val() + " " + otpNum;
38                    toastr.success(notice, '', {
39                        timeOut: 3000,
40                        "closeButton": true,
41                        "positionClass": "toast-top-right"
42                    });
43
44                    window.confirmationResult = response;
45                }).catch(function (error) {
46
47                    toastr.error(error['code'], error['message'], {
48                        timeOut: 2000,
49                        "closeButton": true,
50                        "positionClass": "toast-top-right"
51                    });
52                })
53            });
54            /*  verifying otp  */
55            $('#sb_verify_otp').on('click', function () {
56                var otp = $('#sb_ph_number_code').val();
57                $(this).hide();
58                $("#sb_verification_ph_back").show();
59                confirmationResult.confirm(otp).then(function (response) {
60                    var userobj = response.user;
61                    var phoneNum = userobj.phoneNumber;
62                    var adforest_ajax_url = jQuery("#adforest_ajax_url").val();
63                    // Add nonce to the request
64                    var security = jQuery('#sb_login_nonce').val();
65                    $.post(adforest_ajax_url, {
66                        action: 'sb_verify_firebase_otp',
67                        phone_number: phoneNum,
68                        security: security
69                    }).done(function (response) {
70
71                        $("#sb_verification_ph_back").hide();
72                        $('#sb_verify_otp').show();
73                        if (response['success'] == true) {
74                            toastr.success(response['data']['message'], '', {
75                                timeOut: 2000,
76                                "closeButton": true,
77                                "positionClass": "toast-top-right"
78                            });
79                        } else {
80                            toastr.error(response['data']['message'], "", {
81                                timeOut: 3000,
82                                "closeButton": true,
83                                "positionClass": "toast-top-right"
84                            });
85                        }
86                        window.location.reload();
87                    });
88                }).catch((error) => {
89                    toastr.error(error['code'], error['message'], {
90                        timeOut: 3000,
91                        "closeButton": true,
92                        "positionClass": "toast-top-right"
93                    });
94                })
95            });
96        }
97    }
98
99
100    if ($('#sb-pre-code').length > 0 && $('#sb-pre-code').val() == 1) {
101        $.getJSON("https://extreme-ip-lookup.com/json/", function (data) {
102
103            console.log(data);
104            if (typeof data.country !== 'undefined') {
105                $.getJSON("https://restcountries.eu/rest/v2/name/" + data.country, function (datas) {
106                    if (data.country == "India") {
107                        $("#sb_reg_email").val("+91");
108                    } else if (typeof datas[0].callingCodes[0] !== undefined) {
109                        $("#sb_reg_email").val("+" + datas[0].callingCodes[0]);
110                    }
111                });
112            }
113        })
114    }
115
116    function ValidateEmail(mail) {
117        if (/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9-]+(?:\.[a-zA-Z0-9-]+)*$/.test(mail)) {
118            return (true)
119        }
120
121        return (false)
122    }
123
124
125    if ($('#sb-sign-multi-form').length > 0) {
126
127        $('#sb-sign-multi-form').on('submit', function (e) {
128            e.preventDefault();
129            var form = $(this);
130            form.parsley().validate();
131            var adforest_ajax_url = jQuery("#adforest_ajax_url").val();
132            if (form.parsley().isValid()) {
133                $('#sb_loading').show();
134                $('#sb_register_msg').show();
135                $('#sb_register_submit').hide();
136                var email_val = $("#sb_reg_email").val();
137                if (email_val.includes("+")) {
138                    $.post(adforest_ajax_url, {
139                        action: 'sb_register_check_user',
140                        form_data: $("#sb-sign-multi-form").serialize()
141                    }).done(function (response) {
142                        $('#sb_loading').hide();
143                        $('#sb_register_msg').hide();
144                        if (response['success'] == true) {
145                            $('#sb_register_submit').hide();
146                            projectID = $('#sb-fb-projectid').val();
147                            appID = $('#sb-fb-appid').val();
148                            senderID = $('#sb-fb-senderid').val();
149                            apiKey = $('#sb-fb-apikey').val();
150                            var firebaseConfig2 = {
151                                apiKey: apiKey,
152                                projectId: projectID,
153                                messagingSenderId: senderID,
154                                appId: appID
155                            };
156                            // Initialize Firebase
157
158                            !firebase.apps.length ? firebase.initializeApp(firebaseConfig2) : firebase.app()
159                            firebase.analytics();
160                            firebase.auth().languageCode = document.documentElement.lang;
161
162                            var otpNum = $("#sb_reg_email").val();
163                            window.recaptchaVerifier = new firebase.auth.RecaptchaVerifier('firebase-recaptcha', {
164                                'size': 'normal',
165                                'callback': function (response) {
166                                    // reCAPTCHA solved, allow signInWithPhoneNumber.
167                                    // ...
168                                },
169                                'expired-callback': function () {
170                                    // Response expired. Ask user to solve reCAPTCHA aga
171                                    // ...
172                                }
173                            });
174                            toastr.success($('#verify_recaptcha').val(), '', {
175                                timeOut: 3000,
176                                "closeButton": true,
177                                "positionClass": "toast-top-right"
178                            });
179
180                            var cverify = window.recaptchaVerifier;
181                            firebase.auth().signInWithPhoneNumber(otpNum, cverify).then(function (response) {
182                                $('#verification_modal').modal('show');
183                                var notice = $('#verification-notice').val() + " " + otpNum;
184                                toastr.success(notice, '', {
185                                    timeOut: 3000,
186                                    "closeButton": true,
187                                    "positionClass": "toast-top-right"
188                                });
189                                window.confirmationResult = response;
190                            }).catch(function (error) {
191                                toastr.error(error['code'], error['message'], {
192                                    timeOut: 2000,
193                                    "closeButton": true,
194                                    "positionClass": "toast-top-right"
195                                });
196                            })
197
198
199                            /* Resend code to user number  */
200                            $('#sb_verification_resend').on('click', function () {
201                                $('#firebase-recaptcha2').show();
202                                window.recaptchaVerifier = new firebase.auth.RecaptchaVerifier('firebase-recaptcha2', {
203                                    'size': 'normal',
204                                    'callback': function (response) {
205                                        // reCAPTCHA solved, allow signInWithPhoneNumber.
206                                        // ...
207                                    },
208                                    'expired-callback': function () {
209                                        // Response expired. Ask user to solve reCAPTCHA aga
210                                        // ...
211                                    }
212                                });
213                                toastr.success($('#verify_recaptcha').val(), '', {
214                                    timeOut: 3000,
215                                    "closeButton": true,
216                                    "positionClass": "toast-top-right"
217                                });
218                                var cverify = window.recaptchaVerifier;
219                                firebase.auth().signInWithPhoneNumber(otpNum, cverify).then(function (response) {
220                                    var notice = $('#verification-notice').val() + " " + otpNum;
221
222                                    $('#firebase-recaptcha2').hide();
223
224                                    toastr.success(notice, '', {
225                                        timeOut: 3000,
226                                        "closeButton": true,
227                                        "positionClass": "toast-top-right"
228                                    });
229                                    window.confirmationResult = response;
230                                }).catch(function (error) {
231                                    toastr.error(error['code'], error['message'], {
232                                        timeOut: 3000,
233                                        "closeButton": true,
234                                        "positionClass": "toast-top-right"
235                                    });
236                                })
237
238                            });
239
240                            /*  verifying otp  */
241                            $('#sb_verify_otp').on('click', function () {
242                                var otp = $('#sb_ph_number_code').val();
243                                $(this).hide();
244                                $("#sb_verification_ph_back").show();
245                                confirmationResult.confirm(otp).then(function (response) {
246                                    var userobj = response.user;
247                                    var phoneNum = userobj.phoneNumber;
248                                    var adforest_ajax_url = jQuery("#adforest_ajax_url").val();
249                                    var form_data = $("#sb-sign-multi-form").serialize();
250                                    // Add nonce to the request
251                                    var security = jQuery('#sb_login_nonce').val();
252                                    $.post(adforest_ajax_url, {
253                                        action: 'sb_register_user_with_otp',
254                                        phone_number: phoneNum,
255                                        form_data: form_data,
256                                        security: security
257                                    }).done(function (response) {
258                                        $("#sb_verification_ph_back").hide();
259                                        $('#sb_verify_otp').show();
260                                        if (response['success'] == true) {
261
262                                            $("#sb_verification_ph_back").hide();
263                                            $('#sb_verify_otp').show();
264                                            toastr.success(response['data']['message'], '', {
265                                                timeOut: 3000,
266                                                "closeButton": true,
267                                                "positionClass": "toast-top-right"
268                                            });
269
270                                            window.location = $('#profile_page').val();
271                                        } else {
272                                            $("#sb_verification_ph_back").hide();
273                                            $('#sb_verify_otp').show();
274                                            toastr.error(response['data']['message'], "", {
275                                                timeOut: 3000,
276                                                "closeButton": true,
277                                                "positionClass": "toast-top-right"
278                                            });
279                                        }
280
281                                    });
282                                }).catch((error) => {
283
284                                    $("#sb_verification_ph_back").hide();
285                                    $('#sb_verify_otp').show();
286                                    toastr.error(error['code'], error['message'], {
287                                        timeOut: 3000,
288                                        "closeButton": true,
289                                        "positionClass": "toast-top-right"
290                                    });
291                                })
292                            });
293                        } else {
294                            $('#sb_register_submit').show();
295                            toastr.error(response['data']['message'], "", {
296                                timeOut: 3000,
297                                "closeButton": true,
298                                "positionClass": "toast-top-right"
299                            });
300                        }
301                    });
302                } else {
303                    $('#sb_loading').hide();
304                    $('#sb_register_msg').hide();
305                    $('#sb_register_submit').show();
306                    toastr.error($('#invalid_phone').val(), "", {
307                        timeOut: 3000,
308                        "closeButton": true,
309                        "positionClass": "toast-top-right"
310                    });
311                }
312
313            }
314        })
315    }
316    /*Login multiple form*/
317    if ($('#sb-login-multi-form').length > 0) {
318
319        $('#sb_login_submit').prop('disabled', true);
320
321        var phoneno = /^\+?([0-9]{2})\)?[-. ]?([0-9]{8,15})$/;
322        $("#sb_reg_email").bind("change input keyup", function () {
323            if (($(this).val().match(phoneno))) {
324                $('#sb_login_submit').prop('disabled', false);
325            } else {
326                $('#sb_login_submit').prop('disabled', true);
327            }
328        });
329        $('#sb-login-multi-form').on('submit', function (e) {
330            e.preventDefault();
331            var form = $(this);
332            form.parsley().validate();
333            var adforest_ajax_url = jQuery("#adforest_ajax_url").val();
334            if (form.parsley().isValid()) {
335                $('#sb_loading').show();
336                $('#sb_login_submit').hide();
337                $('#sb_login_msg').show();
338                var email_val = $("#sb_reg_email").val();
339                var security = jQuery('#sb-login-token').val();
340
341                if (email_val.includes("+")) {
342                    $.post(adforest_ajax_url, {
343                        action: 'sb_login_check_user',
344                        form_data: $("#sb-login-multi-form").serialize(),
345                        security_nonce: security
346                    }).done(function (response) {
347
348                        $('#sb_loading').hide();
349                        $('#sb_login_submit').hide();
350                        $('#sb_login_msg').hide();
351                        if (response['success'] == true) {
352                            userID = response['data']['user_id'];
353                            // secureToken = response['data']['secure_token'];
354                            projectID = $('#sb-fb-projectid').val();
355                            appID = $('#sb-fb-appid').val();
356                            senderID = $('#sb-fb-senderid').val();
357                            apiKey = $('#sb-fb-apikey').val();
358                            var firebaseConfig2 = {
359                                apiKey: apiKey,
360                                projectId: projectID,
361                                messagingSenderId: senderID,
362                                appId: appID
363                            };
364                            // Initialize Firebase
365                            !firebase.apps.length ? firebase.initializeApp(firebaseConfig2) : firebase.app()
366
367                            firebase.analytics();
368                            firebase.auth().languageCode = document.documentElement.lang;
369                            var otpNum = $("#sb_reg_email").val();
370                            window.recaptchaVerifier = new firebase.auth.RecaptchaVerifier('firebase-recaptcha', {
371                                'size': 'normal',
372                                'callback': function (response) {
373                                    // reCAPTCHA solved, allow signInWithPhoneNumber.
374                                    // ...
375                                },
376                                'expired-callback': function () {
377                                    // Response expired. Ask user to solve reCAPTCHA aga
378                                    // ...
379                                }
380                            });
381                            toastr.success($('#verify_recaptcha').val(), '', {
382                                timeOut: 3000,
383                                "closeButton": true,
384                                "positionClass": "toast-top-right"
385                            });
386                            var cverify = window.recaptchaVerifier;
387
388                            !firebase.apps.length ? firebase.initializeApp(firebaseConfig2) : firebase.app()
389
390                            firebase.auth().signInWithPhoneNumber(otpNum, cverify).then(function (response) {
391                                $('#verification_modal').modal('show');
392                                var notice = $('#verification-notice').val() + " " + otpNum;
393                                toastr.success(notice, '', {
394                                    timeOut: 4000,
395                                    "closeButton": true,
396                                    "positionClass": "toast-top-right"
397                                });
398                                window.confirmationResult = response;
399                            }).catch(function (error) {
400
401                                toastr.error(error['code'], error['message'], {
402                                    timeOut: 3000,
403                                    "closeButton": true,
404                                    "positionClass": "toast-top-right"
405                                });
406                            })
407                            /*Resend otp */
408                            /* Resend code to user number  */
409                            $('#sb_verification_resend').on('click', function () {
410
411                                $('#firebase-recaptcha2').show();
412                                window.recaptchaVerifier = new firebase.auth.RecaptchaVerifier('firebase-recaptcha2', {
413                                    'size': 'normal',
414                                    'callback': function (response) {
415                                        // reCAPTCHA solved, allow signInWithPhoneNumber.
416                                        // ...
417                                    },
418                                    'expired-callback': function () {
419                                        // Response expired. Ask user to solve reCAPTCHA aga
420                                        // ...
421                                    }
422                                });
423                                toastr.success($('#verify_recaptcha').val(), '', {
424                                    timeOut: 3000,
425                                    "closeButton": true,
426                                    "positionClass": "toast-top-right"
427                                });
428                                var cverify = window.recaptchaVerifier;
429                                firebase.auth().signInWithPhoneNumber(otpNum, cverify).then(function (response) {
430                                    $('#firebase-recaptcha2').hide();
431                                    var notice = $('#verification-notice').val() + " " + otpNum;
432                                    toastr.success(notice, '', {
433                                        timeOut: 3000,
434                                        "closeButton": true,
435                                        "positionClass": "toast-top-right"
436                                    });
437                                    window.confirmationResult = response;
438                                }).catch(function (error) {
439                                    toastr.error(error['code'], error['message'], {
440                                        timeOut: 4000,
441                                        "closeButton": true,
442                                        "positionClass": "toast-top-right"
443                                    });
444                                })
445                            });
446                            /*  verifying otp  */
447                            // Verify OTP handler
448                            $('#sb_verify_otp').on('click', function () {
449                                var otp = $('#sb_ph_number_code').val();
450                                $(this).hide();
451                                $("#sb_verification_ph_back").show();
452
453                                confirmationResult.confirm(otp).then(function (response) {
454                                    var userobj = response.user;
455
456                                    // Get Firebase ID token for server verification
457                                    return userobj.getIdToken().then(function(idToken) {
458                                        var phoneNum = userobj.phoneNumber;
459                                        var form_data = $("#sb-login-multi-form").serialize();
460                                        var security = jQuery('#sb_login_nonce').val();
461
462                                        return $.post(adforest_ajax_url, {
463                                            action: 'sb_login_user_with_otp',
464                                            phone_number: phoneNum,
465                                            form_data: form_data,
466                                            user_id: userID,
467                                            firebase_token: idToken,
468                                            security: security
469                                        });
470                                    });
471                                }).then(function(response) {
472                                    $("#sb_verification_ph_back").hide();
473                                    $('#sb_verify_otp').show();
474
475                                    if (response['success'] == true) {
476                                        toastr.success(response['data']['message'], '', {
477                                            timeOut: 3000,
478                                            "closeButton": true,
479                                            "positionClass": "toast-top-right"
480                                        });
481                                        window.location = $('#profile_page').val();
482                                    } else {
483                                        throw new Error(response['data']['message']);
484                                    }
485                                }).catch(function(error) {
486                                    $("#sb_verification_ph_back").hide();
487                                    $('#sb_verify_otp').show();
488                                    toastr.error(error.message || error['code'], '', {
489                                        timeOut: 3000,
490                                        "closeButton": true,
491                                        "positionClass": "toast-top-right"
492                                    });
493                                });
494                            });
495                        } else {
496                            $('#sb_register_submit').show();
497                            toastr.error(response['data']['message'], "", {
498                                timeOut: 2000,
499                                "closeButton": true,
500                                "positionClass": "toast-top-right"
501                            });
502                        }
503                    });
504                } else {
505                    $('#sb_loading').hide();
506                    $('#sb_login_submit').show();
507                    $('#sb_login_msg').hide();
508                    toastr.error($('#invalid_phone').val(), "", {
509                        timeOut: 3000,
510                        "closeButton": true,
511                        "positionClass": "toast-top-right"
512                    });
513                }
514
515            }
516        });
517    }
518}(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.