PageSourceSearch

https://www.viladrich.com/es/js/check.js?version=3

js viladrich.com collected 2026-09-24 11:40:30 UTC 4,086 bytes, 204 lines download raw bytes

1function campoVacio(campo, mensaje)
2{
3	if (campo.value=="") {
4		alertModal(mensaje, campo);
5		//campo.focus();
6		return true;
7	}
8	return false;
9}
10
11function campoVacioDefecto(campo,nombreCampo,valorDefecto)
12{
13	if (campo.value=="" || campo.value==valorDefecto) {
14		alert("El campo "+nombreCampo+" no puede estar vacío");
15		campo.focus();
16		return true;
17	}
18	return false;
19}
20
21function selectVacio(campo, nombreCampo)
22{
23	if (campo.options[campo.selectedIndex].value=="") {
24		if (nombreCampo!="") {
25			alert("El campo "+nombreCampo+" no puede estar vacío");
26			campo.focus();
27		}
28		return true;
29	}
30	return false;
31}
32
33function opcionVacia(campo, totalOpciones, mensaje)
34{
35	var seleccionado=false;
36	
37	if (totalOpciones>1) {
38		for (var i=0; i<totalOpciones && !seleccionado; i++)
39		{
40			if (campo[i].checked) {
41				seleccionado=true;
42			}
43		}
44	} else if (campo.checked) {
45		seleccionado=true;
46	}
47
48	if (!seleccionado) {
49		if (mensaje!="") {
50			if (totalOpciones>1) {
51				alertModal(mensaje, campo[0]);
52			} else {
53				alertModal(mensaje, campo);
54			}
55		}
56		return true;
57	}
58	return false;
59}
60
61function isNumeric(n)
62{
63	var number = '0';
64	var longi = n.length;
65	for (var i = 0; i < longi; i++)
66	{
67		number = n.charAt(i);
68		if (number >= '0' && number <= '9')
69			continue;
70		else 
71			return false;
72	}
73	return true;
74}
75
76function isFloat (n)
77{
78	if (n.length==1 && (n.charAt(0)=='-' || n.charAt(0)=='.')) {
79		return false;
80	} else if (n.length>1 && n.charAt(n.length-1)=='.') {
81		return false;
82	}
83	var number = '0';
84	var nPoint = 0;
85	for (var i = 0; i < n.length; i++)
86	{
87		number = n.charAt(i);
88		if (number >= '0' && number <= '9')
89			continue;
90		else if (number == '-' && i==0)
91			continue;
92		else if (number == '.' && nPoint==0) {
93			nPoint=1;
94			continue;
95		}
96		else 
97			return false;
98	}
99	return true;
100}
101
102function isPercentage(percentage, name)
103{
104	if (!isFloat(percentage.value) || percentage.value<0 || percentage.value>100) {
105		alert("El porcentaje de "+name+" no es válido, debe ser un número entre cero y 100");
106		percentage.focus();
107		return false;
108	}
109	return true;
110}
111
112function longExcesiva(campo,nombreCampo,longMax)
113{
114	if (campo.value.length > longMax) {
115		alert("No puedes introducir más de "+longMax+" caracteres en el campo "+nombreCampo);
116		campo.focus();
117		return true;
118	}
119	return false;
120}
121
122function isEmail(email)
123{
124	var posArroba = email.indexOf('@',0);
125	
126	if (posArroba <= 0)
127		return false;
128
129	var posPunto = email.indexOf('.',posArroba);
130		
131	if (posPunto == -1)
132		return false;
133		
134	if (posPunto+1 == email.length)
135		return false;
136	// Despues del punto solo puede haber: a-z 0-9 . _-
137	if (!contieneCaracteresPermitidos(email.substr(posPunto+1), "._-"))
138		return false;
139
140	return true;
141}
142
143function isAlfanumerico(valor)
144{
145	var longi = valor.length;
146	var c;
147	valor = valor.toLowerCase();
148	
149	if (longi>0) {
150		c = valor.charAt(0);
151		if (!(c >= 'a' && c <= 'z')) {
152			return false;
153		}
154	}
155	
156	for (var i = 1; i < longi; i++)
157	{
158		c = valor.charAt(i);
159		if ((c >= '0' && c <= '9') || (c >= 'a' && c <= 'z') || c=='_' || c=='.')
160			continue;
161		else 
162			return false;
163	}
164	return true;
165}
166
167function contieneCaracteresPermitidos(valor, caracteresValidos)
168{
169	var longi = valor.length;
170	var c;
171	valor = valor.toLowerCase();
172	
173	for (var i = 0; i < longi; i++)
174	{
175		c = valor.charAt(i);
176		if ((c >= '0' && c <= '9') || (c >= 'a' && c <= 'z')) {
177			continue;
178		} else {
179			for (var j=0; j<caracteresValidos.length; j++) {
180				if (caracteresValidos.indexOf(c)==-1) {
181					return false;
182				}
183			}
184		}
185	}
186	return true;
187}
188
189function checkTipoVia(direc)
190{
191	//var tiposVias = new Array("C/", "CL", "CR", "ST", "AV", "V", "PG", "RU", "RL", "RD", "RB", "PR", "PZ", "PS", "PO", "CM", "CT", "TR", "PL", "PA");
192	var pos = direc.indexOf(" ");
193	if (pos > 0)
194	{
195		var tipoVia = direc.substr(0, pos+1); // substr(indexBegin, cuantos). Cojo el tipo de via con el espacio final incluido
196		
197		//alert("-"+direc.substring(pos+1, pos+tipoVia.length)+"=="+tipoVia+"-"+(pos+tipoVia.length));
198		if (direc.length>=(tipoVia.length*2) && direc.substr(pos+1, tipoVia.length) == tipoVia)
199		{
200			return false;
201		}
202	}
203	return true;
204}

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.