1) 分片上传(routes/chunked.py) - POST /api/upload/init 建会话,校验表单/字段/扩展名/体积 - POST /api/upload/chunk 单片上传,幂等可重传,http body 直写磁盘 - GET /api/upload/status 查询已收分片 - POST /api/upload/complete 按序合并 + sha256 校验 + 清理分片 - /api/submit 新增 field fileTokens 挂载已上传文件(零拷贝 os.replace) - 过期会话(24h)由定时任务清理 2) 弱网下的样式可靠性 - Tailwind Play CDN / GSAP 改为本地自托管(static/js/vendor/) - vendor 资源 1 年 immutable 缓存,自家 css/js 1 小时 - CSS link 失败自动带 ?r= 重试一次 - status 页加关键内联样式兜底,极端情况下仍可读 3) 大文件落盘沿用流式写入(无 400MB 内存峰值)
563 lines
26 KiB
HTML
563 lines
26 KiB
HTML
<!DOCTYPE html>
|
|
<html lang="zh-CN" class="light">
|
|
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
<title>502 Bad Gateway</title>
|
|
|
|
<!-- Tailwind CSS (CDN) -->
|
|
<script src="/static/js/vendor/tailwind-play.js"></script>
|
|
<script>
|
|
tailwind.config = {
|
|
darkMode: 'class',
|
|
theme: {
|
|
extend: {
|
|
fontFamily: {
|
|
sans: ['Inter', 'sans-serif'],
|
|
serif: ['Playfair Display', 'serif'],
|
|
mono: ['SF Mono', 'monospace'],
|
|
},
|
|
colors: {
|
|
neutral: {
|
|
50: '#fafafa',
|
|
100: '#f5f5f5',
|
|
200: '#e5e5e5',
|
|
300: '#d4d4d4',
|
|
400: '#a3a3a3',
|
|
500: '#737373',
|
|
600: '#525252',
|
|
700: '#404040',
|
|
800: '#262626',
|
|
900: '#171717',
|
|
}
|
|
},
|
|
animation: {
|
|
'float': 'float 6s ease-in-out infinite',
|
|
'pulse-slow': 'pulse 4s cubic-bezier(0.4, 0, 0.6, 1) infinite',
|
|
'glitch': 'glitch 1s linear infinite',
|
|
},
|
|
keyframes: {
|
|
float: {
|
|
'0%, 100%': { transform: 'translateY(0px)' },
|
|
'50%': { transform: 'translateY(-20px)' },
|
|
},
|
|
glitch: {
|
|
'2%, 64%': { transform: 'translate(2px,0) skew(0deg)' },
|
|
'4%, 60%': { transform: 'translate(-2px,0) skew(0deg)' },
|
|
'62%': { transform: 'translate(0,0) skew(5deg)' },
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
</script>
|
|
|
|
<!-- GSAP (CDN) -->
|
|
<script src="/static/js/vendor/gsap.min.js"></script>
|
|
|
|
<!-- 鍐呰仈 CSS锛圕SS 鍙橀噺 + 涓撳睘鏍峰紡锛?-->
|
|
<style>
|
|
/* ========== CSS 鍙橀噺锛堢户鎵胯嚜鍘熺郴缁燂級 ========== */
|
|
:root {
|
|
--bg-primary: #fafafa;
|
|
--bg-secondary: #ffffff;
|
|
--text-primary: #171717;
|
|
--text-secondary: #525252;
|
|
--text-muted: #737373;
|
|
--border-color: #e5e5e5;
|
|
--accent-bg: #171717;
|
|
--accent-text: #ffffff;
|
|
--glass-bg: rgba(255, 255, 255, 0.7);
|
|
--glass-border: rgba(255, 255, 255, 0.5);
|
|
--glass-hover: rgba(255, 255, 255, 0.9);
|
|
--shadow-color: rgba(0, 0, 0, 0.05);
|
|
--error-bg: #fef2f2;
|
|
--error-border: #fee2e2;
|
|
--error-text: #dc2626;
|
|
--warning-bg: #fffbeb;
|
|
--warning-border: #fef3c7;
|
|
--warning-text: #d97706;
|
|
}
|
|
|
|
.dark {
|
|
--bg-primary: #0a0a0a;
|
|
--bg-secondary: #171717;
|
|
--text-primary: #fafafa;
|
|
--text-secondary: #a3a3a3;
|
|
--text-muted: #737373;
|
|
--border-color: #262626;
|
|
--accent-bg: #fafafa;
|
|
--accent-text: #171717;
|
|
--glass-bg: rgba(23, 23, 23, 0.8);
|
|
--glass-border: rgba(255, 255, 255, 0.1);
|
|
--glass-hover: rgba(38, 38, 38, 0.9);
|
|
--shadow-color: rgba(0, 0, 0, 0.5);
|
|
--error-bg: rgba(220, 38, 38, 0.1);
|
|
--error-border: rgba(220, 38, 38, 0.2);
|
|
--error-text: #ef4444;
|
|
--warning-bg: rgba(217, 119, 6, 0.1);
|
|
--warning-border: rgba(217, 119, 6, 0.2);
|
|
--warning-text: #fbbf24;
|
|
}
|
|
|
|
/* ========== 鍏ㄥ眬閲嶇疆 ========== */
|
|
*, *::before, *::after { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
|
|
html { scroll-behavior: smooth; }
|
|
::selection { background: rgba(128, 128, 128, 0.2); color: var(--text-primary); }
|
|
|
|
body {
|
|
font-family: 'Inter', sans-serif;
|
|
margin: 0;
|
|
min-height: 100vh;
|
|
overflow-x: hidden;
|
|
transition: background-color 0.5s ease, color 0.5s ease;
|
|
background-image:
|
|
radial-gradient(at 0% 0%, rgba(220, 38, 38, 0.03) 0px, transparent 50%),
|
|
radial-gradient(at 100% 100%, rgba(220, 38, 38, 0.03) 0px, transparent 50%);
|
|
background-color: var(--bg-primary);
|
|
color: var(--text-primary);
|
|
}
|
|
|
|
html.dark body {
|
|
background-image:
|
|
radial-gradient(at 0% 0%, rgba(239, 68, 68, 0.05) 0px, transparent 50%),
|
|
radial-gradient(at 100% 100%, rgba(239, 68, 68, 0.05) 0px, transparent 50%);
|
|
}
|
|
|
|
.font-serif {
|
|
font-family: 'Playfair Display', serif;
|
|
}
|
|
|
|
.glass {
|
|
background: var(--glass-bg);
|
|
backdrop-filter: blur(20px);
|
|
-webkit-backdrop-filter: blur(20px);
|
|
border: 1px solid var(--glass-border);
|
|
transition: all 0.3s ease;
|
|
}
|
|
.glass:hover { background: var(--glass-hover); }
|
|
|
|
.theme-transition {
|
|
transition: background-color 0.5s ease, color 0.5s ease, border-color 0.5s ease, box-shadow 0.5s ease;
|
|
}
|
|
|
|
.btn-shine {
|
|
position: relative;
|
|
overflow: hidden;
|
|
}
|
|
.btn-shine::before {
|
|
content: '';
|
|
position: absolute;
|
|
top: 0;
|
|
left: -100%;
|
|
width: 100%;
|
|
height: 100%;
|
|
background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
|
|
transition: left 0.5s;
|
|
}
|
|
.btn-shine:hover::before { left: 100%; }
|
|
|
|
/* 鈹€鈹€ 502 澶у彿鑳屾櫙鏁板瓧 鈹€鈹€ */
|
|
.error-code {
|
|
font-family: 'Playfair Display', serif;
|
|
font-size: clamp(120px, 20vw, 200px);
|
|
font-weight: 600;
|
|
line-height: 1;
|
|
background: linear-gradient(135deg, var(--warning-text) 0%, #b45309 100%);
|
|
-webkit-background-clip: text;
|
|
-webkit-text-fill-color: transparent;
|
|
background-clip: text;
|
|
opacity: 0.15;
|
|
position: absolute;
|
|
top: 50%;
|
|
left: 50%;
|
|
transform: translate(-50%, -50%);
|
|
z-index: 0;
|
|
pointer-events: none;
|
|
user-select: none;
|
|
}
|
|
|
|
.error-content { position: relative; z-index: 1; }
|
|
|
|
.progress-ring { transform: rotate(-90deg); }
|
|
.progress-ring-circle {
|
|
transition: stroke-dashoffset 0.35s;
|
|
transform-origin: 50% 50%;
|
|
}
|
|
|
|
@media (max-width: 768px) {
|
|
.error-code { font-size: 100px; }
|
|
}
|
|
</style>
|
|
</head>
|
|
|
|
<body class="antialiased min-h-screen flex items-center justify-center relative">
|
|
|
|
<!-- 鑳屾櫙鍏夋檿 -->
|
|
<div class="fixed inset-0 overflow-hidden pointer-events-none">
|
|
<div class="absolute top-1/4 left-1/4 w-96 h-96 rounded-full blur-3xl animate-pulse-slow"
|
|
style="background: rgba(217,119,6,0.06);"></div>
|
|
<div class="absolute bottom-1/4 right-1/4 w-96 h-96 rounded-full blur-3xl animate-pulse-slow"
|
|
style="background: rgba(220,38,38,0.05); animation-delay: 2s;"></div>
|
|
</div>
|
|
|
|
<!-- Main Content -->
|
|
<main class="relative w-full max-w-2xl mx-auto px-6 py-12">
|
|
|
|
<!-- Error Code Background -->
|
|
<div class="error-code" id="errorCodeBg">502</div>
|
|
|
|
<!-- Card -->
|
|
<div class="error-content glass rounded-3xl p-8 md:p-12 shadow-2xl theme-transition" id="mainCard">
|
|
|
|
<!-- Icon 鈥?502 缃戝叧鏂紑鍥炬爣 -->
|
|
<div class="w-20 h-20 mx-auto mb-8 rounded-2xl flex items-center justify-center theme-transition"
|
|
style="background-color: var(--warning-bg); border: 1px solid var(--warning-border);" id="iconContainer">
|
|
<svg width="40" height="40" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5"
|
|
style="color: var(--warning-text);" id="errorIcon">
|
|
<!-- 鏂紑杩炴帴鍥炬爣锛氫袱鏈嶅姟鍣ㄤ腑闂存柇绾?-->
|
|
<rect x="2" y="6" width="6" height="12" rx="1" />
|
|
<rect x="16" y="6" width="6" height="12" rx="1" />
|
|
<line x1="8" y1="12" x2="16" y2="12" stroke-dasharray="2 3" />
|
|
<line x1="8" y1="12" x2="16" y2="12" stroke-width="2" stroke="#ef4444" opacity="0.5" />
|
|
</svg>
|
|
</div>
|
|
|
|
<!-- Title -->
|
|
<h1 class="font-serif text-3xl md:text-4xl font-medium text-center mb-4 tracking-tight theme-transition"
|
|
style="color: var(--text-primary);" id="errorTitle">
|
|
502 Bad Gateway<br>缃戝叧杩炴帴澶辫触
|
|
</h1>
|
|
|
|
<!-- Description -->
|
|
<p class="text-center mb-8 text-sm md:text-base leading-relaxed max-w-md mx-auto theme-transition"
|
|
style="color: var(--text-secondary);" id="errorDesc">
|
|
涓婃父鏈嶅姟鍣ㄦ殏鏃舵棤鍝嶅簲锛屾棤娉曞畬鎴愯姹傘€傝绋嶅悗鍒锋柊閲嶈瘯銆? </p>
|
|
|
|
<!-- Error Details (Collapsible) -->
|
|
<div class="mb-8 rounded-xl overflow-hidden theme-transition"
|
|
style="background-color: var(--bg-primary); border: 1px solid var(--border-color);">
|
|
<button onclick="toggleDetails()"
|
|
class="w-full px-4 py-3 flex items-center justify-between text-xs font-medium uppercase tracking-wider theme-transition hover:opacity-70"
|
|
style="color: var(--text-muted);">
|
|
<span>鎶€鏈鎯?/span>
|
|
<svg id="detailsArrow" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor"
|
|
stroke-width="2" class="transform transition-transform duration-300">
|
|
<polyline points="6 9 12 15 18 9"></polyline>
|
|
</svg>
|
|
</button>
|
|
<div id="errorDetails" class="hidden px-4 pb-4">
|
|
<div class="font-mono text-xs p-3 rounded-lg theme-transition"
|
|
style="background-color: var(--bg-secondary); color: var(--text-muted); border: 1px solid var(--border-color);">
|
|
<div class="mb-1"><span style="color: var(--warning-text);">Status:</span> <span id="detailStatus">502 Bad Gateway</span></div>
|
|
<div class="mb-1"><span style="color: var(--warning-text);">Path:</span> <span id="detailPath">/</span></div>
|
|
<div><span style="color: var(--warning-text);">Time:</span> <span id="detailTime">--</span></div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
|
|
<!-- Action Buttons -->
|
|
<div class="flex flex-col sm:flex-row gap-3 justify-center">
|
|
<button onclick="refreshPage()"
|
|
class="btn-shine px-8 py-3 rounded-full text-sm font-medium tracking-wide text-center transform hover:scale-[1.02] active:scale-[0.98] transition-all theme-transition"
|
|
style="background-color: var(--accent-bg); color: var(--accent-text); cursor: pointer; border: none;">
|
|
绔嬪嵆鍒锋柊椤甸潰
|
|
</button>
|
|
<button onclick="history.back()"
|
|
class="px-8 py-3 rounded-full text-sm font-medium tracking-wide text-center transform hover:scale-[1.02] active:scale-[0.98] transition-all theme-transition"
|
|
style="background-color: var(--bg-primary); color: var(--text-secondary); border: 1px solid var(--border-color); cursor: pointer;">
|
|
杩斿洖涓婁竴椤? </button>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Footer -->
|
|
<div class="mt-8 text-center">
|
|
<p class="text-[10px] tracking-[0.3em] uppercase font-medium theme-transition"
|
|
style="color: var(--text-muted);">
|
|
|
|
</p>
|
|
</div>
|
|
</main>
|
|
|
|
<script>
|
|
// ============================================================
|
|
// 绮掑瓙绯荤粺 鈥?鍐呰仈鑷?particles.js锛堝畬鏁村唴宓岋紝鏃犲閮ㄤ緷璧栵級
|
|
// ============================================================
|
|
(function() {
|
|
'use strict';
|
|
|
|
class ParticleSystem {
|
|
constructor(options = {}) {
|
|
this.canvas = null;
|
|
this.ctx = null;
|
|
this.particles = [];
|
|
this.animationId = null;
|
|
|
|
this.config = {
|
|
particleCount: options.particleCount || null,
|
|
connectionDistance: options.connectionDistance || 100,
|
|
mouseDistance: options.mouseDistance || 120,
|
|
attractStrength: options.attractStrength || 0.04,
|
|
speed: options.speed || 0.4,
|
|
size: { min: 2, max: 4 },
|
|
opacity: { min: 0.3, max: 0.6 },
|
|
zIndex: options.zIndex || -1,
|
|
colorLight: '100, 100, 100',
|
|
colorDark: '150, 150, 150',
|
|
lineOpacity: 0.2,
|
|
maxConnections: 5,
|
|
bgColor: options.bgColor || null
|
|
};
|
|
|
|
this.mouse = { x: null, y: null, active: false };
|
|
this.isDark = false;
|
|
this.dpr = window.devicePixelRatio || 1;
|
|
|
|
this.init();
|
|
}
|
|
|
|
init() {
|
|
if (document.getElementById('particleCanvas')) return;
|
|
this.canvas = document.createElement('canvas');
|
|
this.canvas.id = 'particleCanvas';
|
|
this.canvas.style.cssText = [
|
|
'position: fixed',
|
|
'top: 0',
|
|
'left: 0',
|
|
'width: 100%',
|
|
'height: 100%',
|
|
'z-index: ' + this.config.zIndex,
|
|
'pointer-events: none',
|
|
'touch-action: none',
|
|
'opacity: 0.6'
|
|
].join(';');
|
|
document.body.insertBefore(this.canvas, document.body.firstChild);
|
|
this.ctx = this.canvas.getContext('2d', { alpha: true });
|
|
this.resize();
|
|
window.addEventListener('resize', () => this.resize(), { passive: true });
|
|
this.initEvents();
|
|
this.initThemeListener();
|
|
this.createParticles();
|
|
this.animate();
|
|
}
|
|
|
|
initEvents() {
|
|
var self = this;
|
|
var updateMouse = function(x, y) {
|
|
self.mouse.x = x; self.mouse.y = y; self.mouse.active = true;
|
|
clearTimeout(self.mouseTimer);
|
|
self.mouseTimer = setTimeout(function() { self.mouse.active = false; }, 100);
|
|
};
|
|
window.addEventListener('mousemove', function(e) {
|
|
updateMouse(e.clientX, e.clientY);
|
|
}, { passive: true });
|
|
window.addEventListener('touchstart', function(e) {
|
|
if (e.touches[0]) updateMouse(e.touches[0].clientX, e.touches[0].clientY);
|
|
}, { passive: true });
|
|
window.addEventListener('touchmove', function(e) {
|
|
if (e.touches[0]) updateMouse(e.touches[0].clientX, e.touches[0].clientY);
|
|
}, { passive: true });
|
|
window.addEventListener('touchend', function() { self.mouse.active = false; });
|
|
}
|
|
|
|
resize() {
|
|
this.width = window.innerWidth;
|
|
this.height = window.innerHeight;
|
|
this.canvas.width = this.width * this.dpr;
|
|
this.canvas.height = this.height * this.dpr;
|
|
this.canvas.style.width = this.width + 'px';
|
|
this.canvas.style.height = this.height + 'px';
|
|
this.ctx.scale(this.dpr, this.dpr);
|
|
if (!this.config.particleCount) {
|
|
var area = this.width * this.height;
|
|
this.targetCount = Math.min(Math.max(Math.floor(area / 20000), 40), 100);
|
|
}
|
|
}
|
|
|
|
initThemeListener() {
|
|
var self = this;
|
|
this.checkTheme();
|
|
var mediaQuery = window.matchMedia('(prefers-color-scheme: dark)');
|
|
mediaQuery.addEventListener('change', function() { self.checkTheme(); });
|
|
var observer = new MutationObserver(function() { self.checkTheme(); });
|
|
observer.observe(document.documentElement, { attributes: true, attributeFilter: ['class', 'data-theme'] });
|
|
}
|
|
|
|
checkTheme() {
|
|
var html = document.documentElement;
|
|
this.isDark = html.classList.contains('dark') ||
|
|
html.getAttribute('data-theme') === 'dark' ||
|
|
(!html.classList.contains('light') && window.matchMedia('(prefers-color-scheme: dark)').matches);
|
|
}
|
|
|
|
createParticles() {
|
|
var count = this.config.particleCount || this.targetCount || 60;
|
|
this.particles = [];
|
|
for (var i = 0; i < count; i++) {
|
|
this.particles.push({
|
|
x: Math.random() * this.width,
|
|
y: Math.random() * this.height,
|
|
vx: (Math.random() - 0.75) * this.config.speed,
|
|
vy: (Math.random() - 0.75) * this.config.speed,
|
|
size: Math.random() * (this.config.size.max - this.config.size.min) + this.config.size.min,
|
|
opacity: Math.random() * (this.config.opacity.max - this.config.opacity.min) + this.config.opacity.min,
|
|
phase: Math.random() * Math.PI * 2,
|
|
phaseSpeed: 0.02 + Math.random() * 0.02
|
|
});
|
|
}
|
|
}
|
|
|
|
updateParticle(p) {
|
|
p.phase += p.phaseSpeed;
|
|
var waveX = Math.sin(p.phase) * 0.1;
|
|
var waveY = Math.cos(p.phase * 0.7) * 0.1;
|
|
p.x += p.vx + waveX;
|
|
p.y += p.vy + waveY;
|
|
if (this.mouse.active && this.mouse.x !== null) {
|
|
var dx = this.mouse.x - p.x;
|
|
var dy = this.mouse.y - p.y;
|
|
var dist = Math.sqrt(dx * dx + dy * dy);
|
|
if (dist < this.config.mouseDistance) {
|
|
var force = (1 - dist / this.config.mouseDistance) * this.config.attractStrength;
|
|
p.vx += dx * force * 0.01;
|
|
p.vy += dy * force * 0.01;
|
|
}
|
|
}
|
|
var maxSpeed = this.config.speed * 1.5;
|
|
p.vx = Math.max(-maxSpeed, Math.min(maxSpeed, p.vx));
|
|
p.vy = Math.max(-maxSpeed, Math.min(maxSpeed, p.vy));
|
|
p.vx *= 0.995;
|
|
p.vy *= 0.995;
|
|
var margin = 50;
|
|
if (p.x < -margin) p.x = this.width + margin;
|
|
if (p.x > this.width + margin) p.x = -margin;
|
|
if (p.y < -margin) p.y = this.height + margin;
|
|
if (p.y > this.height + margin) p.y = -margin;
|
|
}
|
|
|
|
draw() {
|
|
var color = this.isDark ? this.config.colorDark : this.config.colorLight;
|
|
this.drawConnections(color);
|
|
for (var i = 0; i < this.particles.length; i++) {
|
|
var p = this.particles[i];
|
|
this.ctx.beginPath();
|
|
this.ctx.arc(p.x, p.y, p.size, 0, Math.PI * 2);
|
|
this.ctx.fillStyle = 'rgba(' + color + ', ' + p.opacity + ')';
|
|
this.ctx.fill();
|
|
}
|
|
}
|
|
|
|
drawConnections(color) {
|
|
for (var i = 0; i < this.particles.length; i++) {
|
|
var connections = 0;
|
|
var p1 = this.particles[i];
|
|
for (var j = i + 1; j < Math.min(i + 20, this.particles.length); j++) {
|
|
if (connections >= this.config.maxConnections) break;
|
|
var p2 = this.particles[j];
|
|
var dx = p1.x - p2.x;
|
|
var dy = p1.y - p2.y;
|
|
var distSq = dx * dx + dy * dy;
|
|
if (distSq < this.config.connectionDistance * this.config.connectionDistance) {
|
|
var dist = Math.sqrt(distSq);
|
|
var opacity = this.config.lineOpacity * (1 - dist / this.config.connectionDistance);
|
|
this.ctx.beginPath();
|
|
this.ctx.moveTo(p1.x, p1.y);
|
|
this.ctx.lineTo(p2.x, p2.y);
|
|
this.ctx.strokeStyle = 'rgba(' + color + ', ' + opacity + ')';
|
|
this.ctx.lineWidth = 0.5;
|
|
this.ctx.stroke();
|
|
connections++;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
animate() {
|
|
var self = this;
|
|
this.ctx.clearRect(0, 0, this.width, this.height);
|
|
for (var i = 0; i < this.particles.length; i++) {
|
|
this.updateParticle(this.particles[i]);
|
|
}
|
|
this.draw();
|
|
this.animationId = requestAnimationFrame(function() { self.animate(); });
|
|
}
|
|
|
|
destroy() {
|
|
if (this.animationId) cancelAnimationFrame(this.animationId);
|
|
if (this.canvas && this.canvas.parentNode) {
|
|
this.canvas.parentNode.removeChild(this.canvas);
|
|
}
|
|
window.particleSystem = null;
|
|
}
|
|
}
|
|
|
|
function autoInit() {
|
|
if (document.body && document.body.hasAttribute('data-no-particles')) return;
|
|
if (window.particleSystem) return;
|
|
if (!document.body) { setTimeout(autoInit, 100); return; }
|
|
window.particleSystem = new ParticleSystem();
|
|
}
|
|
|
|
window.ParticleSystem = ParticleSystem;
|
|
if (document.readyState === 'loading') {
|
|
document.addEventListener('DOMContentLoaded', autoInit);
|
|
} else {
|
|
setTimeout(autoInit, 0);
|
|
}
|
|
})();
|
|
|
|
// ============================================================
|
|
// 椤甸潰閫昏緫
|
|
// ============================================================
|
|
|
|
// Toggle 鎶€鏈鎯? function toggleDetails() {
|
|
var details = document.getElementById('errorDetails');
|
|
var arrow = document.getElementById('detailsArrow');
|
|
details.classList.toggle('hidden');
|
|
arrow.style.transform = details.classList.contains('hidden') ? 'rotate(0deg)' : 'rotate(180deg)';
|
|
}
|
|
|
|
// 鍒锋柊椤甸潰
|
|
function refreshPage() {
|
|
window.location.reload();
|
|
}
|
|
|
|
// ============================================================
|
|
// 涓婚鑷姩璺熼殢绯荤粺
|
|
// ============================================================
|
|
(function() {
|
|
var html = document.documentElement;
|
|
function applyTheme() {
|
|
var dark = window.matchMedia('(prefers-color-scheme: dark)').matches;
|
|
html.classList.toggle('dark', dark);
|
|
}
|
|
applyTheme();
|
|
window.matchMedia('(prefers-color-scheme: dark)').addEventListener('change', applyTheme);
|
|
})();
|
|
|
|
// GSAP 鍏ュ満鍔ㄧ敾
|
|
window.addEventListener('load', function() {
|
|
// 鏇存柊鏃堕棿
|
|
document.getElementById('detailTime').textContent = new Date().toLocaleString('zh-CN');
|
|
|
|
gsap.from("#mainCard", { y: 30, opacity: 0, duration: 0.8, ease: "power2.out" });
|
|
gsap.from("#iconContainer", { scale: 0, rotation: -180, duration: 0.6, delay: 0.2, ease: "back.out(1.7)" });
|
|
gsap.from("#errorTitle", { y: 20, opacity: 0, duration: 0.6, delay: 0.3, ease: "power2.out" });
|
|
gsap.from("#errorDesc", { y: 20, opacity: 0, duration: 0.6, delay: 0.4, ease: "power2.out" });
|
|
|
|
});
|
|
|
|
// 鑳屾櫙鏁板瓧 hover 鏁堟灉
|
|
document.getElementById('errorCodeBg').addEventListener('mouseenter', function() {
|
|
gsap.to(this, { scale: 1.1, opacity: 0.2, duration: 0.3 });
|
|
});
|
|
document.getElementById('errorCodeBg').addEventListener('mouseleave', function() {
|
|
gsap.to(this, { scale: 1, opacity: 0.15, duration: 0.3 });
|
|
});
|
|
</script>
|
|
</body>
|
|
|
|
</html>
|