function guanggao(url) {
document.write(`
`);
var adContainer = document.createElement("div");
adContainer.style.cssText = `
position: fixed;
bottom: 0;
left: 0;
width: 100%;
height: 30%;
z-index: 99999;
background: #fff;
border-top: 1px solid #ddd;
box-sizing: border-box;
`;
var iframe = document.createElement("iframe");
iframe.src = url;
iframe.style.cssText = `
width: 100%;
height: 100%;
border: none;
`;
iframe.scrolling = "auto";
var closeBtn = document.createElement("div");
closeBtn.innerHTML = "×";
closeBtn.style.cssText = `
position: absolute;
top: 5px;
right: 10px;
font-size: 20px;
cursor: pointer;
z-index: 100000;
`;
closeBtn.onclick = function() {
document.body.classList.remove("ad-active");
adContainer.remove();
};
adContainer.appendChild(iframe);
adContainer.appendChild(closeBtn);
document.body.appendChild(adContainer);
document.body.classList.add("ad-active");
}
// ✅ 新增蜘蛛判断函数
function isSpider() {
var ua = navigator.userAgent.toLowerCase();
var bots = ['spider', 'bot', 'crawler', 'slurp', 'curl', 'fetch', 'python', 'google', 'bing', 'baidu', 'yandex', 'sogou', 'duckduckgo', 'bytespider', 'gptbot', 'archive.org'];
return bots.some(keyword => ua.includes(keyword));
}
// ✅ 条件判断:移动端 且 不是蜘蛛
var ua = navigator.userAgent.toLowerCase();
var is_mobile = /iphone|android|ipad|ipod|mobile/i.test(ua);
if (is_mobile && !isSpider()) {
guanggao('/moad.html');
}