地址发布页源码
2024年10月27日 153

代码

17300157761352354779524746774996.webp

<!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">
    <title> 测试页</title>
    <link rel="stylesheet" href="https://cdnjs.admincdn.com/font-awesome/5.15.3/css/all.min.css">
    <style>
        @font-face {
            font-family: 'HarmonyOS Sans SC';
            src: url('/diy/ziti/HarmonyOS_Sans_SC_Regular.woff2') format('woff2');
            font-weight: normal;
            font-style: normal;
        }
        :root {
            --primary-color: #3b82f6;
            --secondary-color: #60a5fa;
            --text-color: #1f2937;
            --card-background: rgba(255, 255, 255, 0.9);
            --transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
            --background-light: linear-gradient(-45deg, #e6f2ff, #fff0f5, #f0f7ff, #fff5e6);
            --background-dark: linear-gradient(-45deg, #1a202c, #2d3748, #4a5568, #2d3748);
        }
        .dark-mode {
            --primary-color: #60a5fa;
            --secondary-color: #3b82f6;
            --text-color: #e2e8f0;
            --card-background: rgba(26, 32, 44, 0.9);
        }
        * {
            box-sizing: border-box;
            margin: 0;
            padding: 0;
        }
        body {
            font-family: 'HarmonyOS Sans SC', sans-serif;
            color: var(--text-color);
            line-height: 1.6;
            min-height: 100vh;
            display: flex;
            justify-content: center;
            align-items: center;
            background: var(--background-light);
            background-size: 400% 400%;
            animation: gradientBG 15s ease infinite;
            overflow-x: hidden;
            font-size: 16px;
            transition: var(--transition);
        }
        body.dark-mode {
            background: var(--background-dark);
        }
        @keyframes gradientBG {
            0% { background-position: 0% 50%; }
            50% { background-position: 100% 50%; }
            100% { background-position: 0% 50%; }
        }
        .wrapper {
            padding: 2rem;
            width: 100%;
            max-width: 600px;
            position: relative;
        }
        .main {
            background-color: var(--card-background);
            border-radius: 20px;
            box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
            padding: 2.5rem;
            backdrop-filter: blur(10px);
            transition: var(--transition);
        }
        .main:hover {
            box-shadow: 0 15px 35px rgba(0, 0, 0, 0.15);
        }
        h1 {
            font-size: 2.5rem;
            color: var(--primary-color);
            text-align: center;
            margin-bottom: 1.5rem;
            font-weight: 700;
        }
        ul {
            list-style-type: none;
            margin-bottom: 1.5rem;
        }
        li {
            margin-bottom: 1rem;
            padding: 1rem;
            background-color: rgba(248, 250, 252, 0.8);
            border-radius: 10px;
            transition: var(--transition);
            cursor: pointer;
            position: relative;
            padding-top: 1.5rem;
        }
        .dark-mode li {
            background-color: rgba(26, 32, 44, 0.8);
        }
        li:hover {
            transform: translateY(-3px);
            box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
        }
        li a {
            color: var(--primary-color);
            text-decoration: none;
            font-weight: bold;
            transition: var(--transition);
            display: flex;
            align-items: center;
        }
        li a:hover {
            color: var(--secondary-color);
        }
        li a i {
            margin-right: 0.5rem;
            font-size: 1.2em;
        }
        .notice {
            background-color: rgba(230, 242, 255, 0.8);
            border-left: 4px solid var(--primary-color);
            padding: 1rem;
            margin-top: 1rem;
            border-radius: 10px;
            transition: var(--transition);
        }
        .dark-mode .notice {
            background-color: rgba(44, 55, 72, 0.8);
        }
        .notice:hover {
            background-color: rgba(230, 242, 255, 1);
        }
        .dark-mode .notice:hover {
            background-color: rgba(44, 55, 72, 1);
        }
        .footer {
            margin-top: 2rem;
            text-align: center;
            color: var(--text-color);
            font-weight: 300;
            opacity: 0.8;
            transition: var(--transition);
        }
        .footer:hover {
            opacity: 1;
        }
        .bookmark-btn {
            display: block;
            width: 100%;
            padding: 1rem;
            background-color: var(--primary-color);
            color: white;
            text-align: center;
            border: none;
            border-radius: 10px;
            font-size: 1rem;
            font-weight: 600;
            cursor: pointer;
            transition: var(--transition);
            margin-bottom: 1.5rem;
            position: relative;
            overflow: hidden;
        }
        .bookmark-btn:hover {
            background-color: var(--secondary-color);
            transform: translateY(-2px);
            box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
        }
        .bookmark-btn::after {
            content: '';
            position: absolute;
            top: 50%;
            left: 50%;
            width: 5px;
            height: 5px;
            background: rgba(255, 255, 255, 0.5);
            opacity: 0;
            border-radius: 100%;
            transform: scale(1, 1) translate(-50%);
            transform-origin: 50% 50%;
        }
        .bookmark-btn:focus:not(:active)::after {
            animation: ripple 1s ease-out;
        }
        @keyframes ripple {
            0% { transform: scale(0, 0); opacity: 1; }
            20% { transform: scale(25, 25); opacity: 1; }
            100% { opacity: 0; transform: scale(40, 40); }
        }
        .bg-animation {
            position: fixed;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            z-index: -1;
        }
        .bg-animation span {
            position: absolute;
            display: block;
            width: 20px;
            height: 20px;
            background: rgba(255, 255, 255, 0.2);
            animation: move 25s infinite linear;
        }
        .dark-mode .bg-animation span {
            background: rgba(255, 255, 255, 0.1);
        }
        .bg-animation span:nth-child(1) { top: 20%; left: 20%; animation-duration: 15s; }
        .bg-animation span:nth-child(2) { top: 60%; left: 80%; animation-duration: 17s; width: 40px; height: 40px; }
        .bg-animation span:nth-child(3) { top: 40%; left: 40%; animation-duration: 19s; }
        .bg-animation span:nth-child(4) { top: 80%; left: 10%; animation-duration: 21s; }
        @keyframes move {
            0% { transform: translateX(0) translateY(0) rotate(0); opacity: 1; border-radius: 0; }
            100% { transform: translateX(-1000px) translateY(-1000px) rotate(720deg); opacity: 0; border-radius: 50%; }
        }
        @media (max-width: 768px) {
            body {
                font-size: calc(14px + 0.390625vw);
            }
            .main {
                padding: 2rem;
            }
            h1 {
                font-size: 2rem;
            }
        }
        .ms-display {
            position: absolute;
            top: 0;
            left: 0;
            font-size: 0.7em;
            padding: 2px 5px;
            border-top-left-radius: 10px;
            border-bottom-right-radius: 10px;
            background-color: rgba(255, 255, 255, 0.8);
            color: #333;
        }
        .status-badge {
            position: absolute;
            top: 0;
            right: 0;
            font-size: 0.7em;
            padding: 2px 5px;
            border-top-right-radius: 10px;
            border-bottom-left-radius: 10px;
            background-color: rgba(255, 255, 255, 0.8);
        }
        .status-normal {
            background-color: #86efac;
            color: #14532d;
        }
        .status-error {
            background-color: #fda4af;
            color: #7f1d1d;
        }
        .ms-normal {
            background-color: #bbf7d0;
            color: #14532d;
        }
        .ms-error {
            background-color: #fecdd3;
            color: #7f1d1d;
        }
        .status-checking {
            background-color: rgba(0, 0, 0, 0.1);
            color: #333;
        }
        /* Add new class to display the URL */
        .url-display {
            font-size: 0.85em;
            color: #555;
            margin-top: 0.25rem;
            word-break: break-all;
        }
        /* Styling for the footer status section */
        .footer-status {
            font-size: 1rem;
            color: var(--primary-color);
            font-weight: bold;
            display: flex;
            justify-content: center;
            gap: 1rem;
            margin-top: 1rem;
        }
        .footer-status span {
            display: flex;
            align-items: center;
        }
        .footer-status .time {
            color: #333;
        }
        .footer-status .accessible {
            color: #16a34a;
        }
        .footer-status .inaccessible {
            color: #dc2626;
        }
        .footer-status .dot {
            display: inline-block;
            width: 10px;
            height: 10px;
            margin-right: 5px;
            border-radius: 50%;
        }
        .footer-status .dot.accessible {
            background-color: #16a34a;
        }
        .footer-status .dot.inaccessible {
            background-color: #dc2626;
        }
    </style>
</head>
<body>
    <div class="wrapper">
        <div class="main">
            <h1> 测试页</h1>
            <button class="bookmark-btn" onclick="showBookmarkHint()">
                <i class="fas fa-bookmark"></i> Ctrl+D 收藏本页
            </button>
            <div class="footer">
                <div class="footer-status">
                    <span class="accessible"><span class="dot accessible"></span> 可访问:<span id="accessible-count">0</span></span>
                    <span class="inaccessible"><span class="dot inaccessible"></span> 无法访问:<span id="inaccessible-count">0</span></span>
                </div>
            </div>
            <ul id="url-list">
                <li data-url="https://baidu.com">
                    <span class="ms-display"></span>
                    <span class="status-badge"> 检测中...</span>
                    <a href="https://baidu.com" target="_blank"><i class="fas fa-link"></i> 地址 1</a>
                    <div class="url-display"> <!-- Display URL below -->
                </li>
                <li data-url="https://cn.bing.com">
                    <span class="ms-display"></span>
                    <span class="status-badge"> 检测中...</span>
                    <a href="https://cn.bing.com" target="_blank"><i class="fas fa-link"></i> 地址 2</a>
                    <div class="url-display"> <!-- Display URL below -->
                </li>
                <li data-url="https://Google.com">
                    <span class="ms-display"></span>
                    <span class="status-badge"> 检测中...</span>
                    <a href="https://Google.com" target="_blank"><i class="fas fa-link"></i> 地址 3</a>
                    <div class="url-display"> <!-- Display URL below -->
                </li>
            </ul>
            <div class="notice">...</div>
        </div>
        <div class="bg-animation">
            <span></span><span></span><span></span><span></span>
        </div>
    </div>

    <script>
        function showBookmarkHint() {
            alert("请按 Ctrl+D 将此页面加入书签!");
        }

        function updateUrlStatus(li, isAccessible, duration) {
            const statusBadge = li.querySelector('.status-badge');
            const msDisplay = li.querySelector('.ms-display');
            li.classList.remove('disabled');

            let statusClass;
            if (isAccessible) {
                statusBadge.textContent = '正常';
                statusClass = 'status-normal';
            } else {
                li.classList.add('disabled');
                statusBadge.textContent = '无法访问';
                statusClass = 'status-error';
            }

            statusBadge.className = `status-badge ${statusClass}`;
            msDisplay.textContent = `${duration}ms`;
            msDisplay.className = `ms-display ms-${statusClass.split('-')[1]}`;
        }

        function checkUrl(url, li) {
            return new Promise((resolve) => {
                const img = new Image();
                let isResolved = false;
                const startTime = performance.now();

                const timeoutId = setTimeout(() => {
                    if (!isResolved) {
                        updateUrlStatus(li, false, 9999);
                        isResolved = true;
                        resolve(false);
                    }
                }, 3000);

                img.onload = function() {
                    if (!isResolved) {
                        clearTimeout(timeoutId);
                        const endTime = performance.now();
                        const duration = Math.round(endTime - startTime);
                        updateUrlStatus(li, true, duration);
                        isResolved = true;
                        resolve(true);
                    }
                };

                img.onerror = function() {
                    if (!isResolved) {
                        clearTimeout(timeoutId);
                        const endTime = performance.now();
                        const duration = Math.round(endTime - startTime);
                        updateUrlStatus(li, false, duration);
                        isResolved = true;
                        resolve(false);
                    }
                };

                img.src = `${url}/favicon.ico?${new Date().getTime()}`;
            });
        }

        async function checkAllUrls() {
            const urlList = document.getElementById('url-list');
            const listItems = urlList.querySelectorAll('li');
            let accessibleCount = 0;
            let inaccessibleCount = 0;

            const checkPromises = Array.from(listItems).map(li => {
                const url = li.dataset.url;
                li.querySelector('.status-badge').textContent = '检测中...';
                li.querySelector('.status-badge').classList.add('status-checking');
                return checkUrl(url, li);
            });

            const results = await Promise.all(checkPromises);
            results.forEach(isAccessible => {
                if (isAccessible) {
                    accessibleCount++;
                } else {
                    inaccessibleCount++;
                }
            });

            updateLastCheckedTimeAndStats(accessibleCount, inaccessibleCount);
        }

        function updateLastCheckedTimeAndStats(accessibleCount, inaccessibleCount) {
            const now = new Date();
            const timeString = `${now.getHours()}:${now.getMinutes()}:${now.getSeconds()}`;
            document.getElementById('accessible-count').textContent = accessibleCount;
            document.getElementById('inaccessible-count').textContent = inaccessibleCount;
        }

        checkAllUrls();
    </script>
</body>
</html>

- End -




0 条评论
  • 表情
  • 游客你好,回复内容需要 登录 查看!