PageSourceSearch

https://www.corgrap.com/js/buscadorAvanzado.js

js corgrap.com collected 2026-10-06 09:30:43 UTC 10,082 bytes, 284 lines download raw bytes

1// JavaScript Document
2
3$(document).ready(function(){
4	
5	window.addEventListener("pageshow", () => {
6			$(document).find('input[name="wAgruBusqueda"]').removeAttr('checked');
7	});	
8
9	$(document).on('change','.agrupacion',function(){
10		$('.agrupacion').removeClass('active');
11		$(this).addClass('active');
12	});
13
14	$(document).on('change', 'select[name="tipo_punta"]', function(){
15		var punta = $('select[name="tipo_punta"]').children('option:selected').data('img');
16		$(document).find('#grapa_punta').attr('src', 'images/buscadoravanzado/grapa_punta_'+punta+'.svg');
17	});
18
19	$(document).on('change', 'select[name="tipo_galga"]', function(){
20		var punta = $('select[name="tipo_galga"]').children('option:selected').data('img');
21		$(document).find('#grapa_galga').attr('src', 'images/buscadoravanzado/grapa_galga_'+punta+'.svg');
22	});
23
24	$(document).on('change', 'select[name="tipo_brad"]', function(){
25		var punta = $('select[name="tipo_brad"]').val();
26		$(document).find('#brad_brad').attr('src', 'images/buscadoravanzado/brad_'+punta+'.svg');
27		$(document).find('#brad_largo').attr('src', 'images/buscadoravanzado/brad_largo'+punta+'.svg');
28
29		if(punta == ""){
30			$(document).find('#brad_brad').attr('src', 'images/buscadoravanzado/brad_brad.svg');
31			$(document).find('#brad_largo').attr('src', 'images/buscadoravanzado/brad_largobrad.svg');
32		}
33	});
34
35	
36
37	
38
39	$(document).on('change', 'select[name="clavo_clavo"]', function(){
40		var punta = $('select[name="clavo_clavo"]').children('option:selected').data('img');
41		
42		if(punta == "electrosoldado"){
43			$(document).find('#clavo_clavo').attr('src', 'images/buscadoravanzado/clavo_'+punta+'.jpg');
44			$(document).find('select[name="diametro_cana"]').removeAttr('disabled');
45			$(document).find('option[data-bob]').hide();
46			$(document).find('option[data-elec]').show();
47		}else if(punta == "plastico"){
48			$(document).find('#clavo_clavo').attr('src', 'images/buscadoravanzado/clavo_'+punta+'.jpg');
49			$(document).find('select[name="diametro_cana"]').removeAttr('disabled');
50			$(document).find('option[data-elec]').hide();
51			$(document).find('option[data-bob]').show();
52		}else{
53			$(document).find('#clavo_clavo').attr('src', 'images/buscadoravanzado/clavo_electrosoldado.jpg');
54			$(document).find('option[data-elec]').show();
55			$(document).find('option[data-bob]').show();
56		}
57	});
58
59	$(document).on('change', 'select[name="tipo_cana"]', function(){
60		var punta = $('select[name="tipo_cana"]').children('option:selected').data('img');
61		$(document).find('#tipo_cana').attr('src', 'images/buscadoravanzado/clavo_'+punta+'.svg');
62	});
63
64	$(document).on('change', 'select[name="clavo_punta"]', function(){
65		var punta = $('select[name="clavo_punta"]').children('option:selected').data('img');
66		$(document).find('#clavo_punta').attr('src', 'images/buscadoravanzado/clavo_punta_'+punta+'.svg');
67	});
68
69
70	$('input[name="wAgruBusqueda"]').change(function(){ mostrarSegundoNivel(); });
71
72	
73
74	$(document).find("#margen").on("input", function() {
75    	var value = $("#margen").val();
76		$("#margen").attr('style', 'background:linear-gradient(to right, #f60 0%, #f60 ' + value + '%, #ccc ' + value + '%, #ccc 100%)');
77	});
78	$(document).on('change', '#margen', function(){
79		var margen = $(document).find('#margen').val();
80		console.log(margen);
81		setTimeout(function(){ buscador_avanzado(margen); },500);
82	});
83
84});
85
86function cargandoBuscador(auxDiv)
87{
88	$("#"+auxDiv).load("includes/cargandoBuscador.php",{ }, function() {
89	} );
90}
91
92function mostrarSegundoNivel()
93{	
94	var agrupacion, agrupacionAnt;
95	agrupacion = $("input[name='wAgruBusqueda']:checked").val();
96	agrupacionAnt = $.cookie("filBAAgrupacion");
97	$.cookie("filBAAgrupacion",agrupacion);
98	if(agrupacion!=agrupacionAnt) { $.cookie("filBA",null); $.cookie("filBAListaExpandida",null); }
99	cargandoBuscador("segundoNivelBuscador");
100	$("#segundoNivelBuscador").load("includes/busAvanzadoNivel2.php",{ agrupacion:agrupacion}, function() {
101		$('#tercerNivelBuscador').html('');
102	} );
103}
104
105function mostrarTercerNivel()
106{	
107	var agrupacion, tipProducto, tipProductoAnt;
108	agrupacion = $("#wAgruBusqueda").val();
109	tipProducto = $("#wTipProBusqueda").val();
110	tipProductoAnt=$.cookie("filBATipProducto");
111	$.cookie("filBATipProducto",tipProducto);
112	if(tipProducto!=tipProductoAnt) { $.cookie("filBA",null); $.cookie("filBAListaExpandida",null); }
113	cargandoBuscador("tercerNivelBuscador");
114	$("#tercerNivelBuscador").load("includes/busAvanzadoNivel3.php",{ agrupacion:agrupacion,tipProducto:tipProducto}, function() {
115		
116	} );
117}
118
119function expandirLista(id)
120{
121	var listaExpandida;
122	listaExpandida=$.cookie("filBAListaExpandida");
123	
124	if($("#listaBus"+id).css("display")=="block")
125	{
126		$("#tituloBus"+id).css("background-image","url(images/generic/masBus.png)");
127		$("#listaBus"+id).css("display","none");
128		listaExpandida = listaExpandida.replace(id,"");
129	}
130	else
131	{
132		$("#tituloBus"+id).css("background-image","url(images/generic/menosBus.png)");
133		$("#listaBus"+id).css("display","block");
134		listaExpandida+="."+id;
135	}
136	
137	listaExpandida = listaExpandida.replace("null.","");
138	listaExpandida = listaExpandida.replace("..",".");
139	$.cookie("filBAListaExpandida",listaExpandida);
140}
141
142function modSelBusAvan(auxDetCar)
143{
144	var listaDetCaracteristicas;
145	listaDetCaracteristicas=$.cookie("filBA");
146	if($("#cccDba"+auxDetCar).is(":checked"))
147	{
148		listaDetCaracteristicas+="."+auxDetCar;
149	}
150	else
151	{
152		listaDetCaracteristicas = listaDetCaracteristicas.replace(auxDetCar,"");
153	}	
154	listaDetCaracteristicas = listaDetCaracteristicas.replace("null.","");
155	listaDetCaracteristicas = listaDetCaracteristicas.replace("..",".");
156	$.cookie("filBA",listaDetCaracteristicas);
157}
158
159function modSelBusAvanSelector(auxCar)
160{
161	var listaDetCaracteristicas, aux;
162	listaDetCaracteristicas=$.cookie("filBA");
163	$('[id^=selDetCaract'+auxCar+'] option').each(function(index) {
164		auxQuita=$(this).val();
165		listaDetCaracteristicas = listaDetCaracteristicas.replace(auxQuita,"");
166		
167	} );
168	
169	aux=$("#selDetCaract"+auxCar).val();
170	if(aux!="")
171	{
172		listaDetCaracteristicas+="."+aux;
173	}
174	else
175	{
176		listaDetCaracteristicas = listaDetCaracteristicas.replace(aux,"");
177	}	
178	listaDetCaracteristicas = listaDetCaracteristicas.replace("null.","");
179	listaDetCaracteristicas = listaDetCaracteristicas.replace("..",".");
180	$.cookie("filBA",listaDetCaracteristicas);
181}
182
183function quitarDetCarFiltro(auxDetCar)
184{
185	var listaDetCaracteristicas;
186	listaDetCaracteristicas=$.cookie("filBA");
187	
188	listaDetCaracteristicas = listaDetCaracteristicas.replace(auxDetCar,"");		
189	
190	listaDetCaracteristicas = listaDetCaracteristicas.replace("null.","");
191	listaDetCaracteristicas = listaDetCaracteristicas.replace("..",".");
192	$.cookie("filBA",listaDetCaracteristicas);
193	
194	mostrarTercerNivel();
195	resultadoBusAvanzado();
196}
197
198function resultadoBusAvanzado()
199{
200	
201	var busDir, agrupacion, tipProducto;
202	agrupacion = $("#wAgruBusqueda").val();
203	tipProducto = $("#wTipProBusqueda").val();
204	busDir = $("#mosBusDirecta").val();
205	
206	if(busDir==1)
207	{
208		cargandoBuscador("divResBusAvanzado");
209		$("#divResBusAvanzado").load("includes/resultadoBuscadorAvanzado.php",{ agrupacion:agrupacion,tipProducto:tipProducto}, function() {
210			
211		} );
212	}
213	else
214	{
215		abrir('buscador-avanzado');
216	}
217	
218}
219
220function buscador_avanzado(margen=30){
221		jQuery('#contenido_buscador_avanzado').html('<div class="cargando"></div>');
222		var agr = $(document).find('input[name="agrupacion"]').val();
223		var type = $(document).find('input[name="type"]').val();
224		var opcion = $(document).find('input[name="opcion"]').val();
225
226		
227		var caracteristica1, caracteristica2, caracteristica3, caracteristica4, caracteristica5, caracteristica6, caracteristica7, caracteristica8;
228
229		if(type == "grapas" && opcion == "consumible"){
230			caracteristica1=$(document).find('select[name="tipo_punta"]').val();
231			//caracteristica2=$(document).find('input[name="puente_exterior"]').val();
232			caracteristica2=$(document).find('input[name="puente_interior"]').val();
233			caracteristica3=$(document).find('input[name="largo_grapa"]').val();
234			caracteristica4=$(document).find('select[name="tipo_galga"]').val();
235		} else if (type == "grapas" && opcion == "herramientas"){
236			caracteristica1=$(document).find('input[name="largo_grapa"]').val();
237		}
238
239		if(type == "brads"  && opcion == "consumible"){
240			caracteristica1=$(document).find('select[name="tipo_brad"]').val();
241			caracteristica2=$(document).find('input[name="largo_brad"]').val();
242			caracteristica5=$(document).find('select[name="tipo_galga"]').val();
243		} else if (type == "brads" && opcion == "herramientas"){
244			caracteristica1=$(document).find('select[name="tipo_brad"]').val();
245			caracteristica2=$(document).find('input[name="largo_brad"]').val();
246		}
247
248		if(type == "clavos" && opcion == "consumible"){
249			caracteristica1=$(document).find('select[name="clavo_clavo"]').val();
250			caracteristica2=$(document).find('select[name="tipo_cana"]').val();
251			caracteristica3=$(document).find('select[name="diametro_cana"]').val();
252			caracteristica4=$(document).find('select[name="clavo_punta"]').val();
253			caracteristica5=$(document).find('input[name="largo_clavo"]').val();
254		} else if (type == "clavos" && opcion == "herramientas"){
255			caracteristica1=$(document).find('select[name="clavo_clavo"]').val();
256			caracteristica2=$(document).find('input[name="largo_clavo"]').val();
257		}
258
259		jQuery.ajax({
260			       url: 'includes/buscadorAvanzadoReturn.php',
261			       type: 'POST',
262			       data: { 	
263			       			agr : agr,
264			       			type : type,
265			       			caracteristica1 : caracteristica1,
266			       			caracteristica2 : caracteristica2,
267			       			caracteristica3 : caracteristica3,
268			       			caracteristica4 : caracteristica4,
269			       			caracteristica5 : caracteristica5,
270			       			caracteristica6 : caracteristica6,
271			       			caracteristica7 : caracteristica7,
272			       			caracteristica8 : caracteristica8,
273			       			margen : margen,
274			       			opcion:opcion
275						},
276			       success: function(data){
277			         if(data != ""){ 
278			         	jQuery('#contenido_buscador_avanzado').html(data);
279			          }
280			       }
281			    });
282
283	return false;
vendor: 1 bytes, line 284
284}

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.