<?php
/**
 * 播放页
 * rh888av.com
 * SEO 优化：完整的 Schema.org VideoObject 结构化数据、TDK、相关推荐
 */

define('IN_APP', true);

require_once 'config_real.php';
require_once 'includes/common.php';

// 获取参数
$id = isset($_GET['id']) ? intval($_GET['id']) : 0;

if (!$id) {
    redirect('/');
}

// 获取视频信息
$video = getVideoInfo($id);
if (!$video || $video['status'] != 1) {
    header('HTTP/1.1 404 Not Found');
    exit('影片不存在');
}

// 更新点击量
updateHits($id, 'hits');
updateHits($id, 'day_hits');

// 获取分类信息
$category = getCategoryInfo($video['category_id']);

// 获取广告
$play_banner_ads = getAds('play_nav_bottom');
$play_card_ads = getAds('play_card');

// 获取分类路径
function getCategoryPath($id) {
    $path = [];
    while ($id > 0) {
        $cat = getCategoryInfo($id);
        if ($cat) {
            array_unshift($path, $cat);
            $id = $cat['pid'];
        } else {
            break;
        }
    }
    return $path;
}

$breadcrumb = getCategoryPath($video['category_id']);

// 获取集数（如果是电视剧）
$episodes = db()->fetchAll("SELECT * FROM rh_video_episode WHERE video_id=$id ORDER BY sort ASC, episode ASC");

// 获取相关推荐
$related_videos = getVideoList("AND category_id=" . $video['category_id'] . " AND id!=$id", 'RAND()', 12);

// SEO 设置
$seo_title = $video['title'] . ' 在线观看 - ' . getConfig('site_name', 'RH888 影视');
$seo_keywords = $video['keywords'] ?: ($video['title'] . ',在线观看，高清，' . $category['name']);
$seo_description = $video['description'] ?: ('在线观看' . $video['title'] . '，高清画质，流畅播放，' . getConfig('site_name') . '为您提供优质观影体验');

// 结构化数据 - VideoObject
$schema_data = [
    "@context" => "https://schema.org",
    "@type" => "VideoObject",
    "name" => $video['title'],
    "description" => $video['description'] ?: '',
    "thumbnailUrl" => SITE_URL . ($video['cover'] ?: '/assets/images/default-cover.jpg'),
    "uploadDate" => formatDate($video['created_at'], 'Y-m-d'),
    "duration" => 'PT' . str_replace(['小时', '分钟'], ['', 'M'], str_replace('分', 'M', $video['duration'])),
    "actor" => array_map('trim', explode(',', $video['actor'])),
    "director" => $video['director'],
    "genre" => $category['name'],
    "inLanguage" => $video['language'],
    "contentUrl" => SITE_URL . '/play.php?id=' . $id,
    "embedUrl" => SITE_URL . '/play.php?id=' . $id,
    "interactionStatistic" => [
        "@type" => "InteractionCounter",
        "interactionType" => "https://schema.org/WatchAction",
        "userInteractionCount" => $video['hits']
    ]
];

if ($video['year']) {
    $schema_data['dateCreated'] = $video['year'];
}

