PageSourceSearch

https://www.minagricultura.gov.co/typo3conf/ext/madrdefault/Resources/Public/js/madr.js?1784835068

js minagricultura.gov.co collected 2026-09-24 08:41:51 UTC 8,365 bytes, 226 lines download raw bytes

1
2document.addEventListener("DOMContentLoaded", function()
3{
4	// vars
5	const btn_hamburguer = document.getElementById('btn_hamburguer');
6	const btn_saltar = document.getElementById('btn-saltar');
7	const contentMainMadr = document.getElementById("contentMainMadr");
8
9	//Events
10	if(typeof(btn_hamburguer) != 'undefined' && btn_hamburguer != null)
11	{
12		btn_hamburguer.addEventListener("click", function()
13		{
14			if(btn_hamburguer.classList.contains("active"))
15			{
16				btn_hamburguer.classList.remove("active");
17			}
18			else {
19				btn_hamburguer.classList.add("active");
20			}
21		});
22	}
23	if(typeof(btn_saltar) != 'undefined' && btn_saltar != null)
24	{
25		btn_saltar.addEventListener("click", function()
26		{
27			if(typeof(contentMainMadr) != 'undefined' && contentMainMadr != null)
28			{
29				contentMainMadr.setAttribute('tabindex', '-1');
30				contentMainMadr.focus();
31				return false;
32			}
33		});
34	}
35
36	/* Accesibilidad */
37	document.addEventListener("keyup", detectTabKey);
38	/* Accesibilidad */
39	window.onload = function() {
40		window.micAccessTool = new MicAccessTool({
41			link: 'http://your-awesome-website.com/your-accessibility-declaration.pdf',
42			contact: 'mailto:[email protected]',
43			buttonPosition: 'right', // default is 'left'
44			forceLang: 'es-ES' // default is 'en' may be 'he-IL', 'ru-RU', or 'fr_FR'
45		});
46	}
47
48	// Volver arriba
49	var backGoToUpElement = document.querySelector(".volver-arriba-govco");
50	if (backGoToUpElement) {
51		backGoToUpElement.addEventListener("click", backGoToUp, false);
52		backGoToUpElement.addEventListener("keydown", function(e){
53			if (e.key === 'Enter' || e.key === ' ') { e.preventDefault(); backGoToUp(); }
54		}, false);
55		function backGoToUp() {
56			document.body.scrollTop = document.documentElement.scrollTop = 0;
57		}
58		// Mostrar siempre el botón y exponerlo a tecnologías de asistencia
59		backGoToUpElement.hidden = false;
60		backGoToUpElement.setAttribute('aria-hidden','false');
61	}
62
63	// CARRUSEL
64	window.addEventListener("load", function(event) {
65		window.addEventListener('resize', windowSizeCarrusel);
66		windowSizeCarrusel();
67	});
68
69	var carousels = document.querySelectorAll('.carrusel-govco');
70	var configurationCarousel = {};
71	for (const carousel of carousels) {
72		configurationCarousel[carousel.id] = new bootstrap.Carousel(carousel, {
73			pause: false
74		});
75		var controlsCarrusel = carousel.querySelectorAll('.control-start-pause .controls');
76		methodAssign("click", startStopCarousel, controlsCarrusel);
77		carousel.addEventListener('slid.bs.carousel', function () {
78			this.querySelectorAll('.carousel-item:not(.active) a').forEach(x => x.tabIndex = -1);
79			this.querySelectorAll('.carousel-item.active a').forEach(x => x.tabIndex = 0);
80		});
81	}
82
83	function windowSizeCarrusel()
84	{
85		let containerInputsFile = document.querySelectorAll('.carrusel-govco');
86		for (let e of containerInputsFile) {
87			if (e.offsetWidth < 652) {
88				e.classList.add('responsive-carrusel-govco');
89			} else {
90				e.classList.remove('responsive-carrusel-govco');
91			}
92		}
93	}
94
95	function methodAssign(e, f, a)
96	{
97		for (let i of a) {
98			i.addEventListener(e, f, false);
99		}
100	}
101
102	function startStopCarousel()
103	{
104		const container = this.parentNode.parentNode;
105		this.classList.remove("active");
106
107		if (this.classList.contains("start")) {
108			this.nextElementSibling.classList.add("active");
109			configurationCarousel[container.id].cycle();
110		} else {
111			this.previousElementSibling.classList.add("active");
112			configurationCarousel[container.id].pause();
113		}
114	}
115
116});
117// DOMContentLoaded  end
118
119function detectTabKey(e)
120{
121	if (e.keyCode == 9) {
122		if (document.getElementById("botoncontraste").classList.contains("active-barra-accesibilidad-govco")) {
123		document.getElementById("botoncontraste").classList.toggle("active-barra-accesibilidad-govco");}
124		if (document.getElementById("botonaumentar").classList.contains("active-barra-accesibilidad-govco")) {
125		document.getElementById("botonaumentar").classList.toggle("active-barra-accesibilidad-govco");}
126		if (document.getElementById("botondisminuir").classList.contains("active-barra-accesibilidad-govco")) {
127		document.getElementById("botondisminuir").classList.toggle("active-barra-accesibilidad-govco");}
128	}
129}
130
131function cambiarContexto()
132{
133	var botoncontraste = document.getElementById("botoncontraste");
134	var botonaumentar = document.getElementById("botonaumentar");
135	var botondisminuir = document.getElementById("botondisminuir");
136
137	if (!botoncontraste.classList.contains("active-barra-accesibilidad-govco")) {
138		botoncontraste.classList.toggle("active-barra-accesibilidad-govco");
139		document.getElementById("titleaumentar").style.display="";
140		document.getElementById("titledisminuir").style.display="";
141		document.getElementById("titlecontraste").style.display="none";
142	}
143	if (botondisminuir.classList.contains("active-barra-accesibilidad-govco")) {
144		botondisminuir.classList.remove("active-barra-accesibilidad-govco");
145	}
146	if (botonaumentar.classList.contains("active-barra-accesibilidad-govco")) {
147		botonaumentar.classList.remove("active-barra-accesibilidad-govco");
148	}
149
150	// var element = document.getElementById('para-mirar');
151	if (document.body.className == 'modo_oscuro-govco') {
152		// var element = document.getElementById('para-mirar');
153		document.body.className = "modo_claro-govco";
154	} else {
155		// var element = document.getElementById('para-mirar');
156		document.body.className = "modo_oscuro-govco";
157	}
158}
159
160function disminuirTamanio(operador)
161{
162	var botoncontraste = document.getElementById("botoncontraste");
163	var botonaumentar = document.getElementById("botonaumentar");
164	var botondisminuir = document.getElementById("botondisminuir");
165
166	if (!botondisminuir.classList.contains("active-barra-accesibilidad-govco")) {
167		botondisminuir.classList.toggle("active-barra-accesibilidad-govco");
168		document.getElementById("titleaumentar").style.display="";
169		document.getElementById("titledisminuir").style.display="none";
170		document.getElementById("titlecontraste").style.display="";
171	}
172	if (botonaumentar.classList.contains("active-barra-accesibilidad-govco")) {
173		botonaumentar.classList.remove("active-barra-accesibilidad-govco");
174	}
175	if (botoncontraste.classList.contains("active-barra-accesibilidad-govco")) {
176		botoncontraste.classList.remove("active-barra-accesibilidad-govco");
177	}
178
179	// var div1 = document.getElementById("para-mirar")
180	// var texto = div1.getElementsByTagName("p");
181	// var texto = document.body.getElementsByTagName("p");
182	var texto = document.querySelectorAll('p,h1,h2,h3,h4,h5,a');
183	for (let element of texto) {
184		const total = tamanioElemento(element);
185		const nuevoTamanio = (operador === 'aumentar' ? (total + 1) : (total - 1)) + 'px';
186		element.style.fontSize = nuevoTamanio
187	}
188}
189
190function aumentarTamanio(operador)
191{
192	var botoncontraste = document.getElementById("botoncontraste");
193	var botonaumentar = document.getElementById("botonaumentar");
194	var botondisminuir = document.getElementById("botondisminuir");
195
196	if (!botonaumentar.classList.contains("active-barra-accesibilidad-govco")) {
197		botonaumentar.classList.toggle("active-barra-accesibilidad-govco");
198		document.getElementById("titleaumentar").style.display="none";
199		document.getElementById("titledisminuir").style.display="";
200		document.getElementById("titlecontraste").style.display="";
201	}
202	if (botondisminuir.classList.contains("active-barra-accesibilidad-govco")) {
203		botondisminuir.classList.remove("active-barra-accesibilidad-govco");
204	}
205	if (botoncontraste.classList.contains("active-barra-accesibilidad-govco")) {
206		botoncontraste.classList.remove("active-barra-accesibilidad-govco");
207	}
208
209	// var div1 = document.getElementById("para-mirar")
210	// var texto = div1.getElementsByTagName("p");
211	var texto = document.querySelectorAll('p,h1,h2,h3,h4,h5,a');
212	for (let element of texto) {
213		const total = tamanioElemento(element);
214		if(total<=64)
215		{
216			const nuevoTamanio = (operador === 'aumentar' ? (total + 1) : (total - 1)) + 'px';
217			element.style.fontSize = nuevoTamanio
218		}
219	}
220}
221
222function tamanioElemento(element)
223{
224	const tamanioParrafo = window.getComputedStyle(element, null).getPropertyValue('font-size');
225	return parseFloat(tamanioParrafo);
226}

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.