Lashtw commited on
Commit
0a14af4
·
verified ·
1 Parent(s): 6a548e9

Update index.html

Browse files
Files changed (1) hide show
  1. index.html +16 -4
index.html CHANGED
@@ -910,8 +910,9 @@
910
  if (wordCount === 1) {
911
  container.style.width = '100%';
912
  } else {
913
- container.style.flex = '1 1 140px'; // Flex grow, shrink, basis
914
- container.style.minWidth = '140px';
 
915
  }
916
  container.style.height = '250px';
917
 
@@ -1772,8 +1773,19 @@
1772
  };
1773
  isCorrect = normalize(userAnswer) === normalize(correctAnswer);
1774
  } else if (answerLang === 'zh') {
1775
- const possibleAnswers = correctAnswer.split(/[;;]/).map(a => a.trim()).filter(a => a);
1776
- isCorrect = possibleAnswers.some(ans => userAnswer.trim().includes(ans));
 
 
 
 
 
 
 
 
 
 
 
1777
  }
1778
 
1779
  if (isCorrect) {
 
910
  if (wordCount === 1) {
911
  container.style.width = '100%';
912
  } else {
913
+ // [修改] 調整最小寬度為 220px,以容納較長的單字
914
+ container.style.flex = '1 1 220px'; // Flex grow, shrink, basis
915
+ container.style.minWidth = '220px';
916
  }
917
  container.style.height = '250px';
918
 
 
1773
  };
1774
  isCorrect = normalize(userAnswer) === normalize(correctAnswer);
1775
  } else if (answerLang === 'zh') {
1776
+ // [修改] 寬鬆模式:去除標點符號與特殊字元後比對
1777
+ // 使用者輸入需被包含在正確答案中 (例如輸入「除了之外」可對應「除了...之外(還有)...」)
1778
+ // 保留中文、英文與數字
1779
+ const normalize = (str) => str.replace(/[^\u4e00-\u9fa5a-zA-Z0-9]/g, "");
1780
+ const normUser = normalize(userAnswer);
1781
+
1782
+ const possibleAnswers = correctAnswer.split(/[;;]/).map(a => a.trim()).filter(a => a);
1783
+
1784
+ isCorrect = possibleAnswers.some(ans => {
1785
+ const normAns = normalize(ans);
1786
+ // 確保使用者輸入不為空,且被包含在標準化後的答案中
1787
+ return normUser.length > 0 && normAns.includes(normUser);
1788
+ });
1789
  }
1790
 
1791
  if (isCorrect) {