1var local = window.localStorage; 2 3$(document).ready(function () { 4 $(window).scroll(function () { 5 if ($(this).scrollTop() > 50) { 6 $('#back-to-top').fadeIn(); 7 } else { 8 $('#back-to-top').fadeOut(); 9 } 10 }); 11 // scroll body to 0px on click 12 $('#back-to-top').click(function () { 13 $('body,html').animate({ 14 scrollTop: 0 15 }, 400); 16 return false; 17 }); 18 $('[data-toggle="tooltip"]').tooltip(); 19 20 if ($(".clima-municipio").length) { 21 if (!local.getItem('clima')) { 22 local.setItem('clima', 17) 23 } 24 $(`.clima-municipio[data-id="${local.getItem('clima')}"]`).show(); 25 } 26 27 if (window.location.pathname == "/") { 28 if (/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)) { 29 $("#portada-video video").attr('src', '/video/promocion.mp4') 30 $("#portada-video video").prop('autoplay', true) 31 $("#portada-video video").prop('loop', true) 32 $("#portada-video video")[0].play(); 33 } else { 34 $("#portada-video video").attr('src', '/video/promocion.mp4') 35 $("#portada-video video").prop('autoplay', true) 36 $("#portada-video video").prop('loop', true) 37 $("#portada-video video")[0].play(); 38 } 39 } 40 41 // Idioma por defecto del sitio 42 const PAGE_LANG = 'es'; 43 44 // Idioma guardado o idioma del navegador 45 const savedLang = localStorage.getItem('lang'); 46 const browserLang = navigator.language.slice(0, 2); 47 const targetLang = savedLang || browserLang; 48 49 // Evitar traducir si es el mismo idioma 50 // if (targetLang === PAGE_LANG) return; 51 52 window.googleTranslateElementInit = function () { 53 new google.translate.TranslateElement( 54 { 55 pageLanguage: PAGE_LANG, 56 autoDisplay: false 57 }, 58 'google_translate_element' 59 ); 60 61 // Esperar a que el combo esté listo y cambiar idioma 62 const interval = setInterval(() => { 63 const select = document.querySelector('.goog-te-combo'); 64 if (!select) return; 65 66 select.value = targetLang; 67 select.dispatchEvent(new Event('change')); 68 clearInterval(interval); 69 }, 100); 70 }; 71 72 // Cargar script DESPUÃS del render 73 window.addEventListener('load', () => { 74 75 const script = document.createElement('script'); 76 script.src = '//translate.google.com/translate_a/element.js?cb=googleTranslateElementInit'; 77 script.async = true; 78 document.body.appendChild(script); 79 }); 80}); 81 82 83function translateTo(lang) { 84 const select = document.querySelector(".goog-te-combo"); 85 if (!select) return; 86 select.value = lang; 87 select.dispatchEvent(new Event("change")); 88 localStorage.setItem('lang', lang) 89} 90 91if (window.location.pathname == "/") { 92 $(".flotable").removeClass('flotable') 93} 94 95if ($(".flotable").length && window.location.pathname != "/") { 96 $("body").css('padding-top', $("#nav-principal")[0].offsetHeight + 'px'); 97 $(window).on('scroll', function () { 98 $("body").css('padding-top', $("#nav-principal")[0].offsetHeight + 'px'); 99 }) 100} 101 102 103$("body").on('click', '.pildora-horizontal.clima', function () { 104 let actual = $(`.clima[data-id='${local.getItem('clima')}']`); 105 let municipio = $(`.clima-municipio[data-id='${local.getItem('clima')}'] .mun`).text(); 106 let html_actual = ""; 107 for (const a of actual) { 108 html_actual += `<div class="col-lg-6 col-12 p-1"><div class="border rounded p-3">${$(a).html()}</div></div>`; 109 } 110 111 let botones = ""; 112 $(".nombre-municipio").map(function () { 113 let id = $(this).closest(".clima-municipio").attr('data-id'); 114 botones += `<button class="btn btn-sm btn-outline-primary seleccionar-municipio m-2 px-4" data-id="${id}">${$(this).text()}</button>`; 115 }) 116 let html = ` 117 <h2 class="font-weight-bold">¿Quieres estar al tanto del pronóstico del tiempo de tu municipio?</h2> 118 <div class="container-fluid"> 119 <div class="row"> 120 <div class="col-lg-6 col-12 pb-5" id="modal-clima-actual"> 121 <h4 class="mb-0">${municipio}</h4> 122 <div class="row">${html_actual}</div> 123 </div> 124 <div class="col-lg-6 col-12" id="modal-clima-otros"> 125 <p>Haz clic sobre tu municipio para marcarlo como principal en tu navegador</p> 126 ${botones} 127 </div> 128 </div> 129 </div> 130 `; 131 Swal.fire({ 132 html: html,
133 showConfirmButton: false, 134 customClass: 'swal-clima' 135 }); 136}) 137$("body").on('click', '.seleccionar-municipio', function () { 138 local.setItem('clima', $(this).attr('data-id')); 139 $(".clima-municipio").hide(); 140 $(`.clima-municipio[data-id="${local.getItem('clima')}"]`).show(); 141 Swal.close(); 142}); 143 144function openSearch() { 145 $("#buscador").show('fast') 146} 147 148$(window).on('scroll', function () { 149 if (this.scrollY > 100) { 150 $("#nav-principal:not(.bg-gradient)").addClass('bg-gradient'); 151 } else { 152 $("#nav-principal.bg-gradient").removeClass('bg-gradient'); 153 } 154}) 155 156function closeSearch() { 157 $("#buscador").hide('fast') 158} 159 160$(".pane-climas .ver-mas").click(function () { 161 $(this).closest('.pane-climas').find('.contenedor-cabeceras').toggleClass('expandir'); 162 if ($(this).text() == "Ver más") { 163 $(this).text("Ver menos") 164 } else { 165 $(this).text("Ver más") 166 } 167}) 168 169 170$("#directorio-menu").click(function () { 171 if ($("#directorio-lista").hasClass("activo")) { 172 $("#directorio-lista").removeClass('activo') 173 $("#directorio-lista").hide('fast') 174 } else { 175 $("#directorio-lista").addClass('activo') 176 $("#directorio-lista").show('fast') 177 } 178}) 179 180 181$(window).resize(function () { 182 if ($(window).width() >= 992) { 183 $("#directorio-lista").addClass('activo') 184 $("#directorio-lista").show('fast') 185 } else { 186 $("#directorio-lista").removeClass('activo') 187 $("#directorio-lista").hide('fast') 188 } 189}); 190 191 192 193document.addEventListener('DOMContentLoaded', function () { 194 var elems = document.querySelectorAll('.sidenav'); 195 var instances = M.Sidenav.init(elems); 196}); 197 198$(document).ready(function () { 199 $('.sidenav').sidenav(); 200}); 201 202 203 204$("body").delegate('.acordeon-anhios', 'click', function () { 205 $(".acorderon-anhios-contenedor").hide(200) 206 $(".acorderon-anhios-contenedor[data-cotenido='" + $(this).attr('data-anhio') + "']").show(200) 207}) 208 209 210$(document).ready(function () { 211 $('audio').audioPlayer(); 212 213 214 if ($('#banner').length && $('#banner').attr('style')[$('#banner').attr('style').length - 1] === ";") { 215 $('#banner').attr('style', $('#banner').attr('style').slice(0, -1) + ", url(" + $("meta[property='og:image']").attr('content') + ") center center") 216 } else { 217 $('#banner').attr('style', $('#banner').attr('style') + ", url(" + $("meta[property='og:image']").attr('content') + ") center center") 218 } 219 220 let notas = $("#principal-contenedor .nota-card"); 221 for (let i = 0; i < notas.length; i++) { 222 $(notas[i]).attr('style', $(notas[i]).attr('style').replace('var(--uan-gray)', '') + ", url(" + $("meta[property='og:image']").attr('content') + ") center center") 223 } 224 225 let gallery_elements = $(".uan-fotogaleria"); 226 for (let i = 0; i < gallery_elements.length; i++) { 227 $.ajax({ 228 url: window.location.origin + '/modulo/cargar/galeria/' + $(gallery_elements[i]).attr('data-galeria'), 229 type: 'get', 230 dataType: 'json', 231 data: { 232 }, 233 success: function (data) { 234 $(gallery_elements[i]).after(data) 235 $(gallery_elements[i]).remove() 236 $('#lightgallery').lightGallery(); 237 }, 238 error: function () { 239 } 240 }); 241 } 242 243 244 let visores = $(".visor"); 245 for (let i = 0; i < visores.length; i++) { 246 $(visores).eq(i).replaceWith('<iframe id="visorPdf' + i + '" src="/recursos/pdf/web/viewer.html?file=' + window.location.origin + $(visores).eq(i).attr('href') + '" title="webviewer" frameborder="0" width="100%" height="600"></iframe><a href="' + $(visores).eq(i).attr('href') + '" target="_blank" class="btn btn-primary pl-5 pr-5"><i class="mdi mdi-file"></i> Ir al PDF</a>') 247 248 249 250 //$(visores).eq(i).replaceWith('<iframe src="https://docs.google.com/gview?url='+window.location.origin +$(visores).eq(i).attr('href')+'&embedded=true" width="100%" height="600" allowfullscreen webkitallowfullscreen></iframe><a href="'+$(visores).eq(i).attr('href')+'" target="_blank" class="btn btn-primary pl-5 pr-5"><i class="mdi mdi-file"></i> Ir al PDF</a>') 251 } 252 253 254 $(".btn-facebook:not(.no-popup)").attr('onclick', 'window.open("https://www.facebook.com/sharer/sharer.php?u=' + window.location.href + '","popup","width=600,height=600"); return false;') 255 $(".btn-twitter:not(.no-popup)").attr('onclick', 'window.open("https://twitter.com/intent/tweet?text=&url=' + window.location.href + '&hashtags=UAN", "_blank"); return false;') 256 $(".btn-whatsapp:not(.no-popup)").attr('onclick', 'window.open("https://api.whatsapp.com/se
256nd?text=' + window.location.href + '", "_blank"); return false;') 257 $(".btn-print:not(.no-popup)").attr('onclick', 'PrintElem("principal-contenedor")') 258 $("#lateral-menu_sm .btn-facebook").eq(0).removeAttr('onclick'); 259 $("#principal-contenedor img").addClass('img-thumbnail') 260 261 //let imagenes_contenedor = $("#principal-contenedor img"); 262 let imagenes_contenedor = $("img:not(.ignore-a19)"); 263 for (let i = 0; i < imagenes_contenedor.length; i++) { 264 if ($(imagenes_contenedor[i]).attr('src').indexOf("/im/") > -1) { 265 let fragmentos = $(imagenes_contenedor[i]).attr('src').split('/'); 266 fragmentos = fragmentos.filter(item => item) 267 let directorio = fragmentos[1].split(',')[fragmentos[1].split(',').length - 1] 268 fragmentos[0] = ""; 269 fragmentos[1] = ""; 270 fragmentos = fragmentos.filter(item => item) 271 fragmentos = fragmentos.join('/'); 272 $(imagenes_contenedor[i]).attr('src', '/d/' + directorio + '/' + fragmentos) 273 } 274 } 275 276 $("article p").removeAttr('style'); 277}); 278 279function PrintElem(elem) { 280 var mywindow = window.open('', 'PRINT', 'height=720,width=1280'); 281
282 mywindow.document.write('<html><head><title>' + document.title + '</title>'); 283 mywindow.document.write('</head><body >'); 284 mywindow.document.write('<h1>' + document.title + '</h1>'); 285 286 287 let contenido = $("#principal-contenedor > .row"); 288 let html = ""; 289 for (let i = 0; i < contenido.length; i++) { 290 if (i > 0 && i < contenido.length - 1) { 291 html += contenido[i].innerHTML; 292 } 293 } 294 295 mywindow.document.write(html); 296 mywindow.document.write('</body></html>'); 297 298 mywindow.document.close(); // necessary for IE >= 10 299 mywindow.focus(); // necessary for IE >= 10*/ 300 301 mywindow.print(); 302 mywindow.close(); 303 304 return true; 305} 306 307 308 309$("body").delegate('.fotogaleria-item img', 'click', function () { 310 Swal.fire({ 311 html: '<div class="row"><div class="col-lg-1 d-flex align-items-center justify-content-center text-center"><button type="button" class="btn btn-light btn-sm rounded-0 fotogaleria-anterior"><i class="mdi mdi-arrow-left"></i></button></div><div class="col-lg-10" id="fotogaleria-visor"><img src="' + $(this).attr('src') + '" class="img-thumbnail"></div><div class="col-lg-1 d-flex align-items-center justify-content-center text-center"><button type="button" class="btn btn-light btn-sm rounded-0 fotogaleria-siguiente"><i class="mdi mdi-arrow-right"></i></button></div></div>',
312 showConfirmButton: false, 313 customClass: 'swal-wide' 314 }) 315}) 316$("body").delegate('.fotogaleria-anterior', 'click', function () { 317 $("#fotogaleria-visor>img").attr('src', $(".fotogaleria-item > img[src='" + $(this).parent().next().find('img').attr('src') + "']").prev().attr('src')) 318 if ($(".fotogaleria-item > img[src='" + $(this).parent().next().find('img').attr('src') + "']").prev().length) { 319 $('.fotogaleria-siguiente').show() 320 } else { 321 $('.fotogaleria-anterior').hide() 322 } 323}) 324$("body").delegate('.fotogaleria-siguiente', 'click', function () { 325 $("#fotogaleria-visor>img").attr('src', $(".fotogaleria-item > img[src='" + $(this).parent().prev().find('img').attr('src') + "']").next().attr('src')) 326 if ($(".fotogaleria-item > img[src='" + $(this).parent().prev().find('img').attr('src') + "']").next().length) { 327 $('.fotogaleria-anterior').show() 328 } else { 329 $('.fotogaleria-siguiente').hide() 330 } 331}) 332 333$("body").delegate(".uan-acordeon > .ua-titulo", "click", function () { 334 if ($(this).hasClass('ua-activo')) { 335 $(this).next().hide('fast'); 336 $(this).removeClass('ua-activo') 337 } else { 338 $(this).next().show('fast'); 339 $(this).addClass('ua-activo') 340 } 341}) 342 343function unicos(list) { 344 var result = []; 345 $.each(list, function (i, e) { 346 if ($.inArray(e, result) == -1) result.push(e); 347 }); 348 return result; 349} 350 351 352 353$("body").delegate('#formulario-contacto', 'submit', function (e) { 354 $(this).find('button').attr('disabled', 'disabled'); 355 $(this).find('button').text("Enviando mensaje"); 356}) 357 358 359$("body").delegate('.cargar-clima-listado', 'click', function () { 360 if ($(this).prev().find('.clima-oculto').length) { 361 $(this).prev().find('.clima-oculto').addClass('clima-activo').removeClass('clima-oculto').show(500); 362 $(this).text('Ocultar listado'); 363 } else { 364 $(this).prev().find('.clima-activo').addClass('clima-oculto').removeClass('clima-activo').hide(500); 365 $(this).text('Ver listado completo'); 366 } 367}) 368 369 370 371var lector = window.speechSynthesis; 372var lecturaActiva = false; 373var textoLectura = ""; 374lector.cancel(); 375if (typeof modoLectorComunicado !== 'undefined') { 376 $('#titulo-nota').parent().append(`<br><button class="btn btn-success px-5 float-right" id="boton-narracion-comunicado"><i class="mdi mdi-play mr-2"></i> Narrar nota</button>`); 377} 378if (typeof modoLectorOfertaEducativa !== 'undefined') { 379 $('nav[aria-label="breadcrumb"]').after().append(`<br><button class="btn btn-success px-5 float-right" id="boton-narracion-oferta"><i class="mdi mdi-play mr-2"></i> Narrar contenido</button>`); 380} 381 382$("body").on('click', '#boton-narracion-comunicado', function () { 383 if (lecturaActiva) { 384 lector.cancel(); 385 lecturaActiva = false; 386 $(this).toggleClass('btn-success btn-danger').html(`<i class="mdi mdi-play mr-2"></i> Narrar contenido`) 387 } else { 388 let titulo = $("#principal-contenedor #titulo-nota").text(); 389 let lectura = `TÃtulo de la nota: ${titulo}. ${$("#principal-contenedor > div:nth(3)").text()}`; 390 textoLectura = new SpeechSynthesisUtterance(lectura) 391 lector.speak(textoLectura); 392 lecturaActiva = true; 393 $(this).toggleClass('btn-success btn-danger').html(`<i class="mdi mdi-close mr-2"></i> Cancelar narración`) 394 textoLectura.addEventListener("end", (event) => { 395 lector.cancel(); 396 lecturaActiva = false; 397 $(this).toggleClass('btn-success btn-danger').html(`<i class="mdi mdi-play mr-2"></i> Narrar contenido`) 398 }); 399 } 400}) 401$("body").on('click', '#boton-narracion-oferta', function () { 402 if (lecturaActiva) { 403 lector.cancel(); 404 lecturaActiva = false; 405 $(this).toggleClass('btn-success btn-danger').html(`<i class="mdi mdi-play mr-2"></i> Narrar contenido`) 406 } else { 407 let lectura = $(this).closest('.container').next().text(); 408 let oferta = ""; 409 $(".mosaico-titulo,.boton-acordeon-oferta").map(function () { 410 oferta += $(this).text() + ";"; 411 }) 412 lectura += "Tipos de oferta educativa: " + oferta; 413 textoLectura = new SpeechSynthesisUtterance(lectura) 414 lector.speak(textoLectura); 415 lecturaActiva = true; 416 $(this).toggleClass('btn-success btn-danger').html(`<i class="mdi mdi-close mr-2"></i> Cancelar narración`) 417 textoLectura.addEventListener("end", (event) => { 418 lector.cancel(); 419 lecturaActiva = false;
420 $(this).toggleClass('btn-success btn-danger').html(`<i class="mdi mdi-play mr-2"></i> Narrar contenido`) 421 }); 422 } 423}) 424$("body").on('click', '#boton-narracion-unidades', function () { 425 if (lecturaActiva) { 426 lector.cancel(); 427 lecturaActiva = false; 428 $(this).toggleClass('btn-success btn-danger').html(`<i class="mdi mdi-play mr-2"></i> Narrar contenido`) 429 } else { 430 let lectura = $("#principal-contenedor > div:nth-child(7)").text(); 431 lectura += $("#principal-contenedor > div:nth-child(7)").nextAll('div:not(:last-of-type)').text(); 432 textoLectura = new SpeechSynthesisUtterance(lectura) 433 lector.speak(textoLectura); 434 lecturaActiva = true; 435 $(this).toggleClass('btn-success btn-danger').html(`<i class="mdi mdi-close mr-2"></i> Cancelar narración`) 436 textoLectura.addEventListener("end", (event) => { 437 lector.cancel(); 438 lecturaActiva = false; 439 $(this).toggleClass('btn-success btn-danger').html(`<i class="mdi mdi-play mr-2"></i> Narrar contenido`) 440 }); 441 } 442}) 443 444 445var alm = window.localStorage; 446 447$(".acceso-fuente").change(function () { 448 alm.setItem('fuente', $(this).attr('data-valor')); 449 determinarFuente(); 450}); 451 452determinarFuente(); 453function determinarFuente() { 454 $("body").removeClass('fuentex1 fuentex2 fuentex3'); 455 if (alm.getItem('fuente')) { 456 $('body').addClass('fuentex' + alm.getItem('fuente')); 457 $(".acceso-fuente[data-valor='" + alm.getItem('fuente') + "']").attr('checked', 'checked') 458 } 459} 460 461 462 463 464$("#acceso-modo-oscuro").click(function () { 465 if (alm.getItem('modo-oscuro')) { 466 alm.removeItem('modo-oscuro'); 467 } else { 468 alm.setItem('modo-oscuro', 'true'); 469 } 470 $('body').toggleClass('modo-oscuro'); 471 determinarModo(); 472}) 473 474if (alm.getItem('modo-oscuro')) { 475 $('body').toggleClass('modo-oscuro'); 476} 477 478determinarModo(); 479function determinarModo() { 480 if ($("body").hasClass('modo-oscuro')) { 481 $("#acceso-modo-oscuro").attr('checked', 'checked') 482 } else { 483 $("#acceso-modo-oscuro").removeAttr('checked') 484 } 485} 486 487 488 489$("#acceso-modo-contraste").click(function () { 490 if (alm.getItem('modo-contraste')) { 491 alm.removeItem('modo-contraste'); 492 } else { 493 alm.setItem('modo-contraste', 'true'); 494 } 495 $('body #contenido-body').toggleClass('modo-contraste'); 496 determinarContraste(); 497}) 498 499if (alm.getItem('modo-contraste')) { 500 $('body #contenido-body').toggleClass('modo-contraste'); 501} 502 503determinarContraste(); 504function determinarContraste() { 505 if ($("body #contenido-body").hasClass('modo-contraste')) { 506 $("#acceso-modo-contraste").attr('checked', 'checked') 507 } else { 508 $("#acceso-modo-contraste").removeAttr('checked') 509 } 510}
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.