1(function($) { 2 "use strict"; 3 $(document).ready(function() { 4 5 var ancho_dispositivo = $(window).width(); 6 var alto_dispositivo = $(window).height(); 7 8 /* 9 if ( ancho_dispositivo >= 1025 && ancho_dispositivo <= 1400 ) { 10 $('.cintillo-partidos').addClass("minimo"); 11 $(window).bind('scroll', function() { 12 if ($(window).scrollTop() > 0) { 13 $('.cintillo-partidos').removeClass("minimo"); 14 } else { 15 $('.cintillo-partidos').addClass("minimo"); 16 } 17 }); 18 } 19 */ 20 21 22 if ($('#banner-campeon').length){ 23 $( "body" ).addClass("con-banner-campeon"); 24 } 25 26 if ($('.slider-sponsors').length){ 27 $('.slider-sponsors').slick({ 28 dots: false, 29 infinite: true, 30 speed: 300, 31 slidesToShow: 10, 32 slidesToScroll: 1, 33 autoplay: true, 34 autoplaySpeed: 5000, 35 arrows: false, 36 prevArrow: "<button type=\"button\" class=\"slick-prev\">", 37 nextArrow: "<button type=\"button\" class=\"slick-next\">", 38 responsive: [ 39 { 40 breakpoint: 1024, 41 settings: { 42 slidesToShow: 8, 43 slidesToScroll: 1, 44 } 45 }, 46 { 47 breakpoint: 800, 48 settings: { 49 slidesToShow: 5, 50 slidesToScroll: 1 51 } 52 }, 53 { 54 breakpoint: 480, 55 settings: { 56 slidesToShow: 3, 57 slidesToScroll: 1 58 } 59 } 60 ] 61 }); 62 } 63 64 if ($('.listado-slider').length){ 65 //console.log("Hay listado secundario"); 66 $('.listado-slider').slick({ 67 dots: false, 68 infinite: false, 69 speed: 300, 70 slidesToShow: 4, 71 slidesToScroll: 2, 72 //autoplay: true, 73 //autoplaySpeed: 5000, 74 arrows: true, 75 prevArrow: "<button type=\"button\" class=\"slick-prev\">", 76 nextArrow: "<button type=\"button\" class=\"slick-next\">", 77 responsive: [ 78 { 79 breakpoint: 1030, 80 settings: { 81 slidesToShow: 3, 82 slidesToScroll: 3 83 } 84 }, 85 { 86 breakpoint: 800, 87 settings: { 88 slidesToShow: 2, 89 slidesToScroll: 2 90 } 91 }, 92 { 93 breakpoint: 480, 94 settings: { 95 slidesToShow: 1, 96 slidesToScroll: 1 97 } 98 } 99 ] 100 }); 101 } 102 if ($('.slider-efemerides').length){ 103 //console.log("Hay listado efemérides"); 104 $('.slider-efemerides').slick({ 105 dots: false, 106 infinite: false, 107 speed: 300, 108 slidesToShow: 4, 109 slidesToScroll: 2, 110 //autoplay: true, 111 //autoplaySpeed: 5000, 112 arrows: true, 113 prevArrow: "<button type=\"button\" class=\"slick-prev\">", 114 nextArrow: "<button type=\"button\" class=\"slick-next\">", 115 responsive: [ 116 { 117 breakpoint: 1030, 118 settings: { 119 slidesToShow: 3, 120 slidesToScroll: 3 121 } 122 }, 123 { 124 breakpoint: 800, 125 settings: { 126 slidesToShow: 2, 127 slidesToScroll: 2 128 } 129 }, 130 { 131 breakpoint: 480, 132 settings: { 133 slidesToShow: 1, 134 slidesToScroll: 1 135 } 136 } 137 ] 138 }); 139 } 140 141 /* 142 $(window).bind('scroll', function() { 143 //var navHeight = $( window ).height() - 70; 144 if ($(window).scrollTop() > 120) { 145 $('.site-header').addClass('fixed'); 146 } else { 147 $('.site-header').removeClass('fixed'); 148 } 149 }); 150 */ 151 window.addEventListener('scroll', function() { 152 const header = document.querySelector('.site-header'); 153 const scrollPosition = window.scrollY; 154 155 if (scrollPosition > 120) { 156 header.classList.add('fixed'); 157 setTimeout(() => { 158 header.classList.add('show'); 159 }, 1); // Pequeño retraso para permitir que el navegador procese la adición de la clase .fixed 160 } else { 161 header.classList.remove('show'); 162 header.classList.remove('fixed'); 163 } 164 }); 165 166 $(document).on('click', '#hamburger', function(event) { 167 $(this).closest("header.site-header").toggleClass("open"); 168 if( $(this).closest("header.site-header").hasClass("open") ) { 169 $("#icon-hamburguesa").html("close"); 170 } else { 171 $("#icon-hamburguesa").html("menu"); 172 } 173 $("html").toggleClass('block-scroll'); 174 }); 175 176 // Backup menu 177 /* 178 $(".btMenuWideDropdown").mouseenter( function(){ 179 //$('.nav-dropdown').hide(); 180 $(this).toggleClass("open"); 181 // e.stopPropagation(); 182 }).mouseleave(function(e) { 183 $(this).toggleClass("open"); 184 //e.stopPropagation(); 185 }); 186 */ 187 /* 188 $( "body" ).on( "click", ".btMenuWideDropdown", function(e) { 189 if( $(this).hasClass( "open" ) ) { 190 $(this).toggleClass("open"); 191 } else { 192 $(".btMenuWideDropdown.open").toggleClass("open"); 193 $(this).toggleClass("open"); 194 } 195 }); 196 */ 197 // Nuevo menu 198 $(document).on('click', '.btMenuWideDropdown', function(event) { 199 event.stopPropagation(); 200 if( $(this).hasClass( "open" ) ) { 201 $(this).toggleClass("open"); 202 } else { 203 $(".btMenuWideDropdown.open").toggleClass("open"); 204 $(this).toggleClass("open"); 205 } 206 }); 207 208 $(document).on('click', function() { 209 $('.btMenuWideDropdown').removeClass('open'); 210 }); 211 212 $(document).on('click', '.btMenuWideDropdown', function(event) { 213 event.stopPropagation(); 214 }); 215 216 217 218 $(document).on('click', '.dropdown-toggle', function(event) { 219 event.stopPropagation(); 220 $(this).parent().toggleClass("open"); 221 //$(this).parent().parent().html( $(this).text() ); 222 }); 223
224 if ( ancho_dispositivo > 800 ) { 225 $( ".btn-redes" ).on( "mouseenter", function() { 226 $(this).addClass("active"); 227 }).on( "mouseleave", function() { 228 $(this).removeClass("active"); 229 }); 230 } else { 231 $( "body" ).on( "click", ".btn-redes", function(event) { 232 event.stopPropagation(); 233 $(".btn-redes.active").toggleClass("active"); 234 $(this).toggleClass("active"); 235 }); 236 $(document).click(function() { 237 $(".btn-redes.active").toggleClass("active"); 238 }); 239 240 } 241 242 /* LUCHO, cambia el texto de lo seleccionado si hace click en el link */ 243 $( "body" ).on( "click", ".dropdown-menu li a", function(event) { 244 var accion = $(this).data('event'); 245 if( typeof accion != 'undefined' && accion == 'noaction' ){ 246 event.stopPropagation(); 247 event.preventDefault(); 248 } 249 $(this).parent().parent().parent().find('.dropdown-toggle').html( $(this).text() ); 250 $(this).parent().parent().parent().toggleClass("open"); 251 }); 252 253 /* LUCHO, cambia el texto de lo seleccionado si hace click en el li */ 254 $( "body" ).on( "click", ".dropdown-menu li", function(event) { 255 var accion = $(this).data('event'); 256 if( typeof accion != 'undefined' && accion == 'noaction' ){ 257 event.stopPropagation(); 258 event.preventDefault(); 259 } 260 $(this).parent().parent().find('.dropdown-toggle').html( $(this).text() ); 261 $(this).parent().parent().toggleClass("open"); 262 }); 263 264 $( "body" ).on( "click", ".nav-tabs a", function(event) { 265 event.preventDefault(); 266 var tabSelect = $(this).attr("aria-controls"); 267 //console.log(tabSelect); 268 $(".tab-pane").removeClass("active"); 269 $(".nav-tabs li").removeClass("active"); 270 $('.tab-pane#' + tabSelect).addClass("active"); 271 $(this).parent().addClass("active"); 272 }); 273 274 $(document).click(function() { 275 $(".select-categories.open").toggleClass("open"); 276 /* 277 $(".btMenuWideDropdown").each(function( index ) { 278 if( $( this ).hasClass("open") ) { 279 console.log("Tiene open:" + index); 280 $( this ).removeClass("open"); 281 } else { 282 console.log("No tiene open"); 283 } 284 }); 285 */ 286 }); 287 288 $( "body" ).on( "click", ".contenedor_evento .ver-detalle", function() { 289 //$(".ver-detalle").on("click", function(e) { 290 $(this).parent().toggleClass("open"); 291 }); 292 293 294 if( $('.box--slider__triunfos .item__slider').length > 0 ){ 295 var Posicion = $('.box--slider__triunfos .item__slider').attr('data-start-slik'); 296 if( typeof Posicion != 'undefined' ){ 297 if( parseInt(Posicion) > 0 ){ 298 setTimeout(() => { 299 if( typeof($('.box--slider__triunfos').slick) == 'function' ){ 300 $('.box--slider__triunfos').slick('slickGoTo', parseInt(Posicion) ); 301 } 302 }, 3000 ); 303 } 304 } 305 } 306 307 /* Prevenimos la busqueda si el search esta empty */ 308 $('#SearchHeader').submit(function(event) { 309 event.preventDefault(); 310 var Search = $('#SearchHeader input[name="s"]').val(); 311 if ( Search.length > 0) { 312 this.submit(); 313 }else{ 314 $('#SearchHeader input[name="s"]').focus(); 315 } 316 }); 317 318 // Pali nuevo 319 if ($('body.single_v2 .btContentHolder table').length){ 320 //console.log('Hay ' + $('.btContentHolder table').length + ' tablas'); 321 $('body.single_v2 .btContentHolder table').each(function(index) { 322 var table = $(this); 323 var tableTds = table.find('td'); 324 var countTds = table.find('td').length; 325 326 //if ( countTds.length > 1 ) { 327 if ( countTds > 1 || tableTds.find('img').length === 0 ) { 328 329 330 //console.log(); 331 //if (countTds === 1 && countTds.find('img').length > 0) { 332 333 table.addClass('tablas_v2'); 334 335 var inlineWidth = table.attr('style'); 336 if (inlineWidth && inlineWidth.includes('width')) { 337 table.css('width', '100%'); 338 } 339 340 table.find('td').each(function() { 341 // Quitar estilos inline 342 $(this).removeAttr('style'); 343 // Remover el HTML dentro de la celda y mantener solo el texto 344 var cellText = $(this).text(); 345 $(this).html(cellText); 346 }); 347 table.find('th').each(function() { 348 $(this).removeAttr('style'); 349 var cellText = $(this).text(); 350 $(this).html(cellText); 351 }); 352 if ( table.find('thead').length == 0) { 353 //console.log('NO TIENE thead'); 354 var headerRow = ''; 355 var firstRow = $('tr:first-child', table ); 356 //console.log('firstRow' , firstRow );
357 // Tomar la primera fila de TDs y convertirla en THs 358 firstRow.find('td').each(function() { 359 var text = $(this).text(); 360 if( text.trim() == '' ){ text = '--'; } 361 headerRow += '<th>' + text + '</th>'; 362 }); 363 firstRow.remove(); 364 //console.log( 'headerRow' , headerRow ); 365 //firstRow.html( headerRow ); 366 table.prepend('<thead><tr>' + headerRow + '</tr></thead>'); 367 } else { 368 //console.log('SI TIENE thead'); 369 var firstRow = table.find('thead').first(); 370 //console.log( 'firstRow' , firstRow ); 371 372 if (firstRow.find('th').length === 0) { 373 //console.log('NO TIENE th'); 374 375 376 //console.log('firstRow' , firstRow ); 377 // Tomar la primera fila de TDs y convertirla en THs 378 headerRow = ''; 379 firstRow.find('td').each(function() { 380 var text = $(this).text(); 381 if( text.trim() == '' ){ text = '--'; } 382 headerRow += '<th>' + text + '</th>'; 383 }); 384 //console.log( 'headerRow' , headerRow ); 385 firstRow.remove(); 386 table.prepend('<thead><tr>' + headerRow + '</tr></thead>'); 387 } else { 388 //console.log('SI TIENE th'); 389 } 390 } 391 table.addClass("tablesaw").attr( "data-tablesaw-mode", "stack" ); 392 } 393 }); 394 } 395 396 if( $('.slider-partidos').length > 0 ){ 397 //console.log("Hay slider partidos"); 398 var $slider = $('.slider-partidos'); 399 function esFraccionado(valor) { 400 return valor % 1 !== 0; 401 } 402 $slider.on('afterChange', function(event, slick, currentSlide){ 403 var slidesToShow = slick.options.slidesToShow; 404 var totalSlides = slick.slideCount; 405 406 //console.log("Current slide: " + currentSlide); 407 //console.log("Slide count: " + totalSlides); 408 //console.log("Slides to show: " + slidesToShow); 409 410 if (esFraccionado(slidesToShow)) { 411 if (currentSlide >= totalSlides - (Math.ceil(slidesToShow) - 1) ) { 412 // Aquà realizas el cambio en el elemento del DOM 413 $slider.addClass("fin-slider"); 414 // Puedes realizar cualquier otra manipulación del DOM que necesites 415 } else { 416 $slider.removeClass("fin-slider"); 417 } 418 } else { 419 if (currentSlide >= totalSlides - Math.ceil(slidesToShow) ) { 420 // Aquà realizas el cambio en el elemento del DOM 421 $slider.addClass("fin-slider"); 422 // Puedes realizar cualquier otra manipulación del DOM que necesites 423 } else { 424 $slider.removeClass("fin-slider"); 425 } 426 } 427 428 }); 429 } 430 431 }); 432 433 434})(jQuery);
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.