1var $ = jQuery.noConflict(); 2var UriCintillo = '/comunicacionuv/wp-json/wp/v2/post_type_cintillop?_embed'; 3//var UriSettings = '/comunicacionuv/wp-json/wp-uv-2019/settings'; 4 5var $ = jQuery.noConflict(); 6var ajaxnoticias, ajaxcintillo, ajaxagenda, ajaxuvdamosmas, ajaxnumeralia, ajaxsugir; 7 8// Noticias 9var noticias_principal_max = 12; 10var noticias_principal_tiempo = 10000; 11var noticias_principal_visible = true; 12// Cintillo 13var cintillo_principal_max = 5; 14var cintillo_principal_visible = true; 15 16$(function () { 17 moment.locale('es'); // change the global locale to Spanish 18 YearActual(); 19}); 20 21function ScrollAdmin() { 22 if ($(window).scrollTop()) { 23 ToogleMenuIdioma(); 24 CargaImagenes('.lazy'); 25 } 26 // Scroll 27 $(window).scroll(function () { 28 ToogleMenuIdioma(); 29 CargaImagenes('.lazy'); 30 }); 31} 32 33function YearActual(){ 34 $('.copy .footer-year').text( (new Date).getFullYear() ); 35} 36 37function FeedAhoraMismo(uri, max, tiempo) { 38 var uri = uri + '&per_page=' + max; 39 var method = "GET"; 40 ajaxnoticias = ajaxHelper(uri, method).done(function (data, status, jqXHR) { 41 try { 42 if(data.length == 0){ 43 section.hide(); 44 return; 45 } 46 47 var section = $(".ahora-slider"); 48 var template = $('.ahora-slider .card').clone(); 49 section.html(''); 50 51 $.each(data, function () { 52 var slide = template.clone(); 53 if (this.title.rendered) 54 slide.find('.titulo-texto').html(this.title.rendered); 55 if (this.meta.extracto) 56 slide.find('.subtitulo-texto').html(this.meta.extracto); 57 if (this.meta.bg_color){ 58 slide.attr('class', 'card ' + this.meta.bg_color ); 59 } 60 if (this.meta.icono) 61 slide.find('i').attr('class', 'fas fa-2x ' + this.meta.icono ); 62 if (this.meta.tipo_url == 2) { 63 var subtitulo = slide.find('.subtitulo').html(); 64 slide.find('.subtitulo').html('<a href="" title="Más información" />'); 65 slide.find('a').attr('href', this.meta.url).html(subtitulo); 66 if (this.meta.ventana_nueva == 2) { 67 slide.find('a').attr('target', '_blank'); 68 slide.find('a').attr('aria-label', '(el vÃnculo abre en una nueva pestaña)'); 69 } 70 } 71 section.append(slide); 72 }); 73 } 74 catch (e) { 75 fail(); 76 } 77 AhoraMismoCarrusel(section, tiempo); 78 }).fail(function( jqXHR, textStatus, errorThrown ){ 79 fail(); 80 }); 81 82 function fail() { 83 $(".ahora-slider").hide(); 84 } 85} 86 87function FeedNoticias(uri, max, tiempo, wp) { 88 var uri = uri + '&per_page=' + max; 89 var method = "GET"; 90 ajaxnoticias = ajaxHelper(uri, method).done(function (data, status, jqXHR) { 91 try { 92 var section = $(".noticias-slider"); 93 var template = $('.noticias-slider .item').clone(); 94 section.html(''); 95 96 if( data.length == 0 ){ 97 $(".box-noticias").hide(); 98 return; 99 } 100 101 $.each(data, function () { 102 var slide = template.clone(); 103 var slidetitulo = ''; 104 if (this.title.rendered && this.meta.text_hide != 'Si') { 105 slidetitulo = this.title.rendered; 106 slide.find('.caption, .caption-hidden').html(this.title.rendered); 107 slide.find('.slide-image').attr('aria-label', slidetitulo); 108 } 109 else if (this.title.rendered && this.meta.text_hide == 'Si') { 110 slidetitulo = this.title.rendered; 111 slide.find('.caption-hidden').html(slidetitulo); 112 slide.find('.slide-image').attr('aria-label', slidetitulo); 113 } 114 if (this.meta.extracto) 115 slide.find('.subcaption').html(this.meta.extracto); 116 if (this.meta.tipo_url == 2) { 117 if ( jQuery.trim( this.meta.url ) != '' ) { 118 slide.find('a').attr('href', this.meta.url).removeClass('d-none'); 119 slide.find('a').attr('aria-label', slidetitulo); 120 if (this.meta.ventana_nueva == 2) { 121 slide.find('a').attr('target', '_blank'); 122 slide.find('a').attr('aria-label', slidetitulo + ' (el vÃnculo abre en una nueva pestaña)'); 123 } 124 } 125 } 126 if (this.meta.text_hide == 'Si' && !this.meta.extracto)
127 slide.find('.card-img-overlay').css('background-image','none'); 128 129 // Videos 130 slide.find('.slide-image').attr('tipo_media',this.meta.tipo_media); 131 if (this.meta.tipo_media == 2) { 132 tiempo = 0; 133 if ( jQuery.trim( this.meta.video_url ) != '' ) { 134 slide.find('.slide-image').attr('video_url',this.meta.video_url); 135 slide.find('.slide-image').attr('video_pos',this.meta.video_pos); 136 } 137 } 138 /*else if (this.meta.tipo_media == 3) { 139 tiempo = 0; 140 if ( jQuery.trim( this.meta.video_youtube ) != '' ) { 141 slide.find('.slide-image').attr('video_youtube',this.meta.video_youtube); 142 } 143 }*/ 144 145 // Media 146 var src = null; 147 if (this._embedded) { 148 if (this._embedded['wp:featuredmedia'][0]) { 149 if (this._embedded['wp:featuredmedia'][0].source_url) 150 src = this._embedded['wp:featuredmedia'][0].source_url; 151 else if (this.meta.media_url) 152 src = this.meta.media_url; 153 }else if (this.meta.media_url) { 154 src = this.meta.media_url; 155 } 156 } 157 158 if(src) { 159 var src_mobile = src; 160 if (this._embedded['wp:featuredmedia'][0]) { 161 if (this._embedded['wp:featuredmedia'][0].media_details){ 162 var noticias_size = 'noticias_principal-lg'; 163 if(wp){ 164 noticias_size = 'avisos-lg'; 165 } 166 if(this._embedded['wp:featuredmedia'][0].media_details.sizes[noticias_size]) { 167 src = this._embedded['wp:featuredmedia'][0].media_details.sizes[noticias_size].source_url; 168 } 169 if(this._embedded['wp:featuredmedia'][0].media_details.sizes['noticias_principal-sm']) { 170 src_mobile = this._embedded['wp:featuredmedia'][0].media_details.sizes['noticias_principal-sm'].source_url; 171 } 172 } 173 } 174 slide.find('.slide-image').attr({ 175 'data-src': src, 176 'data-src-mobile': src_mobile, 177 'data-pos': this.meta.imagen_halign + '% ' + this.meta.imagen_valign + '%', 178 'data-size': this.meta.bg_size, 179 }); 180 } else { 181 slide.find('.slide-image').attr({ 182 'data-src': '/v2/images/noticias/default.jpg', 183 'data-src-mobile': '/v2/images/noticias/default-mobile.jpg', 184 'data-pos': '0% 50%', 185 'data-size': 'cover', 186 }); 187 } 188 // Media 189 section.append(slide); 190 }); 191 NoticiasCarrusel(section, tiempo, wp); 192 } 193 catch (e) { 194 fail(); 195 } 196 }).fail(function( jqXHR, textStatus, errorThrown ){ 197 fail(); 198 }); 199 200 function fail() { 201 var section = $(".noticias-slider"); 202 var slide = $('.noticias-slider .item').clone(); 203 section.html(''); 204 205 slide.find('.caption').text("Universidad Veracruzana"); 206 slide.find('.subcaption').text("Lis de Veracruz: Arte, Ciencia, Luz"); 207 slide.find('.slide-image').attr({ 208 'data-src': '/v2/images/noticias/default.jpg', 209 'data-src-mobile': '/v2/images/noticias/default-mobile.jpg', 210 'data-pos': '0% 50%', 211 'data-size': 'cover', 212 }); 213 section.append(slide); 214 NoticiasCarrusel(section, tiempo, wp); 215 } 216} 217/* 218function FeedCintillo(uri,max) { 219 var uri = uri + '&per_page=' + max; 220 var method = "GET"; 221 ajaxcintillo = ajaxHelper(uri, method).done(function (data, status, jqXHR) { 222 try { 223 if(data.length == 0){ 224 $(".cintillo").hide(); 225 return; 226 } 227 228 var section = $(".cintillo .row"); 229 if (data.length == 0) { 230 section.hide(); 231 return; 232 } 233 switch (data.length) { 234 case 1: clase = 'col col-12 col-sm-12 col-md-12 col-lg-12'; 235 break; 236 case 2: clase = 'col col-12 col-sm-6 col-md-6 col-lg-6'; 237 break; 238 case 3: clase = 'col col-12 col-sm-6 col-md-4 col-lg-4'; 239 break; 240 case 4: clase = 'col col-12 col-sm-6 col-md-6 col-lg-3'; 241 break; 242 case 5: clase = 'col col-12 col-sm-6 col-md-6 col-lg-4 col-xl'; 243 break; 244 } 245 246 var template = $('<section class="' + clase + '"><h3 class="visually-hidden caption-hidden text-bg-primary">VÃnculo sin tÃtulo</h3><a class="d-flex h-100" href="" target="_blank" aria-label="(el vÃnculo abre en una nueva pestaña)" title="Clic para visualizar"><div class="align-self-center w-100 text-center"><span class="caption text-truncate"></span><span class="subcaption text-truncate"></span></div></a></section>'); 247 section.html(''); 248 249 $.each(data, function () { 250 var slide = template.clone(); 251 if (this.meta.bg_color) 252 slide.css('background-color', this.meta.bg_color ); 253 //slide.addClass('fondo' + this.meta.bg_color); 254 if (this.title.rendered && this.meta.text_hide != 'Si'){ 255 slide.find('a').attr('title', slide.find('a').attr('title') + ' ' + this.title.rendered); 256 slide.find('.caption').html(this.title.rendered).addClass(this.meta.text_color).addClass(this.meta.text_sombra).addClass(this.meta.text_align); 257 slide.find('.caption-hidden').html(this.title.rendered); 258 if (this.meta.title_size) 259 slide.find('.caption, .caption-hidden').css('font-size',this.meta.title_size); 260 }else if (this.title.rendered){ 261 slide.find('.caption-hidden').html(this.title.rendered); 262 } 263 if (this.meta.extracto){ 264 slide.find('a').attr('title', slide.find('a').attr('title') + ' ' + this.meta.extracto); 265 slide.find('.subcaption').html(this.meta.extracto).addClass(this.meta.text_color).addClass(this.meta.text_sombra).addClass(this.meta.text_align); 266 if (this.meta.extracto_size) 267 slide.find('.subcaption').css('font-size',this.meta.extracto_size); 268 } 269 if (this.meta.tipo_url == 2) { 270 slide.find('a').attr('href', this.meta.url).removeClass('d-none'); 271 if (this.meta.ventana_nueva == 2) { 272 slide.find('a').attr('target', '_blank'); 273 slide.find('a').attr('aria-label', '(el vÃnculo abre en una nueva pestaña)'); 274 } 275 } 276 // Media 277 var src = null; 278 if (this._embedded) { 279 if (this._embedded['wp:featuredmedia'][0]) { 280 if (this._embedded['wp:featuredmedia'][0].source_url) 281 src = this._embedded['wp:featuredmedia'][0].source_url; 282 else if (this.meta.media_url) 283 src = this.meta.media_url; 284 }else if (this.meta.media_url) { 285 src = this.meta.media_url; 286 } 287 } 288 if(src) { 289 if (this._embedded['wp:featuredmedia'][0]) { 290 if (this._embedded['wp:featuredmedia'][0].media_details){ 291 if(this._embedded['wp:featuredmedia'][0].media_details.sizes['cintillo_principal-lg']) { 292 src = this._embedded['wp:featuredmedia'][0].media_details.sizes['cintillo_principal-lg'].source_url; 293 } 294 } 295 } 296 slide.css({ 297 'background-image': 'url("' + src + '")', 298 'background-repeat': this.meta.bg_repeat == 'No' ? 'no-repeat' : '', 299 'background-position': this.meta.imagen_halign + '% ' + this.meta.imagen_valign + '%', 300 'background-size': this.meta.bg_size, 301 }); 302 } 303 // Media 304 section.append(slide); 305 }); 306 } 307 catch (e) { 308 fail(); 309 } 310 }).fail(function( jqXHR, textStatus, errorThrown ){ 311 fail(); 312 });
313 314 function fail() { 315 $(".cintillo").hide(); 316 } 317} 318*/ 319function FeedCintillo(uri,max) { 320 var uri = uri + '&per_page=' + max; 321 var method = "GET"; 322 ajaxcintillo = ajaxHelper(uri, method).done(function (data, status, jqXHR) { 323 try { 324 if(data.length == 0){ 325 $(".cintillo").hide(); 326 return; 327 } 328 329 var section = $(".cintillo .row"); 330 if (data.length == 0) { 331 section.hide(); 332 return; 333 } 334 switch (data.length) { 335 case 1: clase = 'col col-12 col-sm-12 col-md-12 col-lg-12'; 336 break; 337 case 2: clase = 'col col-12 col-sm-6 col-md-6 col-lg-6'; 338 break; 339 case 3: clase = 'col col-12 col-sm-6 col-md-4 col-lg-4'; 340 break; 341 case 4: clase = 'col col-12 col-sm-6 col-md-6 col-lg-3'; 342 break; 343 case 5: clase = 'col col-12 col-sm-6 col-md-6 col-lg-4 col-xl'; 344 break; 345 } 346 347 //var template = $('<section class="' + clase + '"><h3 class="visually-hidden caption-hidden text-bg-primary">VÃnculo sin tÃtulo</h3><a class="d-flex h-100" href="" target="_blank" aria-label="(el vÃnculo abre en una nueva pestaña)" title="Clic para visualizar"><div class="align-self-center w-100 text-center"><span class="caption text-truncate"></span><span class="subcaption text-truncate"></span></div></a></section>'); 348 var template = $('<section class="' + clase + '"><a class="d-flex h-100" href="" target="_blank" aria-label="(el vÃnculo abre en una nueva pestaña)" title="Clic para visualizar"><img class="h-100 mx-auto d-block img-fluid" height="92" width="auto" src="" alt="Imagen cintillo" title="Clic para visualizar"></a></section>'); 349 350 section.html(''); 351 352 $.each(data, function () { 353 var slide = template.clone(); 354 if (this.meta.bg_color) 355 slide.css('background-color', this.meta.bg_color ); 356 //slide.addClass('fondo' + this.meta.bg_color); 357 if (this.title.rendered && this.meta.text_hide != 'Si'){ 358 slide.find('a').attr('title', slide.find('a').attr('title') + ' ' + this.title.rendered); 359 slide.find('.caption').html(this.title.rendered).addClass(this.meta.text_color).addClass(this.meta.text_sombra).addClass(this.meta.text_align); 360 slide.find('.caption-hidden').html(this.title.rendered); 361 if (this.meta.title_size) 362 slide.find('.caption, .caption-hidden').css('font-size',this.meta.title_size); 363 }else if (this.title.rendered){ 364 slide.find('.caption-hidden').html(this.title.rendered); 365 } 366 if (this.meta.extracto){ 367 slide.find('a').attr('title', slide.find('a').attr('title') + ' ' + this.meta.extracto); 368 slide.find('.subcaption').html(this.meta.extracto).addClass(this.meta.text_color).addClass(this.meta.text_sombra).addClass(this.meta.text_align); 369 if (this.meta.extracto_size) 370 slide.find('.subcaption').css('font-size',this.meta.extracto_size); 371 } 372 if (this.meta.tipo_url == 2) { 373 slide.find('a').attr('href', this.meta.url).removeClass('d-none'); 374 if (this.meta.ventana_nueva == 2) { 375 slide.find('a').attr('target', '_blank'); 376 slide.find('a').attr('aria-label', '(el vÃnculo abre en una nueva pestaña)'); 377 } 378 } 379 // Media 380 var src = null; 381 if (this._embedded) { 382 if (this._embedded['wp:featuredmedia'][0]) { 383 if (this._embedded['wp:featuredmedia'][0].source_url) 384 src = this._embedded['wp:featuredmedia'][0].source_url; 385 else if (this.meta.media_url) 386 src = this.meta.media_url; 387 }else if (this.meta.media_url) { 388 src = this.meta.media_url; 389 } 390 } 391 if(src) { 392 if (this._embedded['wp:featuredmedia'][0]) { 393 if (this._embedded['wp:featuredmedia'][0].media_details){ 394 if(this._embedded['wp:featuredmedia'][0].media_details.sizes['cintillo_principal-lg']) { 395 src = this._embedded['wp:featuredmedia'][0].media_details.sizes['cintillo_principal-lg'].source_url; 396 } 397 } 398 } 399 slide.find('img').attr('src', src); 400 if (this.title.rendered){ 401 slide.find('img').attr('alt', this.title.rendered); 402 slide.find('img').attr('title', this.meta.extracto); 403 } 404 /* slide.css({ 405 'background-image': 'url("' + src + '")', 406 'background-repeat': this.meta.bg_repeat == 'No' ? 'no-repeat' : '', 407 'background-position': this.meta.imagen_halign + '% ' + this.meta.imagen_valign + '%', 408 'background-size': this.meta.bg_size, 409 });*/ 410 } 411 // Media 412 section.append(slide); 413 }); 414 } 415 catch (e) { 416 fail(); 417 } 418 }).fail(function( jqXHR, textStatus, errorThrown ){ 419 fail(); 420 });
421 422 function fail() { 423 $(".cintillo").hide(); 424 } 425} 426function FeedAgenda(idarea, max) { 427 var uri = '/apps/agenda/api/eventos?idarea=' + idarea + '&solodestacadas=true'; 428 var method = "GET"; 429 ajaxagenda = ajaxHelper(uri, method).done(function (data, status, jqXHR) { 430 try { 431 if(data.length == 0){ 432 $(".agenda").hide(); 433 return; 434 } 435 var section = $(".agenda-deck"); 436 var template = $('.agenda-deck .slide').clone(); 437 section.html(''); 438 439 $.each(data, function ( key ) { 440 if( key < max ){ 441 var slide = template.clone(); 442 // Imagenes 443 $.each( this.SAGEVENTO.SAGARCHIVOS, function ( i, img ) { 444 if( img.Tipo == 1 ){ 445 slide.find('.card-img-top') 446 .attr({ 447 'data-src': img.Url, 448 }); 449 } 450 }); 451 452 if (this.SAGEVENTO.SAGEVENTO_TITULO) 453 slide.find('.card-title, .card-title-hidden').html(this.SAGEVENTO.SAGEVENTO_TITULO.substring(0, 70) + (this.SAGEVENTO.SAGEVENTO_TITULO.length <= 70 ? '' : '...') ); 454 455 if (this.SAGEVENTO.SAGEVENTO_FECHAINI) { 456 slide.find('.card-d').text(moment( this.SAGEVENTO.SAGEVENTO_FECHAINI ).format("DD")); 457 slide.find('.card-m').text(moment( this.SAGEVENTO.SAGEVENTO_FECHAINI ).format("MMM").slice(0,-1)); 458 slide.find('.card-horas').text(moment( this.SAGEVENTO.SAGEVENTO_FECHAINI ).format("HH:mm") + ' horas'); 459 } 460 if (this.SACSUBCATEGORIA.SACSUBCATEGORIA_NOMBRE){} 461 slide.find('.card-subcat').html(this.SACSUBCATEGORIA.SACSUBCATEGORIA_NOMBRE); 462 if (this.SACSUBCATEGORIA.SACCATEGORIA.SACCATEGORIA_NOMBRE){ 463 slide.find('.card-cat').html(this.SACSUBCATEGORIA.SACCATEGORIA.SACCATEGORIA_NOMBRE); 464 slide.find('.card-date').addClass('cat' + this.SACSUBCATEGORIA.SACCATEGORIA_ID); 465 slide.attr('data-cat-id', this.SACSUBCATEGORIA.SACCATEGORIA_ID); 466 } 467 if (this.SACLUGAR.SACLUGAR_NOMBRE) 468 slide.find('.card-lugar').html('Lugar: ' + this.SACLUGAR.SACLUGAR_NOMBRE); 469 if (this.SACLUGAR.SACSEDE.SACREGION.SACREGION_NOMBRE) 470 slide.find('.card-region').html(this.SACLUGAR. SACSEDE.SACREGION.SACREGION_NOMBRE); 471 if (this.SAGEVENTO_ID) 472 slide.find('.card-link').attr('href','/agenda/evento.html?area=' + this.SACAREA.SACAREA_ID + '&evento=' + this.SAGEVENTO_ID); 473 section.append(slide); 474 } 475 }); 476 AgendaCarrusel(max); 477 } 478 catch (e) { 479 $(".agenda").hide(); 480 } 481 }); 482} 483 484// Carruseles 485 486function AhoraMismoCarrusel(section, tiempo) { 487 section.slick({ 488 autoplay: true, 489 autoplaySpeed: tiempo, 490 speed: 600, 491 arrows: true, 492 dots: false, 493 cssEase: "cubic-bezier(0.87, 0.03, 0.41, 0.9)", 494 infinite: true, 495 vertical: true, 496 prevArrow: '<button class="slick-prev slick-arrow" type="button"><i class="fas fa-angle-up"></i></button>', 497 nextArrow: '<button class="slick-next slick-arrow" type="button"><i class="fas fa-angle-down"></i></button>' 498 }); 499} 500 501function NoticiasCarrusel(section, tiempo, wp) { 502 var autoplay = true; 503 if( !tiempo ){ 504 tiempo = 30000; 505 autoplay = false; 506 } 507 section.on('init', function (event, slick) { 508 CargaImagen(event, slick, 0); 509 setTimeout(function () { $(this).removeClass('cargando') }, 500); 510 /*if (!wp) 511 CorrigeSlides(event, slick);*/ 512 }).on('beforeChange', function (event, slick, currentSlide, nextSlide) { 513 CargaImagen(event, slick, nextSlide); 514 }).slick({ 515 autoplay: autoplay, 516 autoplaySpeed: tiempo, 517 speed: 600, 518 arrows: true, 519 dots: true,
520 cssEase: "cubic-bezier(0.87, 0.03, 0.41, 0.9)", 521 infinite: false, 522 prevArrow: '<div class="slick-prev"><i class="fas fa-chevron-left"></i></div>', 523 nextArrow: '<div class="slick-next"><i class="fas fa-chevron-right"></i></div>', 524 }); 525 526 function CargaImagen(event, slick, currentSlide) { 527 //var nextPanel = $('.noticias-slider [data-slick-index=' + currentSlide + '] .slide-image'); 528 var nextPanel = $('.noticias-slider .slick-slide:eq(' + currentSlide + ') .slide-image'); 529 var datasrc = 'data-src'; 530 if (jQuery.browser.mobile) { 531 datasrc = 'data-src-mobile'; 532 } 533 534 // Video 535 var tipo_media = nextPanel.attr('tipo_media'); 536 if (tipo_media == 2) { // Video mp4 537 var video_url = nextPanel.attr('video_url'); 538 var video_pos = ''; 539 540 if( nextPanel.attr('video_pos') == 2) 541 video_pos = 'style="object-fit:fill"'; 542 nextPanel.html('<video ' + video_pos + ' autoplay muted="muted" loop playsinline src="' + video_url + '" preload="auto"><source src="' + video_url + '" type="video/mp4"></video>'); 543 nextPanel.removeAttr(datasrc); 544 } 545 /*else if(tipo_media == 3){ // Youtube 546 var video_url = nextPanel.attr('video_youtube'); 547 548 // Es mobile y youtube 549 if (jQuery.browser.mobile && video_url.indexOf('youtube') > 0 ) { 550 var video_id = YouTubeGetID( video_url ); 551 var playerId = 'player' + currentSlide; 552 nextPanel.html('<div id="' + playerId + '"></div><script>YouTubeIframeAPIReady("' + playerId + '", "' + video_id + '");</script>'); 553 } 554 else { // Es escritorio 555 nextPanel.html('<iframe src="' + video_url + '?autoplay=1&mute=1&loop=1" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture; fullscreen" allowfullscreen frameborder="0"></iframe>'); 556 } 557 nextPanel.removeAttr(datasrc); 558 }*/ 559 else { // Imagenes 560 var src = nextPanel.attr(datasrc); 561 if (src) { 562 nextPanel.css({ 563 'background-image': 'url("' + src + '")', 564 'background-repeat': 'no-repeat', 565 'background-position': nextPanel.attr('data-pos'), 566 'background-size': nextPanel.attr('data-size'), 567 'background-color': '#fff', 568 }); 569 nextPanel.removeAttr(datasrc); 570 } 571 } 572 } 573 574 function CorrigeSlides(event, slick) { 575 if( slick.slickGetOption('autoplaySpeed') != noticias_principal_tiempo) 576 slick.slickSetOption('autoplaySpeed',noticias_principal_tiempo); 577 578 if( slick.slideCount > noticias_principal_max){ 579 while(slick.slideCount > noticias_principal_max){ 580 slick.slickRemove(slick.slideCount - 1); 581 } 582 } 583 } 584} 585 586// Para autoplay en dispositivos moviles 587function YouTubeIframeAPIReady(playerId, video_id) { 588 if(YT) { 589 var player = new YT.Player(playerId, { 590 width: '100%', 591 playerVars: { 'autoplay': 1, 'playsinline': 1, 'mute': 1 }, 592 videoId: video_id, 593 events: { 594 'onReady': onPlayerReady 595 } 596 }); 597 } 598} 599 600// 4. The API will call this function when the video player is ready. 601function onPlayerReady(event) { 602 event.target.mute(); 603 event.target.playVideo(); 604} 605 606function YouTubeGetID(url){ 607 var ID = null; 608 try { 609 url = url.replace(/(>|<)/gi,'').split(/(vi\/|v=|\/v\/|youtu\.be\/|\/embed\/)/); 610 if(url[2] !== undefined) { 611 ID = url[2].split(/[^0-9a-z_\-]/i); 612 ID = ID[0]; 613 } 614 else { 615 ID = url; 616 } 617 } 618 catch (e) {} 619 return ID; 620} 621 622function AgendaCarrusel(max) { 623 //CargaImagenes('.agenda-deck .lazy'); 624 var section = $(".agenda-deck"); 625 section.on('init', function (event, slick) { 626 $('.agenda').addClass('initialized').removeClass('cargando'); 627 }).on('reInit', function (event, slick) { 628 if(slick.slideCount == 0) 629 $('.agenda .notfound').addClass('visible'); 630 else 631 $('.agenda .notfound').removeClass('visible'); 632 }).slick({ 633 dots: true, 634 infinite: false, 635 slidesToShow: (max < 3) ? max : 3, 636 slidesToScroll: (max < 3) ? max : 3, 637 arrows: true, 638 responsive: [ 639 /*{ 640 breakpoint: 1200, 641 settings: { 642 slidesToShow: 3, 643 slidesToScroll: 3 644 } 645 },*/ 646 { 647 breakpoint: 992, 648 settings: { 649 slidesToShow: 2, 650 slidesToScroll: 2, 651 rows:0 652 } 653 }, 654 { 655 breakpoint: 768, 656 settings: { 657 slidesToShow: 1, 658 slidesToScroll: 1, 659 rows:0 660 } 661 } 662 ] 663 });
664 665 $('.agenda .nav-link:first').on('click', function(){ 666 section.slick('slickUnfilter'); 667 $('.agenda .nav-link').removeClass('active'); 668 $(this).addClass('active'); 669 }); 670 671 $('.agenda .nav-link:not(:first)').on('click', function(){ 672 section.slick('slickUnfilter'); 673 var catid = $(this).attr('data-cat-id'); 674 section.slick('slickFilter', function() { 675 return $( this ).find('.slide[data-cat-id="' + catid + '"]').length > 0; 676 }); 677 $('.agenda .nav-link').removeClass('active'); 678 $(this).addClass('active'); 679 }); 680} 681 682// Carruseles 683 684function ajaxHelper(uri, method, data, contentType) { 685 var contentType = contentType ? contentType : 'application/json'; 686 var data = (contentType == 'application/json') ? JSON.stringify(data) : data; 687 688 return $.ajax({ 689 type: method, 690 method: method, 691 url: uri, 692 dataType: 'text', 693 contentType: contentType, 694 data: data, 695 xhrFields: { 696 //withCredentials: true 697 }, 698 beforeSend: function (xhr) { 699 //xhr.setRequestHeader("Authorization", "Bearer " + token); 700 } 701 }).then(function(text) { 702 if (text.charCodeAt(0) === 0xFEFF) { 703 text = text.slice(1); 704 } 705 // Parsear manualmente a JSON 706 return JSON.parse(text); 707 }); 708} 709 710function ToTop() { 711 $('#toTop').click(function () { 712 $('body,html').animate({ scrollTop: 0 }, 1000); 713 }); 714 715 $('#toDown').click(function () { 716 $('body,html').animate({ scrollTop: 600 }, 1000); 717 }); 718 719 $(window).scroll(function () { 720 Ancla(); 721 }); 722 Ancla(); 723 function Ancla() { 724 var sd = $(window).scrollTop(); 725 if (sd > 1) 726 $('#toDown').fadeOut(); 727 else 728 $('#toDown').show(); 729 730 if (sd > 500) 731 $('#toTop').show(); 732 else 733 $('#toTop').fadeOut(); 734 } 735} 736 737function CargaImagenes(selector) { 738 $(selector).each(function () { 739 if ($(this)) { 740 var imagen = $(this); 741 var datasrc = 'data-src'; 742 var src = imagen.attr(datasrc); 743 if (src) { 744 imagen.attr('src', src); 745 imagen.removeClass('lazy'); 746 imagen.removeAttr(datasrc); 747 } 748 } 749 }); 750} 751 752function ToogleMenuIdioma() { 753 if (!jQuery.browser.mobile) { 754 if ($(window).scrollTop()) { 755 $(".navbar-logo").addClass("pt-0"); 756 $('.menu-comunidad-flotante').addClass('muestra'); 757 } 758 else { 759 $(".navbar-logo").removeClass("pt-0"); 760 $('.menu-comunidad-flotante').removeClass('muestra'); 761 if( $('.menu-comunidad-flotante .dropdown-toggle').hasClass('show') ) 762 $('.menu-comunidad-flotante .dropdown-toggle').dropdown('toggle'); 763 } 764 } 765} 766 767function EncabezadoMenuFijo() { 768 if (jQuery.browser.mobile) { 769 $('.menu-principal').removeClass('sticky-top'); 770 $('.menu-flotante').addClass('mobile'); 771 772 // Para que el menu no se esconda en md 773 //if ($('#navbarTop').css('display') == 'flex') 774 //$('#navbarTop').addClass('show'); 775 776 $(".collapse").on('show.bs.collapse', function () { 777 $('.menu-flotante').fadeIn(); 778 }); 779 $(".collapse").on('hide.bs.collapse', function () { 780 $('.menu-flotante').hide(); 781 if( $('.menu-comunidad-flotante').hasClass('show') ) 782 $('.menu-comunidad-flotante').dropdown('toggle'); 783 }); 784 } 785 786 // Para cargar las imagenes al abrir el menu 787 $(".dropdown").on("show.bs.dropdown", function (event) { 788 CargaImagenesDropdown(this); 789 }); 790 791 function CargaImagenesDropdown(dropdown) { 792 $(dropdown).find('.lazy').each(function () { 793 if ($(this)) { 794 var imagen = $(this); 795 var datasrc = 'data-src'; 796 var src = imagen.attr(datasrc); 797 if (src) { 798 imagen.attr('src', src); 799 imagen.removeAttr(datasrc); 800 imagen.removeClass('lazy'); 801 } 802 } 803 }); 804 } 805} 806 807function MenuCarrusel() { 808 $('.carousel-menu').each(function () { 809 if ($(this).find('.carousel-item').length <= 1) { 810 $(this).find('.carousel-control-prev, .carousel-control-next').addClass('d-none'); 811 } 812 $(this).swipe({ 813 swipe: function (event, direction, distance, duration, fingerCount, fingerData) { 814 if (direction == 'left') $(this).carousel('next'); 815 if (direction == 'right') $(this).carousel('prev'); 816 }, 817 allowPageScroll: "none" 818 }); 819 });
820 821 deshabilitaClicMenuGrande(); 822} 823 824function deshabilitaClicMenuGrande() { 825 jQuery(document).on('click', '.dropdown-menu-grande .dropdown-menu', function (e) { 826 e.stopPropagation(); 827 }) 828} 829 830function Busqueda() { 831 jQuery('.search').click(function () { 832 if (jQuery('.search-btn').hasClass('fa-search')) { 833 jQuery('.search-btn').removeClass('fa-search'); 834 jQuery('.search-btn').addClass('fa-times'); 835 } else { 836 jQuery('.search-btn').addClass('fa-search'); 837 jQuery('.search-btn').removeClass('fa-times'); 838 } 839 }); 840} 841 842function WpParam() { 843 var url = $(location).attr('href'); 844 if (url) { 845 parts = url.split("/"); 846 if (parts.length > 0) { 847 last_part = parts[parts.length - 2]; 848 return last_part; 849 } 850 } 851 return null; 852} 853 854var getUrlParameter = function getUrlParameter(sParam) { 855 var sPageURL = window.location.search.substring(1), 856 sURLVariables = sPageURL.split('&'), 857 sParameterName, 858 i; 859 860 for (i = 0; i < sURLVariables.length; i++) { 861 sParameterName = sURLVariables[i].split('='); 862 863 if (sParameterName[0] === sParam) { 864 return sParameterName[1] === undefined ? null : decodeURIComponent(sParameterName[1]); 865 } 866 } 867}; 868 869function ObtenClima(woeid, ficha) { 870 var uri = '/v2/clima/clima.php' + '?woeid=' + woeid; 871 var method = "GET"; 872 ajaxnoticias = ajaxHelper(uri, method).done(function (data, status, jqXHR) { 873 try { 874 if(data.current_observation.condition.temperature) 875 $(ficha).text(data.current_observation.condition.temperature); 876 } 877 catch (e) { 878 alert(e); 879 } 880 }); 881} 882 883function BusquedaGoogle() { 884 var myCallback = function() { 885 if (document.readyState == 'complete') { 886 // Document is ready when CSE element is initialized. 887 $('#gsc-i-id1').attr("placeholder", "Buscar..."); 888 $('#gsc-i-id1').css("background-position", "right"); 889 } else { 890 // Document is not ready yet, when CSE element is initialized. 891 google.setOnLoadCallback(function() { 892 // Render an element with both search box and search 893 $('#gsc-i-id1').css("background-position", "right"); 894 $('#gsc-i-id1').attr("placeholder", "Buscar..."); 895 }, true); 896 } 897 }; 898 899 // Insert it before the CSE code snippet so that cse.js can take the script 900 // parameters, like parsetags, callbacks. 901 window.__gcse = { 902 callback: myCallback 903 }; 904 905 var cx = '018320151572338808723:ge2u1skmqym'; 906 var gcse = document.createElement('script'); 907 gcse.type = 'text/javascript'; 908 gcse.async = true; 909 gcse.src = 'https://cse.google.com/cse.js?cx=' + cx; 910 var s = document.getElementsByTagName('script')[0]; 911 s.parentNode.insertBefore(gcse, s); 912}
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.