Skip to content

Commit

Permalink
Add redirect page and language detection to workflow fixer
Browse files Browse the repository at this point in the history
  • Loading branch information
jammyfu committed Jan 22, 2025
1 parent 95926f5 commit 4a1c714
Show file tree
Hide file tree
Showing 2 changed files with 102 additions and 0 deletions.
13 changes: 13 additions & 0 deletions docs/fix/workflow_fixer.html
Original file line number Diff line number Diff line change
Expand Up @@ -347,6 +347,19 @@ <h1 id="title">PaintingCoder Workflow Fixer</h1>
</footer>

<script>
// 在现有代码前添加
window.onload = function() {
// 获取URL参数
const urlParams = new URLSearchParams(window.location.search);
const lang = urlParams.get('lang');

// 如果有语言参数,设置对应语言
if (lang && (lang === 'zh' || lang === 'en')) {
currentLanguage = lang;
updateLanguage();
}
}

// 语言配置
const translations = {
en: {
Expand Down
89 changes: 89 additions & 0 deletions docs/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>PaintingCoder Utils - Redirecting...</title>
<style>
body {
font-family: Arial, sans-serif;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
height: 100vh;
margin: 0;
background-color: #f5f5f5;
color: #333;
}
.loader {
border: 4px solid #f3f3f3;
border-top: 4px solid #3498db;
border-radius: 50%;
width: 40px;
height: 40px;
animation: spin 1s linear infinite;
margin-bottom: 20px;
}
@keyframes spin {
0% { transform: rotate(0deg); }
100% { transform: rotate(360deg); }
}
.message {
text-align: center;
margin-bottom: 20px;
}
.manual-link {
color: #3498db;
text-decoration: none;
}
.manual-link:hover {
text-decoration: underline;
}
</style>
<script>
// 检测浏览器语言
function detectLanguage() {
const lang = navigator.language || navigator.userLanguage;
return lang.toLowerCase().startsWith('zh') ? 'zh' : 'en';
}

// 多语言文本
const translations = {
en: {
title: "Redirecting to PaintingCoder Workflow Fixer...",
manual: "If not redirected automatically, click",
here: "here"
},
zh: {
title: "正在跳转到 PaintingCoder Workflow Fixer...",
manual: "如果没有自动跳转,请点击",
here: "这里"
}
};

window.onload = function() {
const lang = detectLanguage();
const t = translations[lang];

// 更新页面文本
document.title = `PaintingCoder Utils - ${t.title}`;
document.querySelector('.message h2').textContent = t.title;
document.querySelector('.message p').innerHTML =
`${t.manual} <a href="fix/workflow_fixer.html?lang=${lang}" class="manual-link">${t.here}</a>`;

// 3秒后自动跳转
setTimeout(function() {
window.location.href = `fix/workflow_fixer.html?lang=${lang}`;
}, 3000);
}
</script>
</head>
<body>
<div class="loader"></div>
<div class="message">
<h2>Redirecting...</h2>
<p>If not redirected automatically, click <a href="fix/workflow_fixer.html" class="manual-link">here</a></p>
</div>
</body>
</html>

0 comments on commit 4a1c714

Please sign in to comment.