PageSourceSearch

https://www.barcohomes.com/templates-idx/template-1/js/user_external.js

js barcohomes.com collected 2026-09-29 01:54:16 UTC 10,440 bytes, 245 lines download raw bytes

1var typeLogin = "";
2if (itiLogin === undefined) {
3    var itiLogin = [];
4}
5$(function () {
6    var alertDanger = $("#modal-index .text-danger");
7
8    $(".siging-facebook2 ").click(function () {
9        FB.login(function (response) {
10            if (response.status === 'connected') {
11                $.ajax({
12                    async: false,
13                    url: "../../lib/Facebook/server_side/getProfile",
14                    data: {access_token: response.authResponse.accessToken},
15                    type: 'post',
16                    dataType: 'json',
17                    success: function (data) {
18                        if (!data.resultado) {
19                            alertDanger.html(data.message).show();
20                            return;
21                        }
22
23                        window.location = data.redirect;
24                    },
25                    error: fnCallbackError
26                });
27            }
28        }, {scope: 'public_profile,email'});
29    });
30
31    $(".iniciar-sesion-con-google2").click(function () {
32        var auth2 = gapi.auth2.getAuthInstance();
33        auth2.signIn()
34                .then(function (googleUser) {
35                    var access_token = googleUser.getAuthResponse().id_token;
36                    $.ajax({
37                        async: false,
38                        url: "../../lib/GoogleApi/server_side/getProfile",
39                        data: {access_token},
40                        type: 'post',
41                        dataType: 'json',
42                        success: function (data) {
43                            if (!data.resultado) {
44                                alertDanger.text(data.message).show();
45                                return;
46                            }
47
48                            window.location = data.redirect;
49                        },
50                        error: fnCallbackError
51                    });
52                });
53    });
54
55    $('#modal-index .siging-whatsapp').on('click', function () {
56        typeLogin = "ws";
57        $(".inf-tel-user, .show-all").show();
58        $(".siging-sms, .siging-email, .siging-facebook, .siging-google, .title ").hide();
59    });
60
61    $('#modal-index .siging-sms').on('click', function () {
62        typeLogin = "sms";
63        $(".inf-tel-user, .show-all").show();
64        $(".siging-whatsapp, .siging-email, .siging-facebook, .siging-google, .title ").hide();
65    });
66
67    $('#modal-index .siging-email').on('click', function () {
68        typeLogin = "email";
69        $(".inf-email-user, .show-all").show();
70        $(".siging-sms, .siging-whatsapp, .siging-facebook, .siging-google, .title ").hide();
71    });
72
73    $('#modal-index .show-all').on('click', function () {
74        $("#userphone, #uservalemail, #uservalphone, #userfullyname, #useremail, #code").val("");
75        numberActual = "";
76        $(".index-content").css("height", "440");
77        $("#modal-index .text-danger").text("");
78        $(".show-all, .inf-user, .inf-tel-user, .validate-code, .code-input, .inf-email-user").hide();
79        $(".siging-whatsapp, .siging-sms, .siging-email, .siging-facebook, .siging-google, .title ").show();
80    });
81
82    $(document).on("change", "#uservalemail", function () {
83        $(".sent-email").click();
84    });
85
86    $(document).on("click", ".sent-email", function () {
87        if ($('#uservalemail').length === 0 || ($('#uservalemail').length > 0 && !isValidEmailAddress($("#uservalemail").val()))) {
88            $("#modal-index .text-danger").text("Invalid Email");
89            $('#uservalemail').focus();
90        } else {
91            if (typeLogin === "email") {
92                $.ajax({
93                    url: "/templates-idx/template-1/includes/validate-exist-user-external.php",
94                    type: 'post',
95                    data: {email: $("#uservalemail").val(), type: typeLogin},
96                    cache: false,
97                    dataType: 'json',
98                    success: function (data) {
99                        if (data.status === 'new') {
100                            $('#useremail').val($('#uservalemail').val());
101                            $("#modal-index .text-danger").text("");
102                            $("#modal-index .text-danger").hide();
103                            $(".inf-user, .code-input").show();
104                            $('.inf-tel-user, .inf-email-user, .validate-code').hide();
105                            $(".index-content").css("height", "590");
106                        } else if (data.status === 'old') {
107                            $(".inf-tel-user, .inf-user, .inf-email-user").hide();
108                            $('#useremail').val($('#uservalemail').val());
109                            $(".index-content").css("height", "400");
110                            $(".validate-code, .code-input").show();
111                        }
112                    }
113                });
114            }
115        }
116    });
117    var numberActual = ""
118    $(document).on("change", "#uservalphone", function () {
119        $(".sent-phone").click();
120    });
121
122    $(document).on("click", ".sent-phone", function () {
123        const key = parseInt($("#uservalphone").attr('data-key'));
124        var number = itiLogin[key].getNumber();
125        $("#modal-index .text-danger").text("");
126        if ((typeLogin === "sms" || typeLogin === "ws") && number < 10) {
127            $("#modal-index .text-danger").text("Invalid Phone number");
128        } else if(number !== numberActual){
129            numberActual = number;
130            $.ajax({
131                url: "/templates-idx/template-1/includes/validate-exist-user-external.php",
132                type: 'post',
133                data: {phone: number, type: typeLogin},
134                cache: false,
135                dataType: 'json',
136                success: function (data) {
137                    if (data.status === 'new') {
138                        $(".inf-user, .code-input").show();
139                        $('#userphone').val($('#uservalphone').val());
140                        $('.inf-tel-user, .inf-email-user, .validate-code').hide();
141                        $(".index-content").css("height", "590");
142                    } else if (data.status === 'old') {
143                        $(".inf-tel-user, .inf-user, .inf-email-user").hide();
144                        $('#userphone').val($('#uservalphone').val());
145                        $(".index-content").css("height", "400");
146                        $(".validate-code, .code-input").show();
147                    }
148                }
149            });
150        }
151    });
152
153    $(document).on("click", ".complete-user, .validate-login", function () {
154        $("#modal-index .text-danger").text("");
155        if (typeLogin === "email" && ($('#useremail').length === 0 || !isValidEmailAddress($('#useremail').val()))) {
156            $("#modal-index .text-danger").text("Invalid Email");
157        }
158        const key = parseInt($("#userphone").attr('data-key'));
159        $.ajax({
160            url: "/templates-idx/template-1/includes/validate-user-external.php",
161            type: 'post',
162            data: {p: itiLogin[key].getNumber(), n: $("#userfullyname").val(), e: $("#useremail").val(), t: typeLogin, cc: $("#code").val()},
163            cache: false,
164            dataType: 'json',
165            success: function (data) {
166                if (data.status === "success") {
167                    location.reload();
168                } else if (data.status === 'token_fail') {
169                    $("#modal-index .text-danger").text(data.text);
170                }
171            }
172        });
173
174    });
175
176    $('input[name=userphone], input[name=uservalphone], input[name=contactusernum], input[name=uservalphone-info]').each(function (key) {
177        $(this).attr('data-key', key);
178        itiLogin[key] = intlTelInput($(this)[0], {
179            //utilsScript: "/js/plugins/intl-tel-input-17.0.16/build/js/utils.js",
180            initialCountry: "auto",
181            geoIpLookup: function(success, failure) {
182                $.get("https://ipinfo.io", function(response) {
183                    var countryCode = response.country || "US";
184                    success(countryCode);
185                }, "jsonp").fail(function() {
186                    success("US");
187                });
188            }
189        });
190    });
191
192    function isValidEmailAddress(emailAddress) {
193        var pattern = new RegExp(/^(("[\w-\s]+")|([\w-]+(?:\.[\w-]+)*)|("[\w-\s]+")([\w-]+(?:\.[\w-]+)*))(@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$)|(@\[?((25[0-5]\.|2[0-4][0-9]\.|1[0-9]{2}\.|[0-9]{1,2}\.))((25[0-5]|2[0-4][0-9]|1[0-9]{2}|[0-9]{1,2})\.){2}(25[0-5]|2[0-4][0-9]|1[0-9]{2}|[0-9]{1,2})\]?$)/i);
194        return pattern.test(emailAddress);
195    }
196
197    $(document).on("click", ".mark-item", function () {
198        var object = $(this);
199        var table_ = $(this).attr('data-table');
200        var table_id = $(this).attr('data-id');
201        var type = $(this).attr('data-type');
202        var url = $(this).attr('data-url');
203        var mls = $(this).attr('data-mls');
204        var vendor = $(this).attr('data-vendor');
205        $.ajax({
206            url: "/templates-idx/template-1/includes/mark-like-favorite.php",
207            type: 'post',
208            data: {
209                table_: table_,
210                table_id: table_id,
211                type: type,
212                url: url,
213                mls: mls,
214                vendor: vendor
215            },
216            cache: false,
217            dataType: 'json',
218            success: function (data) {
219                if (type === 'like') {
220                    $(object).css("color", data.color_like + " !important");
221                }
222                if (type === 'favorite') {
223                    $(object).css("color", data.color_favorite + " !important");
224                }
225
226            }
227        });
228    });
229
230//    if ($("#login-external").length > 0) {
231//        document.querySelector("#login-external").addEventListener("submit", function (e) {
232//            const key = parseInt($("#contactusernum").attr('data-key'));
233//            var number = itiLogin[key].getNumber();
234//            $('#realcontactusernum').val(number);
235//        }, false);
236//    }
237
238
239    $(document).on("click", "#button_enter, .submit-login", function () {
240        const key = parseInt($("#contactusernum").attr('data-key'));
241        var number = itiLogin[key].getNumber();
242        $('#realcontactusernum').val(number);
243        $("#login-external").submit();
244    });
245});

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.