if ($video['douban_score'] > 0) {
    $schema_data['aggregateRating'] = [
        "@type" => "AggregateRating",
        "ratingValue" => $video['douban_score'],
        "bestRating" => "10",
        "worstRating" => "0"
    ];
}
?>
<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="renderer" content="webkit">
    
    <!-- SEO -->
    <title><?php echo htmlSafe($seo_title); ?></title>
    <meta name="keywords" content="<?php echo htmlSafe($seo_keywords); ?>">
    <meta name="description" content="<?php echo htmlSafe($seo_description); ?>">
    
    <!-- 移动端优化 -->
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="format-detection" content="telephone=no">
    <meta name="applicable-device" content="pc,mobile">
    
    <!-- Canonical URL - 动态获取当前域名 -->
    <link rel="canonical" href="<?php echo (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] === 'on' ? 'https' : 'http') . '://' . $_SERVER['HTTP_HOST'] . seoUrl('video', $id, $video['slug']); ?>">
    
    <!-- Favicon -->
    <link rel="icon" href="/favicon.ico" type="image/x-icon">
    
    <!-- Open Graph for social sharing -->
    <meta property="og:type" content="video.other">
    <meta property="og:title" content="<?php echo htmlSafe($video['title']); ?>">
    <meta property="og:description" content="<?php echo htmlSafe($seo_description); ?>">
    <meta property="og:image" content="<?php echo SITE_URL . ($video['cover'] ?: '/assets/images/default-cover.jpg'); ?>">
    <meta property="og:url" content="<?php echo SITE_URL . seoUrl('video', $id, $video['slug']); ?>">
    
    <!-- 结构化数据 Schema.org VideoObject -->
    <script type="application/ld+json">
    <?php echo json_encode($schema_data, JSON_UNESCAPED_UNICODE | JSON_PRETTY_PRINT); ?>
    </script>
    
    <!-- 样式 -->
    <link rel="stylesheet" href="/assets/css/style.css">
    <link rel="stylesheet" href="/assets/css/player.css">
    
    <!-- 主题切换样式 -->
    <style>
        :root {
            --bg-body: #f5f5f5;
            --bg-card: #ffffff;
            --bg-header: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
            --text-primary: #333333;
            --text-secondary: #666666;
            --text-muted: #999999;
            --border-color: #e0e0e0;
            --shadow-card: 0 2px 10px rgba(0,0,0,0.08);
        }
        
        [data-theme="dark"] {
            --bg-body: #0f0f1a;
            --bg-card: #1a1a2e;
            --bg-header: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
            --text-primary: #eaeaea;
            --text-secondary: #b0b0b0;
            --text-muted: #666666;
            --border-color: #2d2d44;
            --shadow-card: 0 2px 10px rgba(0,0,0,0.3);
        }
        
        body, .header, .section, .video-card, .footer {
            transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease;
        }
        
        .theme-toggle {
            position: fixed;
            bottom: 30px;
            right: 30px;
            width: 56px;
            height: 56px;
            border-radius: 50%;
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
            border: none;
            color: white;
            font-size: 24px;
            cursor: pointer;
            box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
            display: flex;
            align-items: center;
            justify-content: center;
            z-index: 1000;
            transition: all 0.3s ease;
        }
        
        /* 确保视频播放器控件在最上层 */
        .video-player video {
            position: relative;
            z-index: 1001;
        }
        
        .video-player::-webkit-media-controls {
            z-index: 1002 !important;
        }
        
        .theme-toggle:hover {
            transform: scale(1.1) rotate(15deg);
            box-shadow: 0 6px 20px rgba(102, 126, 234, 0.6);
        }
        
        .theme-toggle:active {
            transform: scale(0.95);
        }
    </style>
