PageSourceSearch

https://lacartelera.pe/app/views/front_end/tnw_front_1/js/main.js

js lacartelera.pe collected 2026-09-27 01:12:01 UTC 6,991 bytes, 218 lines download raw bytes

1// document.addEventListener('DOMContentLoaded', function() {
2//     const fixedElement = document.querySelector('.ads-container-float');
3
4//     function handleScroll() {
5//         fixedElement.classList.remove('d-none');
6//         window.removeEventListener('scroll', handleScroll); // Solo dispara una vez
7//     }
8
9//     window.addEventListener('scroll', handleScroll);
10// });
11
12function isValidEmail(mail) { 
13    return /^\w+([\.\+\-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,4})+$/.test(mail); 
14  }
15function activarMenuResponsive() {
16    $('.menu-over').addClass('active');
17    $('.fantasma').addClass('active');
18    setTimeout(() => {
19        $('.fantasma').addClass('zindex');
20    }, 1);
21}
22function ocultarMenuResponsive() {
23    $('.menu-over').removeClass('active');
24    $('.fantasma').removeClass('active');
25    setTimeout(() => {
26        $('.fantasma').removeClass('zindex');
27    }, 300);
28}
29$('#registrate-aqui').click(function(){
30    $('#exampleModalCenter').modal('hide');
31    setTimeout(() => {
32        $('#modalRegister').modal('show');
33    }, 100);
34});
35$('#register-regular').click(function () {
36    let nombre = $('#nombre-register').val();
37    let apellido = $('#apellido-register').val();
38    let email = $('#email-register').val();
39    let password = $('#password-register').val();
40    if (nombre=='' || nombre==null) {
41        $('#nombre-register').addClass('is-invalid').focus();
42        return false;
43    }else{
44        $('#nombre-register').removeClass('is-invalid');
45    }
46    if (apellido=='' || apellido==null) {
47        $('#apellido-register').addClass('is-invalid').focus();
48        return false;
49    }else{
50        $('#apellido-register').removeClass('is-invalid');
51    }
52    if(!isValidEmail(email)){
53        $('#email-register').addClass('is-invalid').focus();
54        return false;
55    }else{
56        $('#email-register').removeClass('is-invalid');
57    }
58    if (password=='' || password==null) {
59        $('#password-register').addClass('is-invalid').focus();
60        return false;
61    }else{
62        $('#password-register').removeClass('is-invalid');
63    }
64    $.ajax({
65        url: url_web+"ajax_json.php",
66        data: {nombre:nombre, apellido:apellido, email: email, password: password, section: 'register'},
67        type: 'POST',
68        beforeSend: function(){
69            $('#register-regular').html(`Validando... <span class="spinner-border spinner-border-sm" role="status" aria-hidden="true"></span>`).attr("disabled","disabled");
70        },
71        success: function(result){
72            if(result){
73                location.reload(true);
74            }else{
75                setTimeout(() => {
76                    $('#register-regular').html(`Registrar Nueva Cuenta`).removeAttr("disabled");
77                    $('#email-register').addClass('is-invalid').focus();
78                    alert('El correo ya se encuentra registrado.');
79                }, 500);
80            }
81        },
82        error: function(error){
83            console.log(error);
84        }
85    })
86})
87$('#login-movil').click(function() {
88    ocultarMenuResponsive();
89    $('#exampleModalCenter').modal('show');
90})
91$('#login-regular').click(function () {
92    let email = $('#email-login').val();
93    let password = $('#password-login').val();
94    if(!isValidEmail(email)){
95        $('#email-login').addClass('is-invalid').focus();
96        return false;
97    }else{
98        $('#email-login').removeClass('is-invalid');
99    }
100    if (password=='' || password==null) {
101        $('#password-login').addClass('is-invalid').focus();
102        return false;
103    }else{
104        $('#password-login').removeClass('is-invalid');
105    }
106    $.ajax({
107        url: url_web+"ajax_json.php",
108        data: {email: email, password: password, section: 'login'},
109        type: 'POST',
110        beforeSend: function(){
111            $('#login-regular').html(`Validando... <span class="spinner-border spinner-border-sm" role="status" aria-hidden="true"></span>`).attr("disabled","disabled");
112        },
113        success: function(result){
114            if(result){
115                location.reload(true);
116            }else{
117                setTimeout(() => {
118                    $('#login-regular').html(`Ingresar`).removeAttr("disabled");
119                    $('#email-login').addClass('is-invalid').focus();
120                    $('#password-login').val('');
121                }, 500);
122            }
123        },
124        error: function(error){
125            console.log(error);
126        }
127    })
128})
129
130$('#btn-buscar-top').click(function () {
131    buscar()
132})
133$('#input-buscar-top').keypress(function(e) {
134    var code = (e.keyCode ? e.keyCode : e.which);
135    if(code==13){
136        buscar()
137    }
138});
139$('.btn-close-sesion').click(function () {
140    $.ajax({
141        url: url_web+"ajax_json.php",
142        data: {section: 'cerrar-sesion'},
143        type: 'POST',
144        beforeSend: function(){
145        },
146        success: function(result){
147            FB.logout();
148            location.href=url_web;
149        },
150        error: function(error){
151            console.log(error);
152        }
153    })
154})
155function buscar() {
156    let parametro = $('#input-buscar-top').val();
157    if(parametro=='' || parametro==null){
158        $('#input-buscar-top').focus();
159        return false;
160    }else{
161        
162        parametro = parametro.trim().replace(/\s+/g, '-')
163        
164        window.location = url_web + 'b/' + parametro;
165    }
166}
167
168$('#btn-login-facebook').click(function() {
169    FB.login(function(response) {
170        Login(response);
171     }, { scope: 'email' });
172});
173const Login = (response) =>  {
174    if (response.status == 'connected') {
175        FB.api('/me', { fields: 'name, first_name, last_name, email, picture' }, (data) => {
176
177            let nombre = data.first_name;
178            let apellido = data.last_name;
179            let email = data.email;
180            let image = data.picture;
181            let id = data.id;
182
183            $.ajax({
184                url: url_web + "ajax_json.php",
185                type: "post",
186                dataType: "json",
187                data: { nombre: nombre, apellido: apellido, facebook: id, email: email, image: image, section: 'login-facebook'},
188                success:function (respuesta) {
189                    if (respuesta) {
190                        location.reload(true);
191                        return
192                    }
193
194                    Swal.fire({
195                        type: 'error',
196                        title: 'Se detectó un problema con el inicio de sesión. Intentelo nuevamente'
197                    })
198                }
199            });
200
201        });
202    } else {
203        Swal.fire({
204            type: 'error',
205            title: 'Se detectó un problema con el inicio de sesión. Intentelo nuevamente'
206        })
207        console.log('fallo');
208    }
209}
210
211function openSearch () {
212    $('#form-search-movil').addClass('search-visible');
213    document.getElementById("input-buscar-top").focus();
214}
215
216function closeSearch () {
217    $('#form-search-movil').removeClass('search-visible');
218}

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.