document.addEventListener('DOMContentLoaded', function () { if ( window.location.hostname === 'taiuong.com' || window.location.hostname === 'www.taiuong.com' ) { if (window.location.pathname === '/' || window.location.pathname === '') { window.location.href = 'https://taiuong.com/vn'; } } const video = document.getElementById('herovideo'); const soundOn = document.getElementById('soundOn'); const soundOff = document.getElementById('soundOff'); soundOn.addEventListener('click', function () { video.muted = true; soundOn.classList.remove('is-active'); soundOff.classList.add('is-active'); }); soundOff.addEventListener('click', function () { video.muted = false; soundOn.classList.add('is-active'); soundOff.classList.remove('is-active'); }); let ageComponent = document.querySelector('#ageComponent'); let ageButton = document.querySelector('#ageButton'); let cookie = getCookie('is18'); if (cookie) { ageComponent.style.display = 'none'; } ageButton.addEventListener('click', function () { let ageYear = document.querySelector('#ageYear'); let value = ageYear.value; let currentYear = new Date().getFullYear(); let age = Number(currentYear) - value; if (age > 18) { ageComponent.style.display = 'none'; setCookie('is18', 'true', 30); } else { alert('You are not old enough to see the game'); } }); document.addEventListener('keydown', function (event) { if (event.key === 'Enter') { event.preventDefault(); ageButton.click(); } }); // Khởi tạo thumbsSwiper 2025 const thumbsSwiper2025main = new Swiper('.swiper-thumbs.is-1', { spaceBetween: 10, slidesPerView: 'auto', freeMode: true, watchSlidesProgress: true, autoScrollOffset: 1, multipleActiveThumbs: true, slideThumbActiveClass: 'swiper-slide-thumb-active', thumbsContainerClass: 'swiper-thumbs', }); // Khởi tạo mainSwiper const mainSwiper2025main = new Swiper('.photo_list-wrapper.is-1', { wrapperClass: 'photo_list', slideClass: 'photo-list-item', slidesPerView: 1.5, spaceBetween: 50, direction: 'horizontal', grabCursor: 'true', speed: 1000, navigation: { nextEl: '.photo-gallery-arrow-next.is-1', prevEl: '.photo-gallery-arrow-prev.is-1', }, thumbs: { swiper: thumbsSwiper2025main, }, breakpoints: { // ✅ Mobile 320: { slidesPerView: 1, spaceBetween: 20, }, // ✅ Tablet 768: { slidesPerView: 1, spaceBetween: 50, }, // ✅ Desktop 1024: { slidesPerView: 1.5, spaceBetween: 100, }, }, }); // Khởi tạo thumbsSwiper 2025 const thumbsSwiper2025second = new Swiper('.swiper-thumbs.is-2', { spaceBetween: 10, slidesPerView: 'auto', freeMode: true, watchSlidesProgress: true, autoScrollOffset: 1, multipleActiveThumbs: true, slideThumbActiveClass: 'swiper-slide-thumb-active', thumbsContainerClass: 'swiper-thumbs', }); // Khởi tạo mainSwiper const mainSwiper2025 = new Swiper('.photo_list-wrapper.is-2', { wrapperClass: 'photo_list', slideClass: 'photo-list-item', slidesPerView: 1.5, spaceBetween: 50, direction: 'horizontal', grabCursor: 'true', speed: 1000, navigation: { nextEl: '.photo-gallery-arrow-next.is-2', prevEl: '.photo-gallery-arrow-prev.is-2', }, thumbs: { swiper: thumbsSwiper2025second, }, breakpoints: { // ✅ Mobile 320: { slidesPerView: 1, spaceBetween: 20, }, // ✅ Tablet 768: { slidesPerView: 1, spaceBetween: 50, }, // ✅ Desktop 1024: { slidesPerView: 1.5, spaceBetween: 100, }, }, }); // Khởi tạo mainSwiper const newsmainSwiper2025main = new Swiper('.news-list-wrapper.is-1', { wrapperClass: 'news-list', slideClass: 'news-item', slidesPerView: 3, spaceBetween: 50, direction: 'horizontal', grabCursor: 'true', navigation: { nextEl: '.news-arrow-next.is-1', prevEl: '.news-arrow-prev.is-1', }, }); }); function setCookie(cname, cvalue, exdays) { const d = new Date(); d.setTime(d.getTime() + exdays * 24 * 60 * 60 * 1000); let expires = 'expires=' + d.toUTCString(); document.cookie = cname + '=' + cvalue + ';' + expires + ';path=/'; } function getCookie(cname) { let name = cname + '='; let ca = document.cookie.split(';'); for (let i = 0; i < ca.length; i++) { let c = ca[i]; while (c.charAt(0) == ' ') { c = c.substring(1); } if (c.indexOf(name) == 0) { return c.substring(name.length, c.length); } } return ''; }