1'use strict'; 2(function(window) { 3 var _self; 4 var USACH = { 5 vars: { 6 meses:['enero','febrero','marzo','abril','mayo','junio','julio','agosto','septiembre','octubre','noviembre','diciembre'], 7 dias:['Domingo','Lunes','Martes','Miércoles','Jueves','Viernes','Sábado'], 8 cuentaHideClima: 6, 9 btnCargarMasClima: '', 10 }, 11 init: function() { 12 _self = this; 13 _self.ui.getElements(); // obtenemos los objetos relativos a la implementación 14 _self.ui.setEvents(); // seteamos los eventos que sean necesarios 15 }, 16 reload: function() { 17 _self = this; 18 _self.ui.getElements(); 19 _self.ui.setEvents(); 20 }, 21 ui: { 22 elements: { 23 prontusPlayer: undefined, 24 contenidoMAM: undefined, 25 loopMAM: undefined, 26 }, 27 getElements: function() { 28 _self.ui.elements.prontusPlayer = $("#prontusPlayer"); // asignamos los elementos a nuestro objeto elements 29 _self.ui.elements.contenidoMAM = $("#mam_container"); 30 _self.ui.elements.loopMAM = $("#loop1"); 31 }, 32 setEvents: function() { 33 _self.actions.initSwipers(); 34 _self.actions.scrollsSticky(); 35 _self.actions.lomasvistoHeight(); 36 _self.actions.eleccionesHeight(); 37 // _self.actions.matchHeight(); 38 _self.actions.matchHeightInicio(); 39 _self.actions.dualColor(); 40 _self.actions.swiperLoMas(); 41 42 $('[data-fancybox]').fancybox({ 43 buttons: ['close'], 44 infobar: false, 45 arrows: false, 46 loop: false, 47 toolbar: true, 48 smallBtn: false, 49 youtube: { 50 autoplay: 1 51 } 52 }) 53 54 if(_self.ui.elements.prontusPlayer.length>0){ 55 _self.actions.initPlayer(); 56 } 57 if($(".cargar-clima").length>0){ 58 _self.vars.btnCargarMasClima = $(".cargar-clima"); 59 $(_self.vars.btnCargarMasClima).on("click",{elem: _self.vars.btnCargarMasClima}, _self.controls.cargarMasClima); 60 } 61 62 63 if(_self.ui.elements.contenidoMAM!= undefined && _self.ui.elements.contenidoMAM.length>0){ 64 _self.actions.initMAM(_self.ui.elements.contenidoMAM.data("ts"), _self.ui.elements.loopMAM.data("id")); 65 } 66 }, 67 }, 68 callbacks:{ 69 70 }, 71 actions:{ 72 initMAM: function(ts, last_id){ 73 let readerConfig = { 74 "prontus": "diario", 75 "container_id": 'mam_container', 76 "interval": 3000, 77 "ts": ts, 78 "last": last_id, 79 "template_id": 'tpl_mam_loop' 80 }; 81 let reader = createMamReader(); 82 reader.init(readerConfig); 83 }, 84 scrollsSticky: function(){//REVISAR funcionamiento 85 // /*==== scroll down mouse button ===*/ 86 $('.scroll-downs').click(function() { 87 $('html, body').animate({ scrollTop: $('#cards').offset().top - 80 }, 'slow'); 88 return false; 89 }); 90 91 // ===== Scroll to Top ==== // 92 $(window).scroll(function() { 93 if ($(this).scrollTop() >= 50) { // If page is scrolled more than 50px 94 $('#return-to-top').fadeIn(200); // Fade in the arrow 95 } else { 96 $('#return-to-top').fadeOut(200); // Else fade out the arrow 97 } 98 }); 99 $('#return-to-top').click(function() { // When arrow is clicked 100 $('body,html').animate({ 101 scrollTop: 0 // Scroll to top of body 102 }, 500); 103 }); 104 105 /*==== header sticky ===*/ 106 window.onscroll = function() {myFunction()}; 107 108 var header = document.getElementById("header"); 109 var sticky = header.offsetTop; 110 111 function myFunction() { 112 if (window.pageYOffset > sticky) { 113 //modifica el margin top del main para que no se note un salto bruzco al agregar el sticky que mantiene el menú 114 $(".main").css("margin-top", $("#header").css("height")) 115 header.classList.add("sticky"); 116 } else { 117 //regresa el margen superior al estado inicial antes de aplicar el sticky 118 $(".main").css("margin-top", 0) 119 header.classList.remove("sticky"); 120 } 121 } 122 }, 123 initSwipers: function(){ 124 _self.actions.swiperPag(); 125 _self.actions.swiper1(); 126 _self.actions.swiper3(); 127 _self.actions.swiper3s(); 128 _self.actions.swiper4(); 129 _self.actions.swiper5(); 130 _self.actions.swiper5s(); 131 }, 132 matchHeightInicio: function(){ 133 if($(".home .box-sec").length>0){ 134 $(".home .box-sec").matchHeight(); 135 } 136 if($(".home .box-sec-podcast").length>0){ 137 $(".home .box-sec-podcast").matchHeight(); 138 } 139 }, 140 initPlayer: function(){ 141 var urlSrc = USACH.ui.elements.prontusPlayer.data("link"); 142 urlSrc = urlSrc.replace("__id__", (new Date()).getTime()); 143 let player_options = { 144 stream_src: urlSrc, // stream_src, puede incluir o no el host. 145 // el player aporta el user id y el device. 146 div_element_id: "prontusPlayer", // div_element_id 147 autoplay: true, 148 muted: true, 149 janus_ads: false, // Puede desplegar avisos (definidos en el backend). 150 // playerReadyCallback: playerReady 151 }; 152 153 let my_player = new janusPlayerLive (player_options); 154 $(".vjs-styles-dimensions").remove(); 155 // try{ 156 // prontusPlayer5.destroy("video-pp") 157 // }catch(e){} 158 159 // $("#prontusPlayer").html(` 160 // <video id="video-pp" class="video-js vjs-prontus-skin"> 161 // <p class="vjs-no-js"> 162 // To view this video please enable JavaScript, and consider upgrading to a web browser that 163 // <a href="https://videojs.com/html5-video-support/" target="_blank" class="vjs-hidden" hidden="hidden">supports HTML5 video</a> 164 // </p> 165 // </video> 166 // `) 167 // prontusPlayer5.install({ 168 // "videoTagId": "video-pp", 169 // "player": { 170 // "responsive": true, 171 // "preload": "auto", 172 // "showSpeedButton": false, 173 // "disableSubtitles": false, 174 // "disableFullScreen": false, 175 // "zoom": false, 176 // "zoomMaxScale": 5, 177 // "disablePan": false 178 // }, 179 // "video": { 180 // "autoplay": true, 181 // "volume":0, 182 // "loop": false, 183 // "src": urlSrc, 184 // "poster": "/diario/imag/v1/default/img_horizontal_2-default.jpg", 185 // "vttThumbnails": "", 186 // "qualitySelector": true 187 // }, 188 // }) 189 // $("#video-pp").css("position","relative"); 190 // $("#video-pp").css("width","100%"); 191 // $("#video-pp").css("height","0"); 192 // $("#video-pp").css("padding-bottom","56.25%"); 193 // $(".video-js").removeClass("vjs-controls-disabled"); 194 // $(".vjs-big-play-button").remove(); 195 }, 196 swiperMultimedia: function(){ 197 var swiper = new Swiper(".mySwiper", { 198 loop: true, 199 spaceBetween: 10, 200 slidesPerView: 4, 201 freeMode: true, 202 watchSlidesVisibility: true, 203 watchSlidesProgress: true, 204 }); 205 var swiper2 = new Swiper(".mySwiper2", { 206 loop: true, 207 spaceBetween: 10, 208 navigation: { 209 nextEl: ".swiper-button-next", 210 prevEl: ".swiper-button-prev", 211 }, 212 thumbs: { 213 swiper: swiper, 214 }, 215 }); 216 $.colorbox.resize(); 217 }, 218 219 swiperLoMas(){ 220 var swiper = new Swiper('.swiper-tres', { 221 slidesPerView: 3, 222 spaceBetween: 20, 223 loop: true, 224 noSwiping: true, 225 navigation: { 226 nextEl: '.swiper-button-next-tres', 227 prevEl: '.swiper-button-prev-tres', 228 }, 229 breakpoints: { 230 1024: { 231 slidesPerView: 3, 232 spaceBetween: 18, 233 }, 234 880: { 235 slidesPerView: 3, 236 spaceBetween: 18, 237 }, 238 675: { 239 slidesPerView: 1, 240 spaceBetween: 18, 241 }, 242 460: { 243 loop: false, 244 slidesPerView: 'auto', 245 spaceBetween: 10, 246 slidesOffsetBefore: 18, 247 slidesOffsetAfter: 18, 248 }, 249 320: { 250 loop: false, 251 slidesPerView: 'auto', 252 spaceBetween: 10, 253 slidesOffsetBefore: 18, 254 slidesOffsetAfter: 18, 255 } 256 }, 257 }); 258 }, 259 swiper_programas(initialSlide){ 260 $('.swiper-5').each(function(index, element) { 261 var $this = $(this); 262 $this.addClass('instance-m5-' + index); 263 $this.find('.swiper-pagination').addClass('pagination5-' + index); 264 $this.find('.swiper-button-prev').addClass('btn-prev5-' + index); 265 $this.find('.swiper-button-next').addClass('btn-next5-' + index); 266 267 var swiper5 = new Swiper('.instance-m5-' + index, { 268 269 slidesPerView: 5, 270 spaceBetween: 5, 271 loop: false, 272 init: true, 273 initialSlide: initialSlide, 274 pagination: { 275 el: '.pagination5-' + index, 276 clickable: true, 277 }, 278 navigation: { 279 nextEl: '.btn-next5-' + index, 280 prevEl: '.btn-prev5-' + index, 281 }, 282 breakpoints: { 283 1024: { 284 slidesPerView: 3, 285 spaceBetween: 18, 286 }, 287 880: { 288 slidesPerView: 3, 289 spaceBetween: 18, 290 }, 291 675: { 292 slidesPerView: 2, 293 spaceBetween: 18, 294 }, 295 460: { 296 CSSWidthAndHeight: true, 297 slidesPerView: 'auto', 298 spaceBetween: 5, 299 slidesOffsetBefore: 20, 300 slidesOffsetAfter: 20, 301 }, 302 320: { 303 CSSWidthAndHeight: true, 304 slidesPerView: 'auto', 305 spaceBetween: 5, 306 slidesOffsetBefore: 20, 307 slidesOffsetAfter: 20, 308 } 309 }, 310 311 }); 312 313 }); 314 }, 315 swiperPag: function(){ 316 // /*====carrusel con paginación ===*/ 317 $('.swiper-pag').each(function(index, element) { 318 var $this = $(this); 319 $this.addClass('instance-' + index); 320 $this.find('.swiper-pagination').addClass('pagination-' + index); 321 322 var swiper1 = new Swiper('.instance-' + index, { 323 324 slidesPerView: 1, 325 loop: true, 326 pagination: { 327 el: '.pagination-' + index, 328 clickable: true, 329 }, 330 }); 331 332 }); 333 }, 334 swiper1: function(){ 335 /*====carrusel 1 slide ===*/ 336 337 $('.swiper-1').each(function(index, element) { 338 var $this = $(this); 339 $this.addClass('instance-m1-' + index); 340 $this.find('.swiper-pagination').addClass('pagination1-' + index); 341 $this.find('.swiper-button-prev').addClass('btn-prev1-' + index); 342 $this.find('.swiper-button-next').addClass('btn-next1-' + index); 343 344 var swiper0 = new Swiper('.instance-m1-' + index, { 345 346 slidesPerView: 1, 347 loop: true, 348 noSwiping: true, 349 autoHeight: true, 350 autoplay: { 351 delay: 6000, 352 }, 353 navigation: { 354 nextEl: '.btn-next1-' + index, 355 prevEl: '.btn-prev1-' + index, 356 }, 357 pagination: { 358 el: '.pagination1-' + index, 359 clickable: true, 360 }, 361 362 }); 363 364 }); 365 366 }, 367 swiper3s: function(){ 368 /*====carrusel 3 slide ===*/ 369 370 $('.swiper-3s').each(function(index, element) { 371 var $this = $(this); 372 $this.addClass('instance3-' + index); 373 $this.find('.swiper-pagination').addClass('pagination3-' + index); 374 $this.find('.swiper-button-prev').addClass('btn-prev3-' + index); 375 $this.find('.swiper-button-next').addClass('btn-next3-' + index); 376 377 var swiper3s = new Swiper('.instance3-' + index, { 378 379 slidesPerView: 4, 380 spaceBetween: 20, 381 loop: false, 382 pagination: { 383 el: '.pagination3-' + index, 384 clickable: true, 385 }, 386 navigation: { 387 nextEl: '.btn-next3-' + index, 388
388 prevEl: '.btn-prev3-' + index, 389 }, 390 breakpoints: { 391 1024: { 392 slidesPerView: 5, 393 spaceBetween: 18, 394 }, 395 880: { 396 slidesPerView: 3, 397 spaceBetween: 18, 398 }, 399 675: { 400 slidesPerView: 2, 401 spaceBetween: 18, 402 }, 403 460: { 404 slidesPerView: 'auto', 405 spaceBetween: 18, 406 slidesOffsetBefore: 15, 407 }, 408 320: { 409 slidesPerView: 'auto', 410 spaceBetween: 18, 411 slidesOffsetBefore: 15, 412 } 413 }, 414 415 }); 416 417 }); 418 419 }, 420 swiper4: function(){ 421 /*====carrusel 4 slide ===*/ 422 423 $('.swiper-4').each(function(index, element) { 424 var $this = $(this); 425 $this.addClass('instance-m4-' + index); 426 $this.find('.swiper-pagination').addClass('pagination-' + index); 427 $this.find('.swiper-button-prev').addClass('btn-prev4-' + index); 428 $this.find('.swiper-button-next').addClass('btn-next4-' + index); 429 430 var swiper4 = new Swiper('.instance-m4-' + index, { 431 432 slidesPerView: 4, 433 spaceBetween: 20, 434 init: true, 435 watchOverflow: true, // deshabilita flechas si hay menos elementos 436 pagination: { 437 el: '.pagination-' + index, 438 clickable: true, 439 }, 440 navigation: { 441 nextEl: '.btn-next4-' + index, 442 prevEl: '.btn-prev4-' + index, 443 }, 444 breakpoints: { 445 1190: { 446 slidesPerView: 3, 447 spaceBetween: 18, 448 }, 449 940: { 450 slidesPerView: 2, 451 spaceBetween: 18, 452 }, 453 675: { 454 slidesPerView: 2, 455 spaceBetween: 18, 456 }, 457 460: { 458 CSSWidthAndHeight: true, 459 slidesPerView: 'auto', 460 spaceBetween: 14, 461 }, 462 320: { 463 CSSWidthAndHeight: true, 464 slidesPerView: 'auto', 465 spaceBetween: 14, 466 } 467 }, 468 469 }); 470 471 }); 472 }, 473 swiper5: function(){ 474 /*====carrusel 5 slide ===*/ 475 476 $('.swiper-5').each(function(index, element) { 477 var $this = $(this); 478 $this.addClass('instance-m5-' + index); 479 $this.find('.swiper-pagination').addClass('pagination5-' + index); 480 $this.find('.swiper-button-prev').addClass('btn-prev5-' + index); 481 $this.find('.swiper-button-next').addClass('btn-next5-' + index); 482 483 var swiper5 = new Swiper('.instance-m5-' + index, { 484 485 slidesPerView: 'auto', 486 spaceBetween: 20, 487 slidesOffsetBefore: 20, 488 CSSWidthAndHeight: true, 489 loop: false, 490 init: true, 491 pagination: { 492 el: '.pagination5-' + index, 493 clickable: true, 494 }, 495 navigation: { 496 nextEl: '.btn-next5-' + index, 497 prevEl: '.btn-prev5-' + index, 498 }, 499 breakpoints: { 500 1024: { 501 slidesPerView: 3, 502 spaceBetween: 18, 503 }, 504 880: { 505 slidesPerView: 3, 506 spaceBetween: 18, 507 }, 508 675: { 509 slidesPerView: 2, 510 spaceBetween: 18, 511 }, 512 460: { 513 CSSWidthAndHeight: true, 514 slidesPerView: 'auto', 515 spaceBetween: 10, 516 slidesOffsetBefore: 0, 517 }, 518 320: { 519 CSSWidthAndHeight: true, 520 slidesPerView: 'auto', 521 spaceBetween: 10, 522 slidesOffsetBefore: 0, 523 } 524 }, 525 526 }); 527 528 }); 529 }, 530 swiper5s: function(){ 531 /*====carrusel 5 slide ===*/ 532 533 $('.swiper-5s').each(function (index, element) { 534 var $this = $(this); 535 $this.addClass('instance5-' + index); 536 $this.find('.swiper-pagination').addClass('pagination5-' + index); 537 $this.find('.swiper-button-prev').addClass('btn-prev5-' + index); 538 $this.find('.swiper-button-next').addClass('btn-next5-' + index); 539 540 var swiper5s = new Swiper('.instance5-' + index, { 541 542 slidesPerView: 5, 543 spaceBetween: 20, 544 loop: false, 545 pagination: { 546 el: '.pagination5-' + index, 547 clickable: true, 548 }, 549 navigation: { 550 nextEl: '.btn-next5-' + index, 551 prevEl: '.btn-prev5-' + index, 552 enabled: true 553 }, 554 breakpoints: { 555 1024: { 556 slidesPerView: 5, 557 spaceBetween: 18, 558 navigation: { 559 enabled: false 560 }, 561 }, 562 880: { 563 slidesPerView: 4, 564 spaceBetween: 18, 565 navigation: { 566 enabled: false 567 }, 568 }, 569 675: { 570 slidesPerView: 3, 571 spaceBetween: 18, 572 slidesOffsetBefore: 10, 573 navigation: { 574 enabled: true 575 }, 576 }, 577 460: { 578 slidesPerView: 2, 579 spaceBetween: 8, 580 slidesOffsetBefore: 10, 581 navigation: { 582 enabled: true 583 }, 584 }, 585 320: { 586 slidesPerView: 2, 587 spaceBetween: 8, 588 slidesOffsetBefore: 10, 589 navigation: { 590 enabled: true 591 }, 592 } 593 }, 594 595 }); 596 597 }); 598 }, 599 swiper3: function(){ 600 /*====carrusel slide móvil ===*/ 601 602 $('.swiper-3').each(function(index, element) { 603 var $this = $(this); 604 $this.addClass('instance-m3-' + index); 605 $this.find('.swiper-button-prev').addClass('btn-prev-m3-' + index); 606 $this.find('.swiper-button-next').addClass('btn-next-m3-' + index); 607 608 var swiper3 = new Swiper('.instance-m3-' + index, { 609 610 slidesPerView: 'auto', 611 loop: true, 612 CSSWidthAndHeight: true, 613 init: true, 614 navigation: { 615 nextEl: '.btn-next-m3-' + index, 616 prevEl: '.btn-prev-m3-' + index, 617 }, 618 breakpoints: { 619 880: { 620 slidesPerView: 3, 621 spaceBetween: 18, 622 }, 623 675: { 624 slidesPerView: 2, 625 spaceBetween: 18, 626 }, 627 460: { 628 slidesPerView: 'auto', 629 spaceBetween: 18, 630 slidesOffsetBefore: 18, 631 }, 632 320: { 633 slidesPerView: 'auto', 634 spaceBetween: 18, 635 slidesOffsetBefore: 18, 636 } 637 }, 638 639 }); 640 641 }); 642 643 }, 644 matchHeight: function () { 645 if($('#main').attr("data-matchheight") != null){ 646 _helper.matchHeight($("#main").data("matchheight")); 647 } 648 }, 649 dualColor: function(){ 650 $( ".cont-links" ).find( 'p' ).each(function(index, el) { 651 let spanTemp = $(this).find('span'); 652 let color1 = spanTemp.attr('data-color-1'); 653 let color2 = spanTemp.attr('data-color-2'); 654 var textTemp = $(this).text(); 655 var trimStr = $.trim(textTemp); 656 $(this).empty(); 657 var n = 2; // segundo espacio 658 var strTemp = trimStr.split(' '); 659 var first = strTemp.slice(0, n).join(' '); 660 var second = strTemp.slice(n).join(' '); 661 let temp1 = ''; 662 let temp2 = ''; 663 if(color1){ 664 temp1 = $('<span />').css('color', color1).html(first); 665 }else{ 666 temp1 = $('<span />').addClass('yellow').html(first); 667 } 668 if(color2){ 669 temp2 = $('<span />').css('color', color2).html(second); 670 }else{ 671 temp2 = $('<span />').html(second); 672 } 673 $(this).append(temp1).append(" ").append(temp2); 674 }); 675 }, 676 lomasvistoHeight: function () { 677 678 var height_lomas = parseInt($("#destacado_1").css("height")) + parseInt($("#noticias_2").css("height") ) 679 var height_resultados = parseInt($("#destacado_1").css("height")) - parseInt($("#resultados_2").css("height")) 680 // setTimeout(function() {_self.actions.matchHeightDestacados()}, 6000); 681 682 683 //$(".masvisto").css("height", height_lomas) 684 $("#resultados_1").css("height", height_resultados) 685 }, 686 matchHeightDestacados: function () { 687 var height_noticias = parseInt($("#noticias_2").css("height")) + parseInt($("#noticias_4").css("height")) 688 var height_destacados = parseInt($(".masvisto").css("height")) + parseInt($(".block-academicos").css("height")) 689 if(height_noticias>height_destacados){ 690 var diferencia = height_noticias - height_destacados; 691 $("#academico_2").css("height", parseInt($("#academico_2").css("height")) + diferencia) 692 } 693 else { 694 var diferencia = height_destacados - height_noticias; 695 $("#noticias_3").css("height", parseInt($("#noticias_3").css("height")) + diferencia) 696 $("#noticias_4").css("height", parseInt($("#noticias_4").css("height")) + diferencia) 697 } 698 }, 699 eleccionesHeight: function () { 700 var h = parseInt($(".banner-card").css("height")); 701 if(/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent) ) { 702 $(".elecciones").css("height", "550px"); 703 } 704 else { 705 $(".elecciones").css("height", h); 706 } 707 } 708 709 710 711 }, 712 controls:{ 713 FechaHora: function(){ 714 var fecha = new Date(); 715 mes = fecha.getMonth(); 716 dia = fecha.getDate(); 717 diasem = USACH.vars.dias[fecha.getDay()]; 718 mes = USACH.vars.meses[mes]; 719 ano = fecha.getYear(); 720 if (ano < 200) { 721 ano = ano + 1900; 722 } 723 var fec = diasem+' '+String(dia) + ' de ' + String(mes) + ' de ' + String(ano); 724 725 if (document.getElementById(FechaHora.idFecha)) { 726 FechaHora.domfecha = document.getElementById(FechaHora.idFecha); 727 FechaHora.domfecha.innerHTML = fec; 728 } 729 }, 730 cargarMasClima: function(evento){ 731 evento.preventDefault(); 732 var elems_hide = $(".box-clima.hide"); 733 for (var i = 0; i < _self.vars.cuentaHideClima; i++) { 734 $(elems_hide[i]).removeClass("hide"); 735 } 736 var elems_hide = $(".box-clima.hide"); 737 if(elems_hide.length==0){ 738 $(_self.vars.btnCargarMasClima).hide(); 739 } 740 _self.vars.cuentaHide+=6; 741 }, 742 }, 743 helper:{ 744 745 } 746 }; 747 window.USACH = USACH; // entregamos la referencia al dom principal 748})(window); 749// se inicializa el objeto 750$(window).ready(function(){ 751 USACH.init(); 752});
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.