Spaces:
Running
Running
Upload 2 files
Browse files- index.html +3 -3
- worksheet.html +23 -4
index.html
CHANGED
|
@@ -818,10 +818,10 @@
|
|
| 818 |
</div>
|
| 819 |
<form id="form-worksheet-auth" autocomplete="off">
|
| 820 |
<div class="ws-auth-input-wrap">
|
| 821 |
-
<input id="input-worksheet-pwd" type="
|
| 822 |
-
aria-label="學習單密碼">
|
| 823 |
<button id="btn-toggle-ws-pwd" type="button" class="ws-auth-eye-btn" title="顯示 / 隱藏密碼"
|
| 824 |
-
aria-label="顯示或隱藏密碼">👁️</button>
|
| 825 |
</div>
|
| 826 |
<div id="ws-auth-error" class="ws-auth-error" style="display: none;">
|
| 827 |
❌ 密碼錯誤,請重新輸入!
|
|
|
|
| 818 |
</div>
|
| 819 |
<form id="form-worksheet-auth" autocomplete="off">
|
| 820 |
<div class="ws-auth-input-wrap">
|
| 821 |
+
<input id="input-worksheet-pwd" type="text" class="ws-auth-input is-masked" placeholder="請輸入密碼"
|
| 822 |
+
aria-label="學習單密碼" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false">
|
| 823 |
<button id="btn-toggle-ws-pwd" type="button" class="ws-auth-eye-btn" title="顯示 / 隱藏密碼"
|
| 824 |
+
aria-label="顯示或隱藏密碼" aria-pressed="false">👁️</button>
|
| 825 |
</div>
|
| 826 |
<div id="ws-auth-error" class="ws-auth-error" style="display: none;">
|
| 827 |
❌ 密碼錯誤,請重新輸入!
|
worksheet.html
CHANGED
|
@@ -1023,6 +1023,15 @@
|
|
| 1023 |
box-shadow: 0 0 0 3px rgba(20, 38, 74, 0.14);
|
| 1024 |
}
|
| 1025 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1026 |
.ws-lock-eye {
|
| 1027 |
position: absolute;
|
| 1028 |
right: 4px;
|
|
@@ -1112,8 +1121,8 @@
|
|
| 1112 |
</div>
|
| 1113 |
<form id="form-ws-lock" autocomplete="off">
|
| 1114 |
<div class="ws-lock-input-wrap">
|
| 1115 |
-
<input id="input-ws-lock-pwd" type="
|
| 1116 |
-
<button id="btn-ws-lock-eye" type="button" class="ws-lock-eye" title="顯示 / 隱藏密碼" aria-label="顯示或隱藏密碼">👁️</button>
|
| 1117 |
</div>
|
| 1118 |
<div id="ws-lock-err" class="ws-lock-err" style="display: none;">
|
| 1119 |
❌ 密碼錯誤,請重新輸入!
|
|
@@ -1742,13 +1751,23 @@
|
|
| 1742 |
|
| 1743 |
if (eyeBtn && pwdInput) {
|
| 1744 |
eyeBtn.addEventListener('click', () => {
|
| 1745 |
-
|
| 1746 |
-
|
| 1747 |
eyeBtn.innerText = show ? '🙈' : '👁️';
|
|
|
|
| 1748 |
pwdInput.focus();
|
| 1749 |
});
|
| 1750 |
}
|
| 1751 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1752 |
if (lockForm) {
|
| 1753 |
lockForm.addEventListener('submit', (e) => {
|
| 1754 |
e.preventDefault();
|
|
|
|
| 1023 |
box-shadow: 0 0 0 3px rgba(20, 38, 74, 0.14);
|
| 1024 |
}
|
| 1025 |
|
| 1026 |
+
/* 使用 type="text" + CSS 遮罩,保留中文輸入法 (IME) 正常輸入與組字 */
|
| 1027 |
+
.ws-lock-input.is-masked {
|
| 1028 |
+
-webkit-text-security: disc;
|
| 1029 |
+
}
|
| 1030 |
+
|
| 1031 |
+
.ws-lock-input.is-masked::placeholder {
|
| 1032 |
+
-webkit-text-security: none;
|
| 1033 |
+
}
|
| 1034 |
+
|
| 1035 |
.ws-lock-eye {
|
| 1036 |
position: absolute;
|
| 1037 |
right: 4px;
|
|
|
|
| 1121 |
</div>
|
| 1122 |
<form id="form-ws-lock" autocomplete="off">
|
| 1123 |
<div class="ws-lock-input-wrap">
|
| 1124 |
+
<input id="input-ws-lock-pwd" type="text" class="ws-lock-input is-masked" placeholder="請輸入密碼" aria-label="學習單密碼" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false">
|
| 1125 |
+
<button id="btn-ws-lock-eye" type="button" class="ws-lock-eye" title="顯示 / 隱藏密碼" aria-label="顯示或隱藏密碼" aria-pressed="false">👁️</button>
|
| 1126 |
</div>
|
| 1127 |
<div id="ws-lock-err" class="ws-lock-err" style="display: none;">
|
| 1128 |
❌ 密碼錯誤,請重新輸入!
|
|
|
|
| 1751 |
|
| 1752 |
if (eyeBtn && pwdInput) {
|
| 1753 |
eyeBtn.addEventListener('click', () => {
|
| 1754 |
+
pwdInput.classList.toggle('is-masked');
|
| 1755 |
+
const show = !pwdInput.classList.contains('is-masked');
|
| 1756 |
eyeBtn.innerText = show ? '🙈' : '👁️';
|
| 1757 |
+
eyeBtn.setAttribute('aria-pressed', String(show));
|
| 1758 |
pwdInput.focus();
|
| 1759 |
});
|
| 1760 |
}
|
| 1761 |
|
| 1762 |
+
if (pwdInput) {
|
| 1763 |
+
// 防止中文輸入法 (IME) 按 Enter 選字上屏時誤觸發送表單
|
| 1764 |
+
pwdInput.addEventListener('keydown', (e) => {
|
| 1765 |
+
if (e.key === 'Enter' && (e.isComposing || e.keyCode === 229)) {
|
| 1766 |
+
e.preventDefault();
|
| 1767 |
+
}
|
| 1768 |
+
});
|
| 1769 |
+
}
|
| 1770 |
+
|
| 1771 |
if (lockForm) {
|
| 1772 |
lockForm.addEventListener('submit', (e) => {
|
| 1773 |
e.preventDefault();
|