1function soloNumeros(e) { 2 var t = e.which || e.keyCode; 3 return (t > 47 && t < 58) || ([0, 8].indexOf(t) !== -1); 4} 5 6 7function es_fecha(f) { 8 [d, m, y] = f.split('/'); 9 d *= 1; 10 m *= 1; 11 y *= 1; 12 if ((y > 0) && (m > 0) && (m < 13) && (d > 0) && (d <= [0, 31, ((y % 100 === 0) ? (y % 400 === 0) : (y % 4 === 0)) ? 29 : 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31][m])) { 13 var f = new Date(y, m-1, d); 14 var h = new Date(); 15 return f < h; 16 } else { 17 return false; 18 } 19} 20 21 22function edad(f) { 23 [d, m, y] = f.split('/'); 24 d *= 1; 25 m *= 1; 26 y *= 1; 27 var h = new Date(); 28 var e = h.getFullYear() - y; 29 if ((m > (h.getMonth() + 1)) || (m == (h.getMonth() + 1) && d > h.getDate())) e--; 30 return Math.max(0, e); 31} 32 33 34function validarEmail(email) { 35 var re = /^(([^<>()\[\]\\.,;:\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,}))$/; 36 return re.test(email); 37} 38 39 40function valida_cif_nif_nie(n) { 41 letras_nif = ['T', 'R', 'W', 'A', 'G', 'M', 'Y', 'F', 'P', 'D', 'X', 'B', 'N', 'J', 'Z', 'S', 'Q', 'V', 'H', 'L', 'C', 'K', 'E', 'O'] 42 letras_cif = 'ABCDEFGHJKLMNPRQSUVW' 43 control_cif = ['J', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I'] 44 45 primera = n.charAt(0) 46 ultima = n.charAt(n.length - 1) 47 48 if (!isNaN(primera) || primera.toUpperCase() == 'X' || primera.toUpperCase() == 'Y' || primera.toUpperCase() == 'Z') { 49 switch (primera.toUpperCase()){ 50 case 'X': 51 num = 1 * n.substring(1, n.length - 1) 52 break 53 case 'Y': 54 num = 1 * n.substring(1, n.length - 1) + 10000000 55 break 56 case 'Z': 57 num = 1 * n.substring(1, n.length - 1) + 20000000 58 break 59 default: 60 num = 1 * n.substring(0, n.length - 1) 61 } 62 if (ultima.toUpperCase() != letras_nif[num % 23]) { 63 return false 64 } 65 } else if (letras_cif.indexOf(primera.toUpperCase()) != -1) { 66 pares = 0 67 nones = 0 68 for (i = 2; i < 8; i += 2) { 69 pares += parseInt(n.charAt(i)); 70 } 71 for (i = 1; i < 9; i += 2) { 72 tmp = 2 * parseInt(n.charAt(i)); 73 if (tmp > 9) { 74 tmp = 1 + (tmp % 10); 75 } 76 nones += tmp; 77 } 78 control = (10 - ((pares + nones) % 10)) % 10 79 if (ultima != control && ultima.toUpperCase() != control_cif[control]) { 80 return false; 81 } 82 } else { 83 return false; 84 } 85 return true; 86} 87 88 89function cambio(elemento) { 90 if (elemento.val().search(/\S/) != -1){ 91 elemento.addClass('has-value'); 92 } 93} 94 95 96function custPopup() { 97 $('.modal-btn').click(function(event) { 98 event.preventDefault(); 99 var modalId = $(this).attr('data-modal'); 100 $('body').append('<div class="modal__filter"></div>').addClass('modal__open'); 101 $(modalId).fadeIn(); 102 $('.modal__filter').fadeIn(); 103 }); 104 105 $('.close').click(function() { 106 $('body').removeClass('modal__open'); 107 $(this).closest('.modal__wrapp').fadeOut(); 108 $('.modal__filter').fadeOut().remove(); 109 }); 110} 111 112 113function selectorClinica(id) { 114 // en el mapa 115 // cambiar todas siempre $('#m-'+id).toggleClass('active'); 116 $('[id^=m-]').removeClass('active').filter('#m-'+id).addClass('active'); 117 118 // en el listado 119 // cambiar todas siempre $('#l-'+id).toggleClass('selected'); 120 $('[id^=l-]').removeClass('selected').filter('#l-'+id).addClass('selected'); 121} 122 123$(document).ready(function() { 124 // Guardar form_plus 125 $("#form_plus").submit(function(e) { 126 e.preventDefault(); 127 var f = e.currentTarget; 128 129 hashcash_create(f.csrf_token); 130 131 var inputs = new FormData(f); 132 $.post('codigo/storeInputs.php', Object.fromEntries(inputs.entries()), function(data) { 133 if (data.guardado) { 134 window.location.href = f.action; 135 } else { 136 window.location.href = 'error.php'; 137 } 138 }, 'json'); 139 }); 140 141 // Procesar form_contacto 142 $("#form_contacto").submit(function(e) { 143 e.preventDefault(); 144 var f = e.currentTarget; 145 146 var error = 0; 147 var texto = ''; 148 149 if (f.smfr_enviando === undefined) { 150 var input = document.createElement('input'); 151 input.setAttribute('type', 'hidden'); 152 input.setAttribute('name', 'smfr_enviando'); 153 input.setAttribute('value', 0); 154 f.appendChild(input); 155 } 156 157 if (f.nombre.value.search(/\S/) == -1) {
158 texto += "- Nombre\n"; 159 error = 1; 160 } 161 if (f.telefono.value.search(/\S/) == -1) { 162 texto += "- Tel\u00e9fono\n"; 163 error = 1; 164 } else if (f.telefono.value.length != 9) { 165 texto += "- Tel\u00E9fono con formato incorrecto (9 d\u00EDgitos)\n"; 166 error = 1; 167 } else if (f.telefono.value.search(/^[6|7|8|9]/i) == -1) { 168 texto += "- Tel\u00E9fono debe empezar por 6, 7, 8 \u00F3 9\n"; 169 error = 1; 170 } 171 if (f.acepto.checked == false) { 172 texto += "- Aceptar condiciones\n"; 173 error = 1; 174 } 175 176 if (error) { 177 alert(texto); 178 } else if (1 * f.smfr_enviando.value == 0) { 179 f.smfr_enviando.value = 1; 180 181 hashcash_create(f.csrf_token); 182 183 var inputs = new FormData(f); 184 $.post('codigo/contacto.php', Object.fromEntries(inputs.entries()), function(data) { 185 if (data.ok) { 186 $('#form_contacto').hide(); 187 $('#form_gracias').show(); 188 } else { 189 window.location.href = 'error.php'; 190 } 191 }, 'json'); 192 } 193 }); 194 195}); 196 197/* 198 cambiar la clase en los inputs rellenos 199 esto tiene que hacerse cuando se ha cargado la página completa con los valores de los inputs 200*/ 201setTimeout(function() { 202 $('input').each(function() { 203 if (['text', 'tel', 'date', 'email'].includes($(this).prop('type'))) { 204 if ($(this).val() != '') { 205 $(this).addClass('has-value'); 206 } 207 } 208 }); 209}, 200); 210 211/* hashcash */ 212function hashcash_create(c,v=0){for(var d=!1,h="",a="";!d;)a=(v?c:c.value)+""+randomString(20),h=SHA1(a),d="00"==h.substring(0,2);if(v){return a}else{c.value=a}} 213function randomString(c){for(var d="",h=0;h<c;h++)d+="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz".charAt(Math.floor(61*Math.random()));return d} 214function SHA1(c){function d(a,b){return a<<b|a>>>32-b}function h(a){var b="",c,d;for(c=7;0<=c;c--)d=a>>>4*c&15,b+=d.toString(16);return b}var a,e,k=Array(80),p=1732584193,q=4023233417,r=2562383102,s=271733878,t=3285377520,b,f,g,l,m;c=function(a){a=a.replace(/\r\n/g,"\n");for(var b="",c=0;c<a.length;c++){var d=a.charCodeAt(c);128>d?b+=String.fromCharCode(d):(127<d&&2048>d?b+=String.fromCharCode(d>>6|192):(b+=String.fromCharCode(d>>12|224),b+=String.fromCharCode(d>>6&63|128)),b+=String.fromCharCode(d& 63|128))}return b}(c);b=c.length;var n=[];for(a=0;a<b-3;a+=4)e=c.charCodeAt(a)<<24|c.charCodeAt(a+1)<<16|c.charCodeAt(a+2)<<8|c.charCodeAt(a+3),n.push(e);switch(b%4){case 0:a=2147483648;break;case 1:a=c.charCodeAt(b-1)<<24|8388608;break;case 2:a=c.charCodeAt(b-2)<<24|c.charCodeAt(b-1)<<16|32768;break;case 3:a=c.charCodeAt(b-3)<<24|c.charCodeAt(b-2)<<16|c.charCodeAt(b-1)<<8|128}for(n.push(a);14!=n.length%16;)n.push(0);n.push(b>>>29);n.push(b<<3&4294967295);for(c=0;c<n.length;c+=16){for(a=0;16>a;a++)k[a]= n[c+a];for(a=16;79>=a;a++)k[a]=d(k[a-3]^k[a-8]^k[a-14]^k[a-16],1);e=p;b=q;f=r;g=s;l=t;for(a=0;19>=a;a++)m=d(e,5)+(b&f|~b&g)+l+k[a]+1518500249&4294967295,l=g,g=f,f=d(b,30),b=e,e=m;for(a=20;39>=a;a++)m=d(e,5)+(b^f^g)+l+k[a]+1859775393&4294967295,l=g,g=f,f=d(b,30),b=e,e=m;for(a=40;59>=a;a++)m=d(e,5)+(b&f|b&g|f&g)+l+k[a]+2400959708&4294967295,l=g,g=f,f=d(b,30),b=e,e=m;for(a=60;79>=a;a++)m=d(e,5)+(b^f^g)+l+k[a]+3395469782&4294967295,l=g,g=f,f=d(b,30),b=e,e=m;p=p+e&4294967295;q=q+b&4294967295;r=r+f&4294967295; s=s+g&4294967295;t=t+l&4294967295}m=h(p)+h(q)+h(r)+h(s)+h(t);return m.toLowerCase()};
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.