feat(nginx): 为 37point2.cn 网站的 404 页面添加多语言支持

- 添加简体中文和英文的内容切换
- 根据用户浏览器语言自动设置页面内容
- 更新页面标题、标题、消息内容和按钮文本
- 保持原有的页面样式和交互效果
This commit is contained in:
2025-07-24 15:55:43 +08:00
parent 5ad499560b
commit 21ddacee21

View File

@@ -1,9 +1,9 @@
<!DOCTYPE html> <!DOCTYPE html>
<html lang="en"> <html lang="auto">
<head> <head>
<meta charset="UTF-8"> <meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Page Not Found - 404</title> <title id="page-title">Page Not Found - 404</title>
<style> <style>
:root { :root {
--primary-color: #4361ee; --primary-color: #4361ee;
@@ -134,28 +134,47 @@
</style> </style>
</head> </head>
<body> <body>
<div class="container"> <div class="container">
<div class="error-code animation">404</div> <div class="error-code animation">404</div>
<h1>Page Not Found</h1> <h1 id="heading">Page Not Found</h1>
<p>The page you're looking for might have been moved, deleted, or doesn't exist.</p> <p id="message">The page you're looking for might have been moved, deleted, or doesn't exist.</p>
<div class="actions"> <div class="actions">
<a href="/" class="btn btn-primary">Go to Homepage</a> <a href="/" class="btn btn-primary" id="home-btn">Go to Homepage</a>
<a href="javascript:history.back()" class="btn btn-secondary">Go Back</a> <a href="javascript:history.back()" class="btn btn-secondary" id="back-btn">Go Back</a>
</div>
</div> </div>
</div>
<script> <script>
// Console message // Language detection and content switching
console.log('%c404 - Page Not Found', 'color: #4361ee; font-size: 2em; font-weight: bold;'); function setLanguage() {
console.log('%cLooks like you\'re lost! Use the buttons above to find your way back.', 'color: #2b2d42; font-size: 1.1em;'); const userLanguage = navigator.language || navigator.userLanguage;
const isChinese = userLanguage.toLowerCase().includes('zh-cn');
// Simple parallax effect if (isChinese) {
document.addEventListener('mousemove', function(e) { document.getElementById('page-title').textContent = '页面未找到 - 404';
const container = document.querySelector('.container'); document.getElementById('heading').textContent = '页面未找到';
const xAxis = (window.innerWidth / 2 - e.pageX) / 25; document.getElementById('message').textContent = '您访问的页面可能已被移动、删除或暂时不可用。';
const yAxis = (window.innerHeight / 2 - e.pageY) / 25; document.getElementById('home-btn').textContent = '返回首页';
container.style.transform = `rotateY(${xAxis}deg) rotateX(${yAxis}deg)`; document.getElementById('back-btn').textContent = '返回上一页';
});
</script> console.log('%c404 - 页面未找到', 'color: #4361ee; font-size: 2em; font-weight: bold;');
console.log('%c您似乎迷路了但别担心点击上面的按钮可以找到回去的路。', 'color: #2b2d42; font-size: 1.1em;');
} else {
console.log('%c404 - Page Not Found', 'color: #4361ee; font-size: 2em; font-weight: bold;');
console.log('%cLooks like you\'re lost! Use the buttons above to find your way back.', 'color: #2b2d42; font-size: 1.1em;');
}
}
// Set language on page load
window.addEventListener('DOMContentLoaded', setLanguage);
// Simple parallax effect
document.addEventListener('mousemove', function(e) {
const container = document.querySelector('.container');
const xAxis = (window.innerWidth / 2 - e.pageX) / 25;
const yAxis = (window.innerHeight / 2 - e.pageY) / 25;
container.style.transform = `rotateY(${xAxis}deg) rotateX(${yAxis}deg)`;
});
</script>
</body> </body>
</html> </html>