Spaces:
Running
Running
Update index.html
Browse files- index.html +27 -2
index.html
CHANGED
|
@@ -122,7 +122,10 @@
|
|
| 122 |
|
| 123 |
<!-- 主要功能 -->
|
| 124 |
<div class="mb-4">
|
| 125 |
-
<
|
|
|
|
|
|
|
|
|
|
| 126 |
<div class="grid grid-cols-1 sm:grid-cols-2 gap-4">
|
| 127 |
<button data-mode="review" class="mode-btn bg-sky-500 hover:bg-sky-600">複習模式</button>
|
| 128 |
<button data-mode="zh-en" class="mode-btn bg-teal-500 hover:bg-teal-600 relative">
|
|
@@ -462,6 +465,7 @@
|
|
| 462 |
const gradeReportBtn = document.getElementById('grade-report-btn');
|
| 463 |
const randomQuestionsCheckbox = document.getElementById('random-questions-checkbox');
|
| 464 |
const randomQuestionsCountInput = document.getElementById('random-questions-count');
|
|
|
|
| 465 |
|
| 466 |
// 單字管理介面
|
| 467 |
const wordManagementView = document.getElementById('word-management-view');
|
|
@@ -913,7 +917,12 @@
|
|
| 913 |
|
| 914 |
let isCorrect;
|
| 915 |
if (answerLang === 'en') {
|
| 916 |
-
const normalize = (str) =>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 917 |
isCorrect = normalize(userAnswer) === normalize(correctAnswer);
|
| 918 |
} else if (answerLang === 'zh') {
|
| 919 |
const possibleAnswers = correctAnswer.split(/[;;]/).map(a => a.trim());
|
|
@@ -1167,6 +1176,21 @@
|
|
| 1167 |
btn.addEventListener('click', () => setupLearningView(btn.dataset.mode));
|
| 1168 |
});
|
| 1169 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1170 |
backToMenuBtn.addEventListener('click', () => {
|
| 1171 |
clearInterval(timerInterval);
|
| 1172 |
const isQuiz = !['review', 'speed', ''].includes(currentMode);
|
|
@@ -1497,3 +1521,4 @@
|
|
| 1497 |
</body>
|
| 1498 |
</html>
|
| 1499 |
|
|
|
|
|
|
| 122 |
|
| 123 |
<!-- 主要功能 -->
|
| 124 |
<div class="mb-4">
|
| 125 |
+
<div class="relative mb-3 border-b pb-2">
|
| 126 |
+
<h3 class="text-lg font-semibold text-gray-600 text-center">主要功能</h3>
|
| 127 |
+
<button id="reset-crowns-btn" class="absolute right-0 top-1/2 -translate-y-1/2 text-xs bg-gray-200 hover:bg-gray-300 text-gray-700 font-semibold py-1 px-3 rounded-full transition-colors disabled:bg-gray-300">重置皇冠</button>
|
| 128 |
+
</div>
|
| 129 |
<div class="grid grid-cols-1 sm:grid-cols-2 gap-4">
|
| 130 |
<button data-mode="review" class="mode-btn bg-sky-500 hover:bg-sky-600">複習模式</button>
|
| 131 |
<button data-mode="zh-en" class="mode-btn bg-teal-500 hover:bg-teal-600 relative">
|
|
|
|
| 465 |
const gradeReportBtn = document.getElementById('grade-report-btn');
|
| 466 |
const randomQuestionsCheckbox = document.getElementById('random-questions-checkbox');
|
| 467 |
const randomQuestionsCountInput = document.getElementById('random-questions-count');
|
| 468 |
+
const resetCrownsBtn = document.getElementById('reset-crowns-btn');
|
| 469 |
|
| 470 |
// 單字管理介面
|
| 471 |
const wordManagementView = document.getElementById('word-management-view');
|
|
|
|
| 917 |
|
| 918 |
let isCorrect;
|
| 919 |
if (answerLang === 'en') {
|
| 920 |
+
const normalize = (str) => {
|
| 921 |
+
return str.toLowerCase()
|
| 922 |
+
.replace(/\s*\.{3}\s*/g, '') // 處理 '...',移除點及周圍空格
|
| 923 |
+
.replace(/[.,/#!$%^&*;:{}=\-_`~()]/g, "") // 移除標點符號
|
| 924 |
+
.replace(/\s+/g, ''); // 移除所有空格
|
| 925 |
+
};
|
| 926 |
isCorrect = normalize(userAnswer) === normalize(correctAnswer);
|
| 927 |
} else if (answerLang === 'zh') {
|
| 928 |
const possibleAnswers = correctAnswer.split(/[;;]/).map(a => a.trim());
|
|
|
|
| 1176 |
btn.addEventListener('click', () => setupLearningView(btn.dataset.mode));
|
| 1177 |
});
|
| 1178 |
|
| 1179 |
+
resetCrownsBtn.addEventListener('click', () => {
|
| 1180 |
+
completionStatus = {};
|
| 1181 |
+
localStorage.removeItem('completionStatus');
|
| 1182 |
+
updateCompletionUI();
|
| 1183 |
+
|
| 1184 |
+
// Visual feedback
|
| 1185 |
+
const originalText = resetCrownsBtn.textContent;
|
| 1186 |
+
resetCrownsBtn.textContent = '已重置!';
|
| 1187 |
+
resetCrownsBtn.disabled = true;
|
| 1188 |
+
setTimeout(() => {
|
| 1189 |
+
resetCrownsBtn.textContent = originalText;
|
| 1190 |
+
resetCrownsBtn.disabled = false;
|
| 1191 |
+
}, 2000);
|
| 1192 |
+
});
|
| 1193 |
+
|
| 1194 |
backToMenuBtn.addEventListener('click', () => {
|
| 1195 |
clearInterval(timerInterval);
|
| 1196 |
const isQuiz = !['review', 'speed', ''].includes(currentMode);
|
|
|
|
| 1521 |
</body>
|
| 1522 |
</html>
|
| 1523 |
|
| 1524 |
+
|