PageSourceSearch

https://www.clubtalleres.com.ar/wp-content/plugins/acreditaciones-cat/assets/front/script.js?ver=1.5

js clubtalleres.com.ar collected 2026-10-02 04:27:07 UTC 3,751 bytes, 129 lines download raw bytes

1/**
2 * Script del frontend - Formularios
3 * MEJORADO: Validación condicional para partidos-form-1
4 */
5jQuery(document).ready(function ($) {
6	// ===========================
7	// Toggle de periodistas
8	// ===========================
9	$('.bloque-periodista').each(function () {
10		$(this).children('p, select, input, textarea, label, br').hide();
11	});
12	$('.toggle-periodista').on('click', function () {
13		const container = $(this).parent();
14		container.children('p, select, input, textarea, label, br').slideToggle();
15	});
16	// ===========================
17	// Inicialización de formularios de partidos
18	// ===========================
19	function inicializarFormularioPartidos(param) {
20		const $input = $(`#partidos-form-${param}`);
21		
22		// ✅ VALIDACIÓN: Solo proceder si el elemento existe
23		if ($input.length === 0) {
24			return;
25		}
26		
27		// Crear el nuevo <select>
28		const $select = $('<select>', {
29			id: 'partidos-form',
30			name: 'partido_input',
31			class: $input.attr('class'),
32			required: true
33		});
34		// Agregar opción por defecto
35		$select.append($('<option>', {
36			value: '',
37			text: 'Selecciona partido...'
38		}));
39		// Reemplazar el input por el select
40		$input.replaceWith($select);
41		// Cargar dinámicamente las opciones
42		obtenerPartidos($select);
43	}
44	/**
45	 * Obtiene los partidos desde la API
46	 */
47	async function obtenerPartidos($select) {
48		try {
49			let response = await obtenerPartidosCALENDARIO(null, 135, 10);
50			const hoy = new Date();
51			let partidosAgregados = 0;
52			response.forEach(mes => {
53				mes.matches.forEach(match => {
54					const fechaPartido = match.formattedDate ? new Date(match.formattedDate) : null;
55					const estado = match.estado?._hash_text?.toLowerCase() || '';
56					const idLocal = match.local?._at_attributes?.id || '';
57					const esLocalTalleres = idLocal === "135";
58					const esFuturo = fechaPartido && fechaPartido >= hoy;
59					const noFinalizado = estado !== 'finalizado';
60					if (esLocalTalleres && (noFinalizado || esFuturo)) {
61						let nombreRival = match.visitante?._hash_text || 'Rival desconocido';
62						let fechaTexto = match.formattedDate || 'Fecha desconocida';
63						let nombreLocal = match.local?._hash_text || 'Local desconocido';
64						let campeonato = match.campeonato || 'Campeonato desconocido';
65						$select.append($('<option>', {
66							value: `${nombreLocal} vs ${nombreRival} - ${fechaTexto} - ${campeonato}`,
67							text: `${nombreLocal} vs ${nombreRival} - ${fechaTexto} - ${campeonato}`
68						}));
69						partidosAgregados++;
70					}
71				});
72			});
73			// Si no se agregaron partidos
74			if (partidosAgregados === 0) {
75				$select.append($('<option>', {
76					value: '',
77					text: 'No hay partidos disponibles',
78					disabled: true
79				}));
80			}
81		} catch (error) {
82			console.error('Error al obtener partidos:', error);
83			$select.append($('<option>', {
84				value: '',
85				text: 'Error cargando partidos',
86				disabled: true
87			}));
88		}
89	}
90
91	if ($('#partidos-form-1').length > 0) {
92		inicializarFormularioPartidos(1);
93	}
94	
95	const tab2 = $('#elementor-tab-title-2045');
96	if (tab2.length > 0) {
97		tab2.on('click', function () {
98			inicializarFormularioPartidos(2);
99		});
100	}
101	
102	const tab3 = $('#elementor-tab-title-2042');
103	if (tab3.length > 0) {
104		tab3.on('click', function () {
105			inicializarFormularioPartidos(3);
106		});
107	}
108	
109	const tab4 = $('#elementor-tab-title-2043');
110	if (tab4.length > 0) {
111		tab4.on('click', function () {
112			inicializarFormularioPartidos(4);
113		});
114	}
115	
116	const tab5 = $('#elementor-tab-title-2044');
117	if (tab5.length > 0) {
118		tab5.on('click', function () {
119			inicializarFormularioPartidos(5);
120		});
121	}
122	
123	const tab6 = $('#elementor-tab-title-2046');
124	if (tab6.length > 0) {
125		tab6.on('click', function () {
126			inicializarFormularioPartidos(6);
127		});
128	}
129});

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.