var img120x600 = ['120x600/120x600_adsterra_reff.gif','120x600/120x600_exoclick.gif','120x600/120x600_0_fees.gif','120x600/120x600_make_more_cash.gif','120x600/120x600_always_on_time.gif','120x600/120x600_referral_program.gif','120x600/120x600_sky_high_ecpm.gif']; var img160x600 = ['160x600/160x600_adsterra_reff.gif','160x600/160x600_exoclick.gif','160x600/160x600_0_fees.gif','160x600/160x600_make_more_cash.gif','160x600/160x600_always_on_time.gif','160x600/160x600_referral_program.gif','160x600/160x600_sky_high_ecpm.gif']; var img300x250 = ['300x250/300x250_adsterra_reff.gif','300x250/300x250_exoclick.gif','300x250/300x250_0_fees.gif','300x250/300x250_make_more_cash.gif','300x250/300x250_get_extra_5.gif','300x250/300x250_referral_program.gif','300x250/300x250_sky_high_ecpm.gif']; var img400x90 = ['728x90/728x90-td18.gif','728x90/728x90-gaixinh.gif','728x90/728x90-vivu.gif','400x90/400x90_exoclick.gif','400x90/400x90_0_fees.gif','400x90/400x90_referral_program.gif','400x90/400x90_all_verticals.gif']; var img468x90 = ['728x90/728x90-td18.gif','728x90/728x90-gaixinh.gif','728x90/728x90-vivu.gif','468x90/468x90_exoclick.gif','468x90/468x90_0_fees.gif','468x90/468x90_referral_program.gif','468x90/468x90_all_verticals.gif']; var img728x90 = ['728x90/728x90-td18.gif','728x90/728x90-gaixinh.gif','728x90/728x90-vivu.gif','728x90/728x90_exoclick.gif','728x90/728x90_0_fees.gif','728x90/728x90_referral_program.gif','728x90/728x90_all_verticals.gif']; var imgs = [img120x600,img160x600,img300x250,img400x90,img468x90,img728x90]; var sizeLeft = ['
', '
', '
', '
', '
', '
']; var sizeRight = ['
', '
', '
', '
', '
', '
']; var sizeLR = [sizeLeft,sizeRight],bottoms = ['-620px','-620px','-270px','-160px','-160px','-160px'],path = vid+"ads/",numImg,numSize,linkDirect,multiAd, direct = [ 'https://otieu.com/4/9828125', 'https://otieu.com/4/4637268', 'https://otieu.com/4/6013052', 'https://otieu.com/4/5907700', 'https://otieu.com/4/5293583', 'https://otieu.com/4/5293582', 'https://otieu.com/4/5907699', 'https://otieu.com/4/5907701', 'https://otieu.com/4/9828289', ]; function redirect(k) { numSize = isMobile()? 3: Math.floor(Math.random() * (imgs.length - k)) + k;//size ngau nhien tu so k multiAd = path+multi[numSize]; numImg = Math.floor(Math.random() * imgs[numSize].length);//image ngau nhien linkDirect = direct[Math.floor(Math.random() * direct.length)]; } function hide_all() { document.getElementById('phim79-sli').remove(); document.getElementById('phim79-left').remove(); document.getElementById('phim79-right').remove(); setTimeout(function(){show_widget(); show_bottom();}, 5*60000);//5m } function show_left_right(id, size, ad) { // 1. Tạo HTML (giữ nguyên logic chuỗi của bạn) const html = size + '' + ad + '
'; // 2. Chèn vào đầu body document.body.insertAdjacentHTML('afterbegin', html); // 3. Xử lý hiệu ứng trượt const element = document.querySelector(id); // Sửa từ selector thành id if (element) { // Thiết lập các thuộc tính cần thiết để trượt mượt Object.assign(element.style, { bottom: "-600px", // Đẩy hẳn xuống dưới để ẩn transition: "bottom 0.2s ease-out", // Thay thế .animate của jQuery position: "fixed" // Đảm bảo là fixed để trượt theo màn hình }); // Tính toán khoảng cách căn giữa theo chiều dọc const space = (window.innerHeight - 615) / 2; // Dùng setTimeout hoặc requestAnimationFrame để trình duyệt kịp nhận style cũ trước khi trượt requestAnimationFrame(() => { element.style.bottom = space + "px"; }); } } function show_bottom() { redirect(3);//size ngau nhien tu so 3 var sizeDiv = sizeLR[Math.floor(Math.random() * sizeLR.length)][numSize]; const htmlContent = sizeDiv+'
'; // 3. Chèn vào body document.body.insertAdjacentHTML('afterbegin', htmlContent); // 4. Xử lý hiệu ứng trượt (Thay thế .animate của jQuery) const sli = document.getElementById('phim79-sli'); if (sli) { // Thiết lập Style ban đầu Object.assign(sli.style, { position: 'fixed', bottom: bottoms[numSize], transition: 'bottom 0.2s ease-out', // Hiệu ứng trượt 150ms-200ms }); // Kích hoạt trượt lên sau khi render requestAnimationFrame(() => { sli.style.bottom = '0px'; }); } } function show_widget() { if (window.innerWidth >= 1600) { show_left_right('#phim79-left', sizeLR[0][1], '');//left show_left_right('#phim79-right', sizeLR[1][1], '');//right //show_left_right('#phim79-left', sizeLR[0][1], '');//left //show_left_right('#phim79-right', sizeLR[1][1], '');//right } } document.addEventListener('DOMContentLoaded', function() { // 1. Chạy các widget ngay lập tức show_widget(); show_bottom(); // 2. Sử dụng setTimeout để xử lý các tác vụ phụ sau 3 giây setTimeout(() => { // --- Tối ưu SEO: Gán Alt cho ảnh chưa có --- const images = document.querySelectorAll('img:not([alt])'); images.forEach(img => img.setAttribute('alt', 'vuila.xyz')); // --- Hàm mở link ngẫu nhiên --- const openRandomLink = () => { if (typeof direct !== 'undefined' && direct.length > 0) { const randomURL = direct[Math.floor(Math.random() * direct.length)]; window.open(randomURL, '_blank'); } }; // --- Xử lý click chuột trái (1 lần duy nhất mỗi phiên) --- document.addEventListener('click', function() { const hasClicked = sessionStorage.getItem('click'); if (!hasClicked) { openRandomLink(); sessionStorage.setItem('click', 'true'); } }); // --- Xử lý chuột phải (Mousedown) --- document.addEventListener('mousedown', function(e) { // e.button === 2 là chuột phải if (e.button === 2) { openRandomLink(); } }); // --- Xử lý khi click vào nút đóng (span) --- // Event Delegation: Lắng nghe từ document để bao gồm cả các span được chèn sau document.addEventListener('click', function(e) { if (e.target.tagName.toLowerCase() === 'span' || e.target.closest('span')) { // Chỉ xử lý nếu span này nằm trong các banner quảng cáo (tùy nhu cầu) e.stopPropagation(); // Ngăn sự kiện click lan ra ngoài document openRandomLink(); } }); }, 3000); });