</head>
<body>
    <!-- 主题切换按钮 -->
    <button class="theme-toggle" id="themeToggle" title="切换主题" aria-label="切换主题">
        <span id="themeIcon">🌙</span>
    </button>
    <!-- 头部导航 -->
    <header class="header">
        <div class="container">
            <div class="header-inner">
                <div class="logo">
                    <a href="/" title="<?php echo htmlSafe(getConfig('site_name')); ?>">
                        <span class="logo-text"><?php echo htmlSafe(getConfig('site_name')); ?></span>
                    </a>
                </div>
                <nav class="nav">
                    <ul class="nav-list">
                        <li class="nav-item"><a href="/">首页</a></li>
                        <?php 
                        $categories = getCategories(0);
                        foreach ($categories as $cat): 
                        ?>
                        <li class="nav-item">
                            <a href="<?php echo seoUrl('category', $cat['id'], $cat['slug']); ?>">
                                <?php echo htmlSafe($cat['name']); ?>
                            </a>
                        </li>
                        <?php endforeach; ?>
                    </ul>
                </nav>
                <div class="search-box">
                    <form action="/search.php" method="get">
                        <input type="text" name="keyword" placeholder="搜索影片..." autocomplete="off">
                        <button type="submit" class="search-btn">搜索</button>
                    </form>
                </div>
                <button class="mobile-menu-btn" aria-label="菜单">
                    <span></span>
                    <span></span>
                    <span></span>
                </button>
            </div>
        </div>
    </header>

    <!-- 移动端导航 -->
    <div class="mobile-nav">
        <div class="mobile-nav-content">
            <ul>
                <li><a href="/">首页</a></li>
                <?php foreach ($categories as $cat): ?>
                <li><a href="<?php echo seoUrl('category', $cat['id'], $cat['slug']); ?>"><?php echo htmlSafe($cat['name']); ?></a></li>
                <?php endforeach; ?>
            </ul>
        </div>
    </div>

    <!-- 主要内容 -->
    <main class="main">
        <!-- 播放页横幅广告（导航栏下方） -->
      <?php
        $play_banner_ads = getAds('play_nav_bottom');
        if (!empty($play_banner_ads)):
        ?>
        
        <div class="nav-ad-container" style="text-align:center;padding:15px 0;background:var(--bg-card);box-shadow:var(--shadow-card);">
            <div class="container">
                <div style="margin:0 auto;max-width:960px;">
                    <?php foreach ($play_banner_ads as $ad): ?>
                        <?php echo nl2br(str_replace(['\r\n', '\r', '\n'], '', stripslashes($ad['code']))); ?>
                    <?php endforeach; ?>
                </div>
            </div>
        </div>
        <?php endif; ?>

        <div class="container">
            <!-- 面包屑导航 -->
            <nav class="breadcrumb">
                <a href="/">首页</a>
                <?php foreach ($breadcrumb as $index => $cat): ?>
                <span class="separator">/</span>
                <?php if ($index == count($breadcrumb) - 1): ?>
                <span class="current"><?php echo htmlSafe($cat['name']); ?></span>
                <?php else: ?>
                <a href="<?php echo seoUrl('category', $cat['id'], $cat['slug']); ?>">
                    <?php echo htmlSafe($cat['name']); ?>
                </a>
                <?php endif; ?>
                <?php endforeach; ?>
            </nav>
        </div>

        <!-- 播放器区域 -->
        <section class="player-section">
            <div class="container">
                <div class="player-wrapper">
                    <!-- 视频播放器 -->
                    <div class="video-player">
                        <?php
                        $video_src = '';
                        $is_m3u8 = false;
                        
                        if ($video['video_url']) {
                            $video_src = $video['video_url'];
                            $is_m3u8 = (strpos($video_src, '.m3u8') !== false || strpos($video_src, 'm3u8') !== false);
                        } elseif ($video['video_file'] && file_exists(UPLOAD_PATH . 'video/' . $video['video_file'])) {
                            $video_src = '/uploads/video/' . $video['video_file'];
                            $is_m3u8 = (strpos($video['video_file'], '.m3u8') !== false);
                        }
                        
                        if ($video_src):
                        ?>
                        <?php if ($is_m3u8): ?>
                        <!-- m3u8 播放器 -->
                        <div id="player-container" style="position:relative;width:100%;height:100%;">
                            <video id="video-player" controls controlsList="nodownload" preload="metadata" poster="<?php echo htmlSafe($video['cover']); ?>"
                                   playsinline webkit-playsinline x5-video-player-type="h5" x5-video-player-fullscreen="true"
                                   style="width:100%;height:100%;position:relative;z-index:100;background:#000;">
                            </video>
                            <!-- 错误提示 -->
                            <div id="player-error" style="display:none;position:absolute;top:0;left:0;right:0;bottom:0;background:linear-gradient(135deg,#667eea0%,#764ba2100%);color:white;flex-direction:column;align-items:center;justify-content:center;text-align:center;padding:20px;z-index:99;">
                                <div style="font-size:60px;margin-bottom:20px;">⚠️</div>
                                <div style="font-size:18px;margin-bottom:10px;">视频加载失败</div>
                                <div style="font-size:14px;opacity:0.8;margin-bottom:20px;">请刷新页面或联系管理员</div>
                                <button onclick="location.reload()" style="padding:10px 30px;background:rgba(255,255,255,0.2);border:1px solid white;color:white;border-radius:6px;cursor:pointer;">刷新页面</button>
                            </div>
                            <!-- 加载中提示 -->
                            <div id="player-loading" style="display:flex;position:absolute;top:0;left:0;right:0;bottom:0;background:rgba(0,0,0,0.7);color:white;align-items:center;justify-content:center;text-align:center;padding:20px;z-index:98;">
                                <div style="font-size:16px;">视频加载中...</div>
                            </div>
                        </div>
                        <script src="https://cdn.jsdelivr.net/npm/hls.js@latest/dist/hls.min.js"></script>
                        <script>
                        (function() {
                            var video = document.getElementById('video-player');
                            var errorDiv = document.getElementById('player-error');
                            var loadingDiv = document.getElementById('player-loading');
                            var videoSrc = '<?php echo htmlSafe($video_src); ?>';
                            var loadTimeout = null;
                            
                            // 显示错误提示
                            function showPlayerError(msg) {
                                if (loadingDiv) loadingDiv.style.display = 'none';
                                if (errorDiv) {
                                    errorDiv.style.display = 'flex';
                                    if (msg) {
                                        errorDiv.querySelector('div:nth-child(2)').textContent = msg;
                                    }
                                }
                                console.error('视频播放错误:', msg);
                            }
                            
                            // 隐藏加载提示
                            function hideLoading() {
                                if (loadingDiv) loadingDiv.style.display = 'none';
                            }
                            
                            // 设置加载超时（15 秒）
                            loadTimeout = setTimeout(function() {
                                showPlayerError('视频加载超时，请检查网络连接');
                            }, 15000);
                            
                            // 检测是否为移动端设备
                            var isMobile = /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent);
                            
                            // 检测是否支持原生 HLS（iOS Safari 等）
                            var canPlayNativeHLS = video.canPlayType('application/vnd.apple.mpegurl');
                            
                            // 移动端优先使用原生 HLS 播放
                            if (isMobile && canPlayNativeHLS) {
                                console.log('使用原生 HLS 播放（移动端优化）');
                                video.src = videoSrc;
                                video.addEventListener('loadedmetadata', function() {
                                    clearTimeout(loadTimeout);
                                    hideLoading();
                                    console.log('视频元数据加载成功');
                                    // 移动端需要用户点击才能播放
                                    video.play().catch(function(e) {
                                        console.log('等待用户交互后播放');
                                    });
                                });
                                video.addEventListener('canplay', function() {
                                    hideLoading();
                                });
                                video.addEventListener('error', function(e) {
                                    clearTimeout(loadTimeout);
                                    var error = video.error;
                                    var errorMsg = '视频加载失败';
                                    if (error) {
                                        switch(error.code) {
                                            case 1: errorMsg = '视频加载已中断'; break;
                                            case 2: errorMsg = '网络错误，请检查连接'; break;
                                            case 3: errorMsg = '视频解码失败'; break;
                                            case 4: errorMsg = '不支持的视频格式'; break;
                                        }
                                    }
                                    showPlayerError(errorMsg);
                                });
                            } else if (typeof Hls !== 'undefined' && Hls.isSupported()) {
                                // 使用 Hls.js（桌面端）
                                console.log('使用 Hls.js 播放');
                                var hls = new Hls({
                                    enableWorker: true,
                                    autoStartLoad: true,
                                    startPosition: -1,
                                    manifestLoadingTimeOut: 10000,
                                    manifestLoadingMaxRetry: 3,
                                    levelLoadingTimeOut: 10000,
                                    levelLoadingMaxRetry: 3
                                });
                                
                                hls.loadSource(videoSrc);
                                hls.attachMedia(video);
                                
                                hls.on(Hls.Events.MANIFEST_PARSED, function() {
                                    clearTimeout(loadTimeout);
                                    hideLoading();
                                    console.log('HLS 清单加载成功');
                                    video.play().catch(function(e) {
                                        console.log('等待用户交互后播放');
                                    });
                                });
                                
                                hls.on(Hls.Events.ERROR, function(event, data) {
                                    console.error('HLS 错误:', data);
                                    if (data.fatal) {
                                        switch(data.type) {
                                            case Hls.ErrorTypes.NETWORK_ERROR:
                                                console.error('网络错误，尝试恢复...');
                                                hls.startLoad();
                                                break;
                                            case Hls.ErrorTypes.MEDIA_ERROR:
                                                console.error('媒体错误，尝试恢复...');
                                                hls.recoverMediaError();
                                                break;
                                            default:
                                                clearTimeout(loadTimeout);
                                                showPlayerError('视频格式不支持');
                                                break;
                                        }
                                    }
                                });
                            } else {
                                // 都不支持
                                showPlayerError('您的浏览器不支持播放此视频');
                            }
                        })();
                        </script>
                        <?php else: ?>
                        <!-- MP4 等普通视频 -->
                        <video controls preload="metadata" poster="<?php echo htmlSafe($video['cover']); ?>"
                               playsinline webkit-playsinline>
                            <source src="<?php echo htmlSafe($video_src); ?>" type="video/mp4">
                            您的浏览器不支持视频播放
                        </video>
                        <?php endif; ?>
                        <?php else: ?>
                        <!-- 默认播放器界面 -->
                        <div class="player-placeholder">
                            <div class="placeholder-icon">🎬</div>
                            <p>视频资源准备中</p>
                            <p class="placeholder-hint">请稍后再试或联系管理员</p>
                        </div>
                        <?php endif; ?>
                    </div>

                    <!-- 集数选择（电视剧） -->
                    <?php if ($episodes): ?>
                    <div class="episode-selector">
                        <h3 class="episode-title">选择集数</h3>
                        <div class="episode-list">
                            <?php foreach ($episodes as $ep): ?>
                            <a href="#" class="episode-item <?php echo $ep['id'] == ($episodes[0]['id'] ?? 0) ? 'active' : ''; ?>"
                               data-url="<?php echo htmlSafe($ep['video_url'] ?: '/uploads/video/' . $ep['video_file']); ?>">
                                第<?php echo $ep['episode']; ?>集
                            </a>
                            <?php endforeach; ?>
                        </div>
                    </div>
                    <?php endif; ?>
                </div>
                
                <!-- 视频信息 -->
                <div class="video-info-section">
                    <h1 class="video-main-title"><?php echo htmlSafe($video['title']); ?></h1>
                    
                    <div class="video-meta-info">
                        <span class="meta-item">
                            <strong>分类：</strong>
                            <a href="<?php echo seoUrl('category', $category['id'], $category['slug']); ?>">
                                <?php echo htmlSafe($category['name']); ?>
                            </a>
                        </span>
                        <span class="meta-item">
                            <strong>年份：</strong><?php echo $video['year']; ?>
                        </span>
                        <span class="meta-item">
                            <strong>地区：</strong><?php echo htmlSafe($video['area']); ?>
                        </span>
                        <span class="meta-item">
                            <strong>语言：</strong><?php echo htmlSafe($video['language']); ?>
                        </span>
                        <span class="meta-item">
                            <strong>时长：</strong><?php echo htmlSafe($video['duration']); ?>
                        </span>
                        <?php if ($video['douban_score'] > 0): ?>
                        <span class="meta-item">
                            <strong>评分：</strong>
                            <span class="score-star"><?php echo $video['douban_score']; ?></span>
                        </span>
                        <?php endif; ?>
                        <span class="meta-item">
                            <strong>播放：</strong><?php echo number_format($video['hits']); ?>
                        </span>
                    </div>
                    
                    <div class="video-actors">
                        <?php if ($video['director']): ?>
                        <p><strong>导演：</strong><?php echo htmlSafe($video['director']); ?></p>
                        <?php endif; ?>
                        <?php if ($video['actor']): ?>
                        <p><strong>主演：</strong><?php echo htmlSafe($video['actor']); ?></p>
                        <?php endif; ?>
                    </div>
                    
                    <div class="video-content">
                        <h3>剧情简介</h3>
                        <p><?php echo nl2br(htmlSafe($video['description'] ?: '暂无剧情简介')); ?></p>
                    </div>
                    
                    <!-- 分享按钮 -->
                    <div class="share-buttons">
                        <span>分享到：</span>
                        <button class="share-btn" data-type="weixin">微信</button>
                        <button class="share-btn" data-type="weibo">微博</button>
                        <button class="share-btn" data-type="qq">QQ</button>
                        <button class="share-btn" data-type="copy" onclick="copyUrl()">复制链接</button>
                    </div>
                </div>
            </div>
        </section>

        <!-- 相关推荐 -->
        <section class="section related-section">
            <div class="container">
                <div class="section-header">
                    <h2 class="section-title">
                        <span class="title-icon">★</span>
                        相关推荐
                    </h2>
                </div>
                <div class="video-grid">
                    <?php
                    $ad_index = 0;
                    $videos_per_ad = 4; // 每 4 个视频显示 1 个广告
                    foreach ($related_videos as $index => $rel_video):
                        // 从第 1 个开始，每 4 个视频插入广告
                        if ($index % $videos_per_ad == 0 && !empty($play_card_ads)):
                            $ad = $play_card_ads[$ad_index % count($play_card_ads)];
                    ?>
                    <!-- 播放页卡片广告 -->
                    <div class="video-card ad-card">
                        <a href="<?php echo !empty($ad['link']) ? htmlSafe($ad['link']) : '#'; ?>" class="video-cover" style="background:#f0f0f0;">
                            <?php echo str_replace(['\\r\\n', '\\r', '\\n', '\r\n', '\r', '\n', 'rn'], '', stripslashes($ad['code'])); ?>
                        </a>
                        <div class="video-info">
                            <h3 class="video-title">
                                <a href="<?php echo !empty($ad['link']) ? htmlSafe($ad['link']) : '#'; ?>">
                                    <?php echo htmlSafe(!empty($ad['title']) ? $ad['title'] : '广告推广'); ?>
                                </a>
                            </h3>
                            <p class="video-meta">
                                <span class="year">广告</span>
                                <span class="score">查看详情</span>
                            </p>
                        </div>
                    </div>
                    <?php
                            $ad_index++;
                        endif;
                    ?>
                    <div class="video-card">
                        <a href="<?php echo seoUrl('video', $rel_video['id'], $rel_video['slug']); ?>" class="video-cover">
                            <img src="<?php echo htmlSafe($rel_video['cover'] ?: '/assets/images/default-cover.jpg'); ?>" 
                                 alt="<?php echo htmlSafe($rel_video['title']); ?>"
                                 loading="lazy">
                            <div class="video-overlay">
                                <span class="play-icon">▶</span>
                            </div>
                        </a>
                        <div class="video-info">
                            <h3 class="video-title">
                                <a href="<?php echo seoUrl('video', $rel_video['id'], $rel_video['slug']); ?>">
                                    <?php echo htmlSafe(cutStr($rel_video['title'], 18)); ?>
                                </a>
                            </h3>
                            <p class="video-meta">
                                <span class="year"><?php echo $rel_video['year']; ?></span>
                                <span class="hits">播放：<?php echo number_format($rel_video['hits']); ?></span>
                            </p>
                        </div>
                    </div>
                    <?php endforeach; ?>
                </div>
            </div>
        </section>
    </main>

    <!-- 页脚 -->
    <footer class="footer">
        <div class="container">
            <div class="footer-content">
                <div class="footer-links">
                    <a href="/about.html">关于我们</a>
                    <a href="/contact.html">联系我们</a>
                    <a href="/copyright.html">版权声明</a>
                </div>
                <div class="footer-info">
                    <p>© <?php echo date('Y'); ?> <?php echo htmlSafe(getConfig('site_name')); ?> All Rights Reserved.</p>
                </div>
            </div>
        </div>
    </footer>

    <!-- 返回顶部 -->
    <a href="#" class="back-to-top">↑</a>

    <!-- 统计代码 -->
    <?php 
    $site_stat = getConfig('site_stat', '');
    if (!empty($site_stat)) {
        echo $site_stat;
    }
    ?>

    <!-- JavaScript -->
    <script src="/assets/js/main.js"></script>
    <script src="/assets/js/player.js"></script>
    
    <script>
    // 复制 URL 功能
    function copyUrl() {
        const url = window.location.href;
        const input = document.createElement('input');
        input.value = url;
        document.body.appendChild(input);
        input.select();
        document.execCommand('copy');
        document.body.removeChild(input);
        alert('链接已复制到剪贴板！');
    }
    </script>
</body>
</html>
