1const CACHE_TIME = 600000; 2 3function getCachedData(cacheKey) { 4 try { 5 const cachedData = localStorage.getItem(cacheKey); 6 if (cachedData) { 7 const { data, timestamp } = JSON.parse(cachedData); 8 if (Date.now() - timestamp < CACHE_TIME) return data; 9 } 10 } catch (error) { 11 console.error('Error cache:', error); 12 } 13 return null; 14} 15 16function setCachedData(cacheKey, data) { 17 localStorage.setItem(cacheKey, JSON.stringify({ data, timestamp: Date.now() })); 18} 19 20function formatDateTime(dateString) { 21 const date = new Date(dateString); 22 return { 23 date: date.toLocaleDateString('vi-VN'), 24 time: date.toLocaleTimeString('vi-VN', { hour: '2-digit', minute: '2-digit' }) 25 }; 26} 27for (let i = 0; i < localStorage.length; i++) { 28 let key = localStorage.key(i); 29 let data = localStorage.getItem(key); 30 try { 31 let parsedData = JSON.parse(data); 32 if (parsedData.timestamp) { 33 34 let timestamp = parsedData.timestamp; 35 let currentTime = Date.now(); 36 let thirtyDaysInMillis = 30 * 24 * 60 * 60 * 1000; 37 let timeDifference = currentTime - timestamp; 38 if (timeDifference > thirtyDaysInMillis) { 39 localStorage.removeItem(key); 40 } 41 } 42 } catch (error) { 43 // console.error('Dữ liá»u không hợp lá»: ', error); 44 } 45} 46(function($) { 47 'use strict'; 48 function scrollToActiveMenu(container, item) { 49 let menuContainer = $(container) 50 let activeItem = $(item) 51 52 if (activeItem.length) { 53 let containerWidth = menuContainer.width(); 54 let activeItemOffset = activeItem.offset().left; 55 let activeItemWidth = activeItem.outerWidth(); 56 let scrollToPosition = activeItemOffset - (containerWidth / 2) + (activeItemWidth / 2); 57 //console.log(221, activeItem); 58 menuContainer.animate({ 59 scrollLeft: scrollToPosition 60 }, 500); 61 } 62 } 63 $(document).ready(function() { 64 // scrollToActiveMenu('.header-menu .navbar-nav', '.header-menu .navbar-nav .current-menu-item'); 65 66 $(".menu_mobile").click(function() { 67 var $box = $(".menu_mobile_wrap"); 68 var $btn = $(this); 69 70 if ($box.is(":visible")) { 71 $box.slideUp(100); 72 $btn.removeClass("active"); 73 } else { 74 $box.css("display", "flex").hide().slideDown(100); 75 $btn.addClass("active"); 76 } 77 }); 78 if (typeof Swiper !== 'undefined') { 79
80 new Swiper(".swiper-container.col-3-item", { 81 loop: true, 82 spaceBetween: 10, 83 slidesPerView: 1, 84 pagination: { 85 el: '.posts-pagination', // Äặt lá»p cá»§a phần tá» pagination 86 clickable: true, // Cho phép ngưá»i dùng click và o các nút pagination 87 type: 'bullets', // Loại pagination là các nút tròn (bullets) 88 }, 89 }); 90 91 } 92 93 94 95 $('.country_league_widget li a').on('click', function() { 96 $(this).parent().toggleClass('active'); 97 }); 98 99 $('.data_country_league_widget li a').on('click', function() { 100 $(this).parent().toggleClass('active'); 101 }); 102 103 $('.content-show-more a').click(function(e) { 104 e.preventDefault(); 105 106 $('.box-wrap-content').removeClass("box-content-max"); 107 $('.content-show-more').hide(); 108 $('.content-hide-more').show(); 109 }); 110 $('.content-hide-more a').click(function(e) { 111 e.preventDefault(); 112 $('.box-wrap-content').addClass("box-content-max"); 113 $('.content-show-more').show(); 114 $('.content-hide-more').hide(); 115 }); 116 $('.league-all .area-league').click(function(e) { 117 e.preventDefault(); 118 $(this).find('.league-all-child').toggle(); 119 120 }); 121 122 $(document).ready(function() { 123 let wrap = $('.sport_theme_hide'); 124 // var menuActive = $('.current-menu-item'); 125 // if(menuActive.length == 0){ 126 // $('ul li.menu-item:first-of-type').addClass('current-menu-item'); 127 // } 128 129 $('.header-menu .navbar-nav .current-menu-item').animate({ 130 scrollLeft: 0 // Cuá»n vá» Äầu 131 }, 500); // Thá»i gian cuá»n (500ms) 132 133 if(wrap.length > 0){ 134 let current_height = wrap.height(); 135 let your_height = 300; 136 137 if(current_height > your_height){ 138 wrap.addClass('fix_height'); 139 140 wrap.append('<div class="sport_theme_readmore sport_theme_readmore_more"><span>'+sport_theme_translate('see more',sport_theme_language)+'</a></div>'); 141 wrap.append('<div class="sport_theme_readmore sport_theme_readmore_less" style="display: none;"><span>'+sport_theme_translate('see less',sport_theme_language)+'</a></div>'); 142 143 wrap.on('click', '.sport_theme_readmore_more span', function(){ 144 wrap.removeClass('fix_height'); 145 wrap.find('.sport_theme_readmore_more').hide(); 146 wrap.find('.sport_theme_readmore_less').show(); 147 148 $('html, body').animate({ 149 scrollTop: wrap.offset().top - 20 150 }, 500); 151 152 }); 153 154 wrap.on('click', '.sport_theme_readmore_less span', function(){ 155 wrap.addClass('fix_height'); 156 wrap.addClass('loaded'); 157 wrap.find('.sport_theme_readmore_less').hide(); 158 wrap.find('.sport_theme_readmore_more').show(); 159 160 $('html, body').animate({ 161 scrollTop: wrap.offset().top - 20 162 }, 500); 163 164 }); 165 } 166 } 167 }); 168 }); 169 170 jQuery(document).ready(function($) { 171 // helper format dd/mm/YYYY 172 function formatDMY(d) { 173 const dd = String(d.getDate()).padStart(2, '0'); 174 const mm = String(d.getMonth() + 1).padStart(2, '0'); 175 return dd + '/' + mm + '/' + d.getFullYear(); 176 } 177 178 // 1 instance duy nhất (chá»n selector phù hợp vá»i HTML cá»§a bạn) 179 let datePicker = flatpickr(".sport_theme_chose_date > input", { 180 dateFormat: "d/m/Y", 181 locale: "vn", // nếu không có locale 'vn' trong build cá»§a bạn, Äá»i thà nh 'vi' hoặc import locale tương ứng 182 defaultDate: new Date(), 183 maxDate: new Date(), 184 onChange: function(selectedDates, dateStr, instance) { 185 // so sánh vá»i ngà y hôm nay Äá» báºt/tắt nút next 186 const todayStr = formatDMY(new Date()); 187 if (dateStr !== todayStr) { 188 $('.arrow_last').removeClass('deactive'); 189 } else { 190 $('.arrow_last').addClass('deactive'); 191 } 192 193 const cacheKey = 'post_' + dateStr; 194 const dataPost = getCachedData(cacheKey); 195 if (dataPost) { 196 $('.row-ajax-post').html(dataPost); 197 } else { 198 jQuery.ajax({ 199 url: ajaxurl, 200 type: 'GET', 201 data: { 202 action: 'load_latest_posts_by_date', 203 day: dateStr 204 }, 205 success: function(response) { 206 setCachedData(cacheKey, response); 207 $('.row-ajax-post').html(response); 208 }, 209 error: function(error) { 210 //console.log(error); 211 } 212 }); 213 } 214 } 215 }); 216 217 // set trạng thái ban Äầu cho mÅ©i tên next (nếu input Äã có value khác hôm nay thì enable) 218 const initialValue = datePicker && datePicker.input ? datePicker.input.value : formatDMY(new Date()); 219 if (initialValue !== formatDMY(new Date())) { 220 $('.arrow_last').removeClass('deactive'); 221 } else { 222 $('.arrow_last').addClass('deactive'); 223 } 224 225 // prev 226 $('body').on('click', '.arrow_first', function () {
227 let currentDate = datePicker.selectedDates[0] || new Date(); 228 let prevDate = new Date(currentDate); 229 prevDate.setDate(prevDate.getDate() - 1); 230 datePicker.setDate(prevDate, true); 231 }); 232 233 // next (ngÄn vượt quá hôm nay) 234 $('body').on('click', '.arrow_last', function () { 235 let currentDate = datePicker.selectedDates[0] || new Date(); 236 let nextDate = new Date(currentDate); 237 nextDate.setDate(nextDate.getDate() + 1); 238 239 // so sánh chá» ngà y (không so giá») 240 const t = new Date(); 241 t.setHours(0,0,0,0); 242 nextDate.setHours(0,0,0,0); 243 244 if (nextDate > t) { 245 // không cho set và Äảm bảo nút disabled 246 $(this).addClass('deactive'); 247 return; 248 } 249 250 datePicker.setDate(nextDate, true); 251 }); 252 253 254 255 256 257 258 259 $('.flex-question').each(function () { 260 261 const dbQuest = $(this).attr('data-db'); 262 const dataCacheVote = getCachedData(dbQuest); 263 264 if (dataCacheVote) { 265 const divQuest = dataCacheVote.label; 266 const dataCacheAnswer = dataCacheVote.answers; 267 268 $('#' + divQuest).find('.button-acept-dudoan').removeClass('active'); 269 $('#' + divQuest).find('.flex-question').addClass('no-chose'); 270 271 dataCacheAnswer.forEach(function (item) { 272 if (item.value == 1) { 273 $('#' + divQuest).find('[data-answer="' + item.answer + '"]').addClass('active'); 274 } 275 }); 276 } 277 }); 278 279 280 281 282 $('body').on('click', '.flex-question:not(.no-chose) .question_item', function () { 283 $(this).addClass('active'); 284 $(this).parent().find('.question_item').not(this).removeClass('active'); 285 $(this).parents('.row_question_wrap').find('.button-acept-dudoan').addClass('active'); 286 }); 287 $('body').on('click', '.button-acept-dudoan.active', function () { 288 var dataQuest = $(this).parents('.row_question').find('.flex-question').attr('data-question'); 289 var dbQuest = $(this).parents('.row_question').find('.flex-question').attr('data-db'); 290 var $this = $(this); 291 var ParenQuest = $this.closest('.row_question'); 292 var answers = { 293 answers: [] 294 }; 295 296 $(this).parents('.row_question').find('.question_item').each(function () { 297 var answerText = $(this).attr('data-answer'); 298 var isActive = $(this).hasClass('active') ? 1 : 0; 299 answers.answers.push({ 300 answer: answerText, 301 value: isActive 302 }); 303 }); 304 305 $.ajax({
306 url: ajaxurl, 307 type: 'POST', 308 data: { 309 action: 'update_poll_answers', 310 question: dataQuest, 311 answers: JSON.stringify(answers) 312 }, 313 beforeSend: function () { 314 // console.log('Äang gá»i yêu cầu...'); 315 }, 316 success: function (response) { 317 answers.label = dataQuest; 318 setCachedData(dbQuest,answers); 319 if (response.success) { 320 //console.log(response.data.html); 321 ParenQuest.find('.modal-ajax').html(response.data.html); 322 ParenQuest.find('.button-result-dudoan').trigger('click'); 323 ParenQuest.find('.button-acept-dudoan').removeClass('active'); 324 ParenQuest.find('.flex-question').addClass('no-chose'); 325 } else { 326 console.log('Có lá»i xảy ra:', response.data); 327 ParenQuest.find('.button-result-dudoan').trigger('click'); 328 } 329 }, 330 error: function (xhr, status, error) { 331 console.log('Có lá»i xảy ra trong quá trình gá»i yêu cầu:', status, error); 332 ParenQuest.find('.button-result-dudoan').trigger('click'); 333 } 334 }); 335 336 }); 337 338 $('body').on('click', '.sport_theme_button_search', function () { 339 const activeClick = $(this).attr('data-search'); 340 let dateFilterStart, dateFilterEnd, catFilter, textFilter, page; 341 342 if (activeClick === 'date-search') { 343 dateFilterStart = $(this).parent().find('#sport_theme_date_start').val(); 344 dateFilterEnd = $(this).parent().find('#sport_theme_date_end').val(); 345 } else if (activeClick === 'cat-search') { 346 catFilter = $(this).parent().find('#sport_league').val(); 347 } else if (activeClick === 'text-search') { 348 textFilter = $(this).parent().find('#sport_theme_title').val(); 349 } 350 351 // Tạo cacheKey dá»±a trên dữ liá»u tìm kiếm 352 const cacheKey = `search_${dateFilterStart || ''}_${dateFilterEnd || ''}_${catFilter || ''}_${textFilter || ''}`; 353 const cachedData = getCachedData(cacheKey); 354 355 if (cachedData) { 356 //console.log('Dữ liá»u lấy từ cache'); 357 $('.row-result').html(cachedData); 358 return; 359 } 360 361 // Nếu không có trong cache, thá»±c hiá»n AJAX 362 ajax_load_post(dateFilterStart, dateFilterEnd, catFilter, textFilter, 1, cacheKey); 363 }); 364 365 $('body').on('click', '.col-pagi .page-number:not(.current)', function (e) { 366 e.preventDefault(); 367 let dateFilterStart, dateFilterEnd, catFilter, textFilter, page; 368 dateFilterStart = $(this).parents('.row-render-post').attr('data-date-start'); 369 dateFilterEnd = $(this).parents('.row-render-post').attr('data-date-end'); 370 catFilter = $(this).parents('.row-render-post').attr('data-cat'); 371 textFilter = $(this).parents('.row-render-post').attr('data-text'); 372 page = $(this).attr('data-page'); 373 374 // Tạo cacheKey cho phân trang 375 const cacheKey = `search_${dateFilterStart || ''}_${dateFilterEnd || ''}_${catFilter || ''}_${textFilter || ''}_page_${page}`; 376 377 //console.log(cacheKey); 378 379 const cachedData = getCachedData(cacheKey); 380 if (cachedData) { 381 //console.log('Dữ liá»u phân trang lấy từ cache'); 382 $('.row-result').html(cachedData); 383 return; 384 } 385 386 // Nếu không có trong cache, thá»±c hiá»n AJAX 387 ajax_load_post(dateFilterStart, dateFilterEnd, catFilter, textFilter, page, cacheKey); 388 }); 389 390 function ajax_load_post(dateFilterStart, dateFilterEnd, catFilter, textFilter, page, cacheKey) { 391 $.ajax({
392 url: ajaxurl, 393 type: 'GET', 394 data: { 395 action: 'sport_theme_search', 396 date_start: dateFilterStart || null, 397 date_end: dateFilterEnd || null, 398 category: catFilter || null, 399 text: textFilter || null, 400 page: page || 1, 401 }, 402 beforeSend: function () { 403 //console.log('Äang thá»±c hiá»n tìm kiếm...'); 404 }, 405 success: function (response) { 406 $('.row-result').html(response); 407 setCachedData(cacheKey, response); // Lưu kết quả và o cache 408 }, 409 error: function (xhr, status, error) { 410 console.error('Có lá»i xảy ra trong quá trình tìm kiếm:', status, error); 411 } 412 }); 413 } 414 415 416 }); 417 418 jQuery(document).ready(function($) { 419 let $items = $('.video-item'); 420 if($items){ 421 let currentIndex = 0; 422 let interval; 423 424 function updateMainContent($item) { 425 let title = $item.data('title'); 426 let img = $item.data('img'); 427 let href = $item.data('href'); 428 429 $('.span_title_post_main').text(title); 430 $('.row_video_group > .post-thumbnail').html('<img src="' + img + '" alt="">'); 431 $('.box_title_main').attr('href', href); 432 } 433 434 function setActive(index) { 435 $items.removeClass('active-play'); 436 let $currentItem = $items.eq(index); 437 $currentItem.addClass('active-play'); 438 updateMainContent($currentItem); 439 currentIndex = index; 440 } 441 442 function startAutoSwitch() { 443 interval = setInterval(function() { 444 let nextIndex = (currentIndex + 1) % $items.length;
445 setActive(nextIndex); 446 }, 5000); 447 } 448 449 function stopAutoSwitch() { 450 clearInterval(interval); 451 } 452 453 // Hover 454 $items.hover( 455 function() { 456 let index = $items.index(this); 457 setActive(index); 458 stopAutoSwitch(); 459 }, 460 function() { 461 startAutoSwitch(); 462 } 463 ); 464 465 // Khá»i Äá»ng 466 setActive(0); 467 startAutoSwitch(); 468 } 469 470 }); 471 472 async function fetchDataRanking(sid) { 473 try { 474 const response = await $.ajax({ 475 url: `https://ace.winfast.dev/api/get-league-rank?sid=${sid}`, 476 method: 'GET', 477 headers: { 478 'Authorization': 'Basic ' + btoa('db:1') 479 } 480 }); 481 482 if (!response || !response.data_rank) { 483 console.error(`Dữ liá»u trả vá» từ API không hợp lá» cho sid ${sid}`); 484 return null; 485 } 486 487 return response; 488 } catch (error) { 489 console.error(`Lá»i khi tải dữ liá»u cho sid ${sid}:`, error); 490 return null; 491 } 492 } 493 494 // Xá» lý tab switch 495 $('.tabs_sport_theme_tab-nav li').on('click', function(){ 496 $('.tabs_sport_theme_tab-nav li').removeClass('active'); 497 $(this).addClass('active'); 498 499 const tab = $(this).data('tab'); 500 $('.tabs_sport_theme_tab-content').removeClass('active'); 501 $('#tab-' + tab).addClass('active'); 502 }); 503 504 // Fetch và fill data 505 $('#league-select').on('change', async function() { 506 const sid = $(this).val(); 507 if (!sid) return; 508 509 const data = await fetchDataRanking(sid); 510 if (!data) return; 511 //console.log(data); 512 // Äá»i 513 const teams = data.data_rank || []; 514 let htmlTeams = ''; 515 const top10Teams = teams.slice(0, 10); 516 $.each(top10Teams, function(i, item) { 517 htmlTeams += ` 518 <tr> 519 <td>${i+1}</td> 520 <td>${item.Name_E}</td> 521 <td>${item.Points}</td> 522 </tr> 523 `; 524 }); 525 $('#tab-teams tbody').html(htmlTeams); 526 527 // Cầu thá»§ 528 const players = data.data_player || []; // và dụ API trả vá» 529 let htmlPlayers = ''; 530 const top10Players = players.slice(0, 10); 531 $.each(top10Players, function(i, item) { 532 htmlPlayers += ` 533 <tr> 534 <td>${i+1}</td> 535 <td>${item.name}</td> 536 <td>${item.score}</td> 537 </tr> 538 `; 539 });
540 $('#tab-players tbody').html(htmlPlayers); 541 }); 542 const initialSid = $('#league-select').val(); 543 if (initialSid) { 544 $('#league-select').trigger('change'); 545 } 546 547 async function fetchDataMatchTip() { 548 try { 549 const response = await $.ajax({ 550 url: `https://ace.winfast.dev/ajax/match/hot-tips`, 551 method: 'GET', 552 headers: { 553 'Authorization': 'Basic ' + btoa('db:1') 554 } 555 }); 556 557 if (!response || !response.Data) { 558 console.error(`Dữ liá»u trả vá» từ API không hợp lá»`); 559 return []; 560 } 561 562 // Lấy ra danh sách match 563 const matches = response.Data.map(item => ({ 564 id: item.ScheduleID, 565 homeTeam: { 566 id: item.HomeTeamID, 567 name: item.HomeName, 568 winPercent: item.HomeWinPercent, 569 logo: item.HomeLogo 570 }, 571 guestTeam: { 572 id: item.GuestTeamID, 573 name: item.GuestName, 574 winPercent: item.GuestWinPercent, 575 logo: item.GuestLogo 576 }, 577 drawPercent: item.DrawPercent, 578 league: item.SclassNameES, 579 matchTime: item.MatchTime, 580 detailHtml: item.Detail, 581 scoreHomePredict : item.ScoreHomePredict, 582 scoreGuestPredict : item.ScoreGuestPredict, 583 })); 584 585 return matches; 586 587 } catch (error) { 588 console.error(`Lá»i khi tải dữ liá»u:`, error); 589 return []; 590 } 591 } 592 593 $(document).ready(async function() { 594 const $container = $('#tips-container'); 595 const $filter = $('#tips-filter'); 596 const $tipsTable = $('#tips-table'); 597 598 // Nếu không tá»n tại container, thoát luôn 599 if ($container.length === 0 && $tipsTable.length === 0) { 600 console.warn('Không tìm thấy container Tips.'); 601 return; 602 } 603 604 // Gá»i API 605 const matches = await fetchDataMatchTip(); 606 if (!matches.length) return; 607 608 // Tạo filter dropdown 609 if ($filter.length) { 610 const leagues = [...new Set(matches.map(m => m.league))]; 611 const $wrap = $(` 612 <div class="sport_theme-filter-wrap"> 613 <span class="sport_theme-filter-icon"> 614 <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 14 14" fill="none"> 615 <path d="M4 10V14H0V10H4ZM1 13H3V11H1V13Z" fill="#4A4F55"/> 616 <path d="M9 10V14H5V10H9ZM6 13H8V11H6V13Z" fill="#4A4F55"/> 617 <path d="M14 5V9H10V5H14ZM11 8H13V6H11V8Z" fill="#4A4F55"/> 618 <path d="M14 0V4H10V0H14ZM11 3H13V1H11V3Z" fill="#4A4F55"/> 619 <path d="M4 0V4H0V0H4ZM1 3H3V1H1V3Z" fill="#4A4F55"/> 620 <path d="M10 10H14V14H10V10Z" fill="#4A4F55"/> 621 <path d="M0 5H4V9H0V5Z" fill="#4A4F55"/> 622 <path d="M5 5H9V9H5V5Z" fill="#4A4F55"/> 623 <path d="M5 0H9V4H5V0Z" fill="#4A4F55"/> 624 </svg> 625 </span> 626 <span class="sport_theme-filter-label">Chá»n giải Äấu yêu thÃch:</span> 627 <div class="sport_theme-select"> 628 <div class="sport_theme-select-selected"> 629 <div class="sport_theme_filter_title camp-1">Tất cả giải Äấu</div> 630 </div> 631 <div class="sport_theme-select-options"></div> 632 </div> 633 </div> 634 `); 635 636 const $options = $wrap.find('.sport_theme-select-options'); 637 $options.append(`<div class="sport_theme-select-option" data-league="">Tất cả giải Äấu</div>`);
638 leagues.forEach(l => { 639 $options.append(`<div class="sport_theme-select-option" data-league="${l}">${l}</div>`); 640 }); 641 $filter.append($wrap); 642 643 // Toggle dropdown 644 $wrap.find('.sport_theme-select-selected').on('click', function(e) { 645 e.stopPropagation(); 646 $('.sport_theme-select-options').not($options).slideUp(); 647 $options.slideToggle(200); 648 }); 649 650 // Chá»n option 651 $wrap.find('.sport_theme-select-option').on('click', function(e) { 652 e.stopPropagation(); 653 const selectedLeague = $(this).data('league'); 654 $wrap.find('.sport_theme-select-selected .sport_theme_filter_title').text($(this).text()); 655 $options.slideUp(); 656 657 $('.sport_theme-tip-card').each(function() { 658 const cardLeague = $(this).data('league'); 659 $(this).toggle(!selectedLeague || cardLeague === selectedLeague); 660 }); 661 }); 662 663 $(document).on('click', function() { 664 $options.slideUp(); 665 }); 666 } 667 668 // Render TIP CARD nếu tá»n tại #tips-container 669 if ($container.length) { 670 matches.forEach(match => { 671 if (match.scoreHomePredict == null) return; 672 673 const d = new Date(match.matchTime); 674 const yyyy = d.getFullYear(); 675 const mm = ('0' + (d.getMonth() + 1)).slice(-2); 676 const dd = ('0' + d.getDate()).slice(-2); 677 const date = `${dd}/${mm}/${yyyy}`; 678 const time = d.toTimeString().slice(0, 5); 679 680 const $card = $(` 681 <div class="sport_theme-tip-card" data-league="${match.league}"> 682 <div class="sport_theme-tip-header"> 683 <div class="sport_theme_group_league"> 684 <div class="sport_theme_tip_league">${match.league}</div> 685 <div class="sport_theme_tip_date">${date}</div> 686 </div> 687 <div class="sport_theme_group_tip_detail"> 688 <a href="${_matchUrl}phan-tich/${match.id}" target="_blank" class="sport_theme_tip_detail_link">Phân tÃch</a> 689 <span class="sport_theme_spacing"></span> 690 <a href="${_matchUrl}${match.id}" target="_blank" class="sport_theme_tip_detail_link">Chi tiết</a> 691 </div> 692 </div> 693 <div class="sport_theme-tip-body"> 694 <div class="sport_theme-tip-team"> 695 <span>${match.homeTeam.name}</span> 696 <img width="40" height="40" src="${match.homeTeam.logo ? _imgS3 + match.homeTeam.logo : 'wp-content/uploads/2025/08/teamicon-1.png'}" alt="${match.homeTeam.name}"> 697 </div> 698 <div class="sport_theme_time"> 699 <span class="sport_theme_time_vs">VS</span> 700 <span class="sport_theme_time_title">${time}</span> 701 </div> 702 <div class="sport_theme-tip-team"> 703 <img width="40" height="40" src="${match.guestTeam.logo ? _imgS3 + match.guestTeam.logo : 'wp-content/uploads/2025/08/teamicon-1.png'}" alt="${match.guestTeam.name}"> 704 <span>${match.guestTeam.name}</span> 705 </div> 706 </div> 707 <div class="sport_theme_tip-footer"> 708 <div class="sport_theme-detail"> 709 <div class="label_detail">Tip</div> 710 <div class="content_detail camp-3">${match.detailHtml}</div> 711 </div> 712 <div class="sport_theme-detail sport_theme_predict"> 713 <div class="label_detail">Dá»± Äoán kết quả</div> 714 <div class="content_detail content_predict"> 715 ${match.scoreHomePredict} - ${match.scoreGuestPredict} 716 </div> 717 </div> 718 </div> 719 </div> 720 `); 721 722 $container.append($card); 723 }); 724 725 } 726 727 const tipTableLimit = $tipsTable.data('limit') || 5; 728
729 // Render BẢNG TIP nếu tá»n tại #tips-table 730 if ($tipsTable.length) { 731 matches.slice(0, tipTableLimit).forEach(match => { 732 const d = new Date(match.matchTime); 733 const mm = ('0' + (d.getMonth() + 1)).slice(-2); 734 const dd = ('0' + d.getDate()).slice(-2); 735 const hh = ('0' + d.getHours()).slice(-2); 736 const mi = ('0' + d.getMinutes()).slice(-2); 737 const dateTime = `${mm}/${dd} ${hh}:${mi}`; 738 739 const $row = $(` 740 <div class="sport_theme-tips-row"> 741 <div class="sport_theme-tips-league">${match.league}</div> 742 <div class="sport_theme-tips-match"> 743 <span>${match.homeTeam.name}</span> 744 <span class="vs">VS</span> 745 <span>${match.guestTeam.name}</span> 746 </div> 747 <div class="sport_theme-tips-time">${dateTime}</div> 748 </div> 749 `); 750 $tipsTable.append($row); 751 }); 752 } 753 754 }); 755 756 $('body').on('click', '.wrap_league_item_inner', function () { 757 758 759 760 if ($(this).hasClass('active')) { 761 $(this).find('svg').replaceWith(` 762 <svg xmlns="http://www.w3.org/2000/svg" width="11" height="11" viewB
762ox="0 0 11 11" fill="none"> 763 <rect x="0.5" y="0.5" width="10" height="10" rx="2.5" fill="white"></rect> 764 <rect x="0.5" y="0.5" width="10" height="10" rx="2.5" stroke="#070F03"></rect> 765 <path d="M5.88436 3.96575C5.88436 3.75383 5.71256 3.58203 5.50064 3.58203C5.28871 3.58203 5.11691 3.75383 5.11691 3.96575L5.11691 5.11693H3.96575C3.75383 5.11693 3.58203 5.28873 3.58203 5.50065C3.58203 5.71257 3.75383 5.88437 3.96575 5.88437H5.11691V7.03552C5.11691 7.24744 5.28871 7.41924 5.50064 7.41924C5.71256 7.41924 5.88436 7.24744 5.88436 7.03552L5.88436 5.88437H7.03552C7.24744 5.88437 7.41924 5.71257 7.41924 5.50065C7.41924 5.28873 7.24744 5.11693 7.03552 5.11693H5.88436V3.96575Z" fill="#070F03"></path> 766 </svg> 767 `); 768 } else { 769 $(this).find('svg').replaceWith(`<svg xmlns="http://www.w3.org/2000/svg" width="11" height="11" viewBox="0 0 11 11" fill="none"> 770 <g clip-path="url(#clip0_5105_30432)"> 771 <mask id="path-1-outside-1_5105_30432" maskUnits="userSpaceOnUse" x="-0.0839844" y="-0.0834961" width="12" height="12" fill="black"> 772 <rect fill="white" x="-0.0839844" y="-0.0834961" width="12" height="12"/> 773 <path d="M5.49935 10.0832C3.33875 10.0832 2.25844 10.0832 1.58723 9.41196C0.916016 8.74074 0.916016 7.66044 0.916016 5.49984C0.916016 3.33923 0.916016 2.25893 1.58723 1.58772C2.25844 0.916504 3.33875 0.916504 5.49935 0.916504C7.65995 0.916504 8.74026 0.916504 9.41147 1.58772C10.0827 2.25893 10.0827 3.33923 10.0827 5.49984C10.0827 7.66044 10.0827 8.74074 9.41147 9.41196C8.74026 10.0832 7.65995 10.0832 5.49935 10.0832Z"/> 774 </mask> 775 <path d="M5.49935 10.0832C3.33875 10.0832 2.25844 10.0832 1.58723 9.41196C0.916016 8.74074 0.916016 7.66044 0.916016 5.49984C0.916016 3.33923 0.916016 2.25893 1.58723 1.58772C2.25844 0.916504 3.33875 0.916504 5.49935 0.916504C7.65995 0.916504 8.74026 0.916504 9.41147 1.58772C10.0827 2.25893 10.0827 3.33923 10.0827 5.49984C10.0827 7.66044 10.0827 8.74074 9.41147 9.41196C8.74026 10.0832 7.65995 10.0832 5.49935 10.0832Z" fill="white"/> 776 <path d="M5.49935 10.0832V9.08317C4.39078 9.08317 3.65995 9.08105 3.11802 9.00819C2.60485 8.93919 2.41317 8.82369 2.29434 8.70485L1.58723 9.41196L0.880122 10.1191C1.4325 10.6714 2.11658 10.8915 2.85152 10.9904C3.55769 11.0853 4.44732 11.0832 5.49935 11.0832V10.0832ZM0.916016 5.49984H-0.0839844C-0.0839844 6.55187 -0.0861081 7.44149 0.00883454 8.14767C0.107645 8.88261 0.327747 9.56669 0.880122 10.1191L1.58723 9.41196L2.29434 8.70485C2.1755 8.58601 2.05999 8.39434 1.991 7.88117C1.91814 7.33924 1.91602 6.60841 1.91602 5.49984H0.916016ZM10.0827 5.49984H9.08268C9.08268 6.60841 9.08056 7.33924 9.0077 7.88117C8.9387 8.39434 8.8232 8.58601 8.70436 8.70485L9.41147 9.41196L10.1186 10.1191C10.671 9.56669 10.8911 8.88261 10.9899 8.14767C11.0848 7.44149 11.0827 6.55187 11.0827 5.49984H10.0827ZM5.49935 10.0832V11.0832C6.55138 11.0832 7.441 11.0853 8.14718 10.9904C8.88212 10.8915 9.5662 10.6714 10.1186 10.1191L9.41147 9.41196L8.70436 8.70485C8.58552 8.82369 8.39385 8.93919 7.88068 9.00819C7.33875 9.08105 6.60792 9.08317 5.49935 9.08317V10.0832ZM5.49935 0.916504V1.9165C6.60792 1.9165 7.33875 1.91863 7.88068 1.99149C8.39385 2.06048 8.58552 2.17599 8.70436 2.29482L9.41147 1.58772L10.1186 0.880611C9.5662 0.328235 8.88212 0.108133 8.14718 0.00932282C7.441 -0.0856198 6.55138 -0.0834961 5.49935 -0.0834961V0.916504ZM10.0827 5.49984H11.0827C11.0827 4.44781 11.0848 3.55818 10.9899 2.85201C10.8911 2.11707 10.671 1.43299 10.1186 0.880611L9.41147 1.58772L8.70436 2.29482C8.8232 2.41366 8.9387 2.60534 9.0077 3.1185C9.08056 3.66043 9.08268 4.39127 9.08268 5.49984H10.0827ZM5.49935 0.916504V-0.0834961C4.44732 -0.0834961 3.55769 -0.0856198 2.85152 0.00932282C2.11658 0.108133 1.4325 0.328235 0.880122 0.880611L1.58723 1.58772L2.29434 2.29482C2.41317 2.17599 2.60485 2.06048 3.11802 1.99149C3.65995 1.91863 4.39078 1.9165 5.49935 1.9165V0.916504ZM0.916016 5.49984H1.91602C1.91602 4.39127 1.91814 3.66043 1.991 3.1185C2.05999 2.60534 2.1755 2.41366 2.29434 2.29482L1.58723 1.58772L0.880122 0.880611C0.327747 1.43299 0.107645 2.11707 0.00883454 2.85201C-0.0861081 3.55818 -0.0839844 4.44781 -0.0839844 5.49984H0.916016Z" fill="black" mask="url(#path-1-outside-1_5105_30432)"/> 777 <path d="M6.875 5.84375C7.06485 5.84375 7.21875 5.68985 7.21875 5.5C7.21875 5.31015 7.06485 5.15625 6.875 5.15625H4.125C3.9351
7775 5.15625 3.78125 5.31015 3.78125 5.5C3.78125 5.68985 3.93515 5.84375 4.125 5.84375H6.875Z" fill="#070F03"/> 778 </g> 779 <defs> 780 <clipPath id="clip0_5105_30432"> 781 <rect width="11" height="11" fill="white"/> 782 </clipPath> 783 </defs> 784</svg>`); 785 } 786 787 $(this).toggleClass('active'); 788 789 790 $('.wrap_league_item').not($(this).parent()).find('.league-list').slideUp(200); 791 792 $('.wrap_league_item_inner').not(this).removeClass('active'); 793 794 $(this).parent().find('.league-list').stop(true, true).slideToggle(200); 795 }); 796 797})(jQuery); 798 799jQuery(document).ready(function ($) { 800 $('body').on('click', '.dropdown-list li', function () { 801 const text = $(this).text().trim(); 802 $('.database-menu-item a').each(function () { 803 const oldHref = $(this).attr('href'); 804 const url = new URL(oldHref, window.location.origin); 805 url.searchParams.set('season', text); 806 $(this).attr('href', url.pathname + url.search); 807 }); 808 }); 809 function setThemeCookie(mode) { 810 document.cookie = 811 "sport_theme_mode=" + mode + 812 "; path=/" + 813 "; max-age=" + (60 * 60 * 24 * 365) + 814 "; domain=" + window.location.hostname.replace(/^www\./, ""); 815 } 816 817 818$('.header-mode').on('click', function () { 819 const $sun = $(this).find('.header-mode-sun'); 820 const $moon = $(this).find('.header-mode-moon'); 821 const isDark = !$moon.hasClass('active'); 822 823 $moon.toggleClass('active', isDark); 824 $sun.toggleClass('active', !isDark); 825 826 $('body').toggleClass('sport_theme_dark dark', isDark); 827 setThemeCookie(isDark ? 1 : 0); 828}); 829 830$('.bongdako-dark-mode').on('click', function () { 831 const $sun = $(this).find('.dark-mode-off'); 832 const $moon = $(this).find('.dark-mode-on'); 833 const $toggle = $(this).find('.dark-mode-toggle'); 834 const isDark = !$moon.hasClass('active'); 835 836 $moon.toggleClass('active', isDark); 837 $sun.toggleClass('active', !isDark); 838 $toggle.toggleClass('active', isDark); 839 840 $('body').toggleClass('sport_theme_dark dark', isDark); 841 setThemeCookie(isDark ? 1 : 0); 842}); 843 844 845 $('body').on('click', '.close_banner', function () { 846 $(this).parent().remove(); 847 }); 848 $(window).on("scroll", function() { 849 if ($(this).scrollTop() > 200) { 850 $('.gutter_warp').addClass('scrolled_banner'); 851 } else { 852 $('.gutter_warp').removeClass('scrolled_banner'); 853 } 854 }); 855 856 857 858}); 859jQuery(document).ready(function($) { 860 var swiper = new Swiper(".swiper-container-post", { 861 loop: false, 862 pagination: { 863 el: ".swiper-pagination", 864 clickable: true, 865 }, 866 navigation: { 867 nextEl: ".swiper-button-next", 868 prevEl: ".swiper-button-prev", 869 }, 870 autoplay: { 871 delay: 10000, 872 disableOnInteraction: false, 873 }, 874 }); 875}); 876jQuery(document).ready(function($) { 877 878 function initLazyYouTube() { 879 var $lazyVideos = $('.lazy-youtube'); 880 881 if ('IntersectionObserver' in window) { 882 var observer = new IntersectionObserver(function(entries, obs) { 883 entries.forEach(function(entry) { 884 if (entry.isIntersecting) { 885 var $wrapper = $(entry.target); 886 var videoId = $wrapper.data('id'); 887 888 if ($wrapper.data('loaded')) return; 889 $wrapper.data('loaded', true); 890 891 // Tạo thumbnail + play button 892 var $thumbnail = $('<img/>', { 893 src: 'https://img.youtube.com/vi/' + videoId + '/hqdefault.jpg', 894 alt: '', 895 loading: 'lazy', 896 class: 'lazy-youtube-thumb' 897 }); 898 var $playBtn = $('<div/>', { class: 'play-btn' }); 899 900 $wrapper.empty().append($thumbnail, $playBtn); 901 902 // Gắn click 1 lần Äá» load iframe vá»i autoplay 903 $wrapper.one('click', function() { 904 var $iframe = $('<iframe/>', { 905 src: 'https://www.youtube.com/embed/' + videoId, 906 frameborder: 0, 907 allow: 'accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture', 908 allowfullscreen: true, 909 width: '100%', 910 height: '100%', 911 loading: 'lazy' 912 }); 913 $wrapper.empty().append($iframe); 914 }); 915 916 obs.unobserve(entry.target); 917 } 918 }); 919 }, { threshold: 0.25 }); 920 921 $lazyVideos.each(function() { 922 observer.observe(this); 923 }); 924 } else { 925 // fallback nếu browser không support IntersectionObserver 926 $lazyVideos.each(function() { 927 var $wrapper = $(this); 928 var videoId = $wrapper.data('id'); 929 var $iframe = $('<iframe/>', { 930 src: 'https://www.youtube.com/embed/' + videoId, 931 frameborder: 0, 932 allowfullscreen: true, 933 width: '100%', 934 height: '100%', 935 loading: 'lazy' 936 }); 937 $wrapper.empty().append($iframe); 938 }); 939 } 940 } 941 942 initLazyYouTube(); 943 944 // Remove .test_img sau 1 giây 945 setTimeout(function() { 946 $('.test_img').remove(); 947 }, 1000); 948 949}); 950// jQuery(document).ready(function($) { 951// $('.header-mode span').on('click', function() { 952// $(this).siblings().removeClass('active'); 953// $(this).addClass('active'); 954// }); 955// });
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.