1'use strict'; 2(function(window) { 3 var _self; 4 var _helper = window.helper; 5 var PrivacyPolicy = { 6 vars: { 7 formId : undefined, 8 userIp : undefined 9 }, 10 init: function() { 11 _self = this; 12 _self.vars.formId = window.location.host + window.location.pathname; 13 _self.ui.getElements(); 14 _self.ui.setEvents(); 15 //_self.actions.getUserIp(); 16 }, 17 ui: { 18 elements: { 19 20 }, 21 getElements: function() { 22 _self.ui.elements.nombres = $("[name='firstname']"); 23 _self.ui.elements.apellidos = $("[name='lastname']"); 24 _self.ui.elements.email = $("[name='email']"); 25 _self.ui.elements.rut = $("[name='rut']"); 26 _self.ui.elements.checks = $("input.checkbox-legal"); 27 _self.ui.elements.idPolitica = $("[name='idPolitica']"); 28 }, 29 setEvents: function() { 30 //console.log('check', _self.ui.elements.checks); 31 _self.ui.elements.checks.on('change', function () { 32 //console.log(this.id); 33 $('#'+this.id).prop('checked', this.checked ? 'checked': false); 34 }); 35 }, 36 }, 37 actions: { 38 /** 39 * Objeto encargado de manejar los elementos graficos de la vista. 40 */ 41 postToLogs: function() { 42 $.ajax({ 43 url: "/app_seguros/PrivacyPolicy.php", 44 cache: false, 45 type: "POST", 46 dataType: 'json', 47 data: { 48 funcion : "postToLogs", 49 nombre : typeof _self.ui.elements.nombres.val() == 'undefined' ? '' : _self.ui.elements.nombres.val(), 50 apellido : typeof _self.ui.elements.apellidos.val() == 'undefined' ? '' : _self.ui.elements.apellidos.val(), 51 correo : typeof _self.ui.elements.email.val() == 'undefined' ? '' : _self.ui.elements.email.val(), 52 versionPolitica : _self.ui.elements.idPolitica.val(), 53 aceptado : _self.ui.elements.checks.prop('checked'), 54 rut : typeof _self.ui.elements.rut.val() == 'undefined' ? '' : _self.ui.elements.rut.val(), 55 ip : _self.vars.userIp, 56 idFormularioRespondido : _self.vars.formId 57 }, 58 success: function(json) { 59 if (json.hasOwnProperty("estado")) { 60 if (json["estado"] == 201) { 61 console.log(`Logs POST: ${json["mensaje"]}`); 62 } else { 63 console.log(`Logs POST error ${json["estado"]}: ${json["mensaje"]}`); 64 }; 65 } else { 66 console.log(json["mensaje"]); 67 }; 68 }, 69 error: function(xhr, status, error) { 70 console.log("Error:", error); 71 } 72 }); 73 74 }, 75 76 getUserIp: function() { 77 $.get( "https://ifconfig.me/ip", function( data ) { 78 _self.vars.userIp = data; 79 }); 80 }, 81 82 }, 83 84 callbacks: { 85 }, 86 87 controls: { // Métodos que realicen algún control 88 89 90 }, 91 92 helper: { // Rutinas de ayuda como conversiones, formatos, etc. 93 94 } 95 }; 96 window.PrivacyPolicy = PrivacyPolicy; 97})(window); 98$(window).ready(function(){ 99 PrivacyPolicy.init(); 100})
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.