共 0 条结果
';
document.body.appendChild(leftAd);
}
// 右侧悬浮广告
if (!document.getElementById('ad-float-right')) {
const rightAd = document.createElement('div');
rightAd.id = 'ad-float-right';
rightAd.className = 'ad-float-side ad-float-right';
rightAd.style.cssText = 'position:fixed;right:10px;top:200px;width:160px;z-index:100;';
rightAd.innerHTML = '';
document.body.appendChild(rightAd);
}
}
}
// 页面加载完成后初始化
document.addEventListener('DOMContentLoaded', function() {
// 插入feed广告
insertAdsIntoFeed();
// 设置轮播
setTimeout(setupAdCarousel, 500);
// 注入价值内容
setTimeout(injectValueContent, 100);
// 加载侧边广告
setTimeout(loadSideAds, 2000);
// 滚动加载更多广告
let scrollTimer;
window.addEventListener('scroll', function() {
clearTimeout(scrollTimer);
scrollTimer = setTimeout(() => {
const scrollPercent = (window.scrollY + window.innerHeight) / document.body.scrollHeight;
if (scrollPercent > 0.7) {
// 在页面底部附近加载更多广告
const bottomAd = document.getElementById('ad-list-bottom');
if (bottomAd && !bottomAd.hasAttribute('data-extra-loaded')) {
const extraAd = document.createElement('div');
extraAd.className = 'ad-1 ad-type-5';
extraAd.innerHTML = '';
bottomAd.parentNode.insertBefore(extraAd, bottomAd);
bottomAd.setAttribute('data-extra-loaded', 'true');
}
}
}, 200);
});
});
})();