feat(nginx): 为 37point2.cn 网站的 404 页面添加多语言支持
- 添加简体中文和英文的内容切换 - 根据用户浏览器语言自动设置页面内容 - 更新页面标题、标题、消息内容和按钮文本 - 保持原有的页面样式和交互效果
This commit is contained in:
@@ -1,9 +1,9 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<html lang="auto">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<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>
|
||||
:root {
|
||||
--primary-color: #4361ee;
|
||||
@@ -134,28 +134,47 @@
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="container">
|
||||
<div class="error-code animation">404</div>
|
||||
<h1>Page Not Found</h1>
|
||||
<p>The page you're looking for might have been moved, deleted, or doesn't exist.</p>
|
||||
<div class="actions">
|
||||
<a href="/" class="btn btn-primary">Go to Homepage</a>
|
||||
<a href="javascript:history.back()" class="btn btn-secondary">Go Back</a>
|
||||
<div class="container">
|
||||
<div class="error-code animation">404</div>
|
||||
<h1 id="heading">Page Not Found</h1>
|
||||
<p id="message">The page you're looking for might have been moved, deleted, or doesn't exist.</p>
|
||||
<div class="actions">
|
||||
<a href="/" class="btn btn-primary" id="home-btn">Go to Homepage</a>
|
||||
<a href="javascript:history.back()" class="btn btn-secondary" id="back-btn">Go Back</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
// Console message
|
||||
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;');
|
||||
<script>
|
||||
// Language detection and content switching
|
||||
function setLanguage() {
|
||||
const userLanguage = navigator.language || navigator.userLanguage;
|
||||
const isChinese = userLanguage.toLowerCase().includes('zh-cn');
|
||||
|
||||
// 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>
|
||||
if (isChinese) {
|
||||
document.getElementById('page-title').textContent = '页面未找到 - 404';
|
||||
document.getElementById('heading').textContent = '页面未找到';
|
||||
document.getElementById('message').textContent = '您访问的页面可能已被移动、删除或暂时不可用。';
|
||||
document.getElementById('home-btn').textContent = '返回首页';
|
||||
document.getElementById('back-btn').textContent = '返回上一页';
|
||||
|
||||
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>
|
||||
</html>
|
||||
Reference in New Issue
Block a user