zhangdocs 1.1.24 → 1.1.25
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/theme/handbook/layout.ejs +21 -10
package/package.json
CHANGED
|
@@ -59,14 +59,16 @@ style="position: fixed; top: 0; left: 0; width: 100%; height: 100%; background:
|
|
|
59
59
|
style="background: white; padding: 30px; border-radius: 10px; box-shadow: 0 4px 20px rgba(0,0,0,0.3); max-width: 400px; width: 90%;">
|
|
60
60
|
<h2 style="margin: 0 0 20px 0; text-align: center; color: #333;">访问验证</h2>
|
|
61
61
|
<p style="margin: 0 0 15px 0; color: #666; text-align: center;">请输入访问令牌</p>
|
|
62
|
-
<
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
<
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
62
|
+
<form id="token-form" onsubmit="return false;">
|
|
63
|
+
<input type="password" id="token-input" placeholder="请输入token"
|
|
64
|
+
style="width: 100%; padding: 12px; border: 1px solid #ddd; border-radius: 5px; font-size: 16px; margin-bottom: 15px; box-sizing: border-box;">
|
|
65
|
+
<div style="text-align: center;">
|
|
66
|
+
<button type="submit" id="token-submit"
|
|
67
|
+
style="background: #007bff; color: white; border: none; padding: 12px 30px; border-radius: 5px; font-size: 16px; cursor: pointer; margin-right: 10px;">验证</button>
|
|
68
|
+
<button type="button" id="token-cancel"
|
|
69
|
+
style="background: #6c757d; color: white; border: none; padding: 12px 30px; border-radius: 5px; font-size: 16px; cursor: pointer;">取消</button>
|
|
70
|
+
</div>
|
|
71
|
+
</form>
|
|
70
72
|
<div id="error-message" style="color: red; text-align: center; margin-top: 10px; display: none;">Token不正确,请重新输入
|
|
71
73
|
</div>
|
|
72
74
|
</div>
|
|
@@ -192,7 +194,10 @@ style="position: fixed; top: 0; left: 0; width: 100%; height: 100%; background:
|
|
|
192
194
|
tokenModal.style.display = 'flex';
|
|
193
195
|
|
|
194
196
|
// 验证token
|
|
195
|
-
function verifyToken() {
|
|
197
|
+
function verifyToken(e) {
|
|
198
|
+
if (e) {
|
|
199
|
+
e.preventDefault(); // 防止表单提交刷新页面
|
|
200
|
+
}
|
|
196
201
|
const inputToken = tokenInput.value.trim();
|
|
197
202
|
if (inputToken === expectedToken) {
|
|
198
203
|
localStorage.setItem('token', inputToken);
|
|
@@ -203,6 +208,7 @@ style="position: fixed; top: 0; left: 0; width: 100%; height: 100%; background:
|
|
|
203
208
|
tokenInput.value = '';
|
|
204
209
|
tokenInput.focus();
|
|
205
210
|
}
|
|
211
|
+
return false; // 防止表单提交
|
|
206
212
|
}
|
|
207
213
|
|
|
208
214
|
// 显示内容
|
|
@@ -222,6 +228,10 @@ style="position: fixed; top: 0; left: 0; width: 100%; height: 100%; background:
|
|
|
222
228
|
}
|
|
223
229
|
|
|
224
230
|
// 事件监听
|
|
231
|
+
const tokenForm = document.getElementById('token-form');
|
|
232
|
+
if (tokenForm) {
|
|
233
|
+
tokenForm.addEventListener('submit', verifyToken);
|
|
234
|
+
}
|
|
225
235
|
tokenSubmit.addEventListener('click', verifyToken);
|
|
226
236
|
tokenCancel.addEventListener('click', function () {
|
|
227
237
|
hideContent();
|
|
@@ -230,7 +240,8 @@ style="position: fixed; top: 0; left: 0; width: 100%; height: 100%; background:
|
|
|
230
240
|
|
|
231
241
|
tokenInput.addEventListener('keypress', function (e) {
|
|
232
242
|
if (e.key === 'Enter') {
|
|
233
|
-
|
|
243
|
+
e.preventDefault();
|
|
244
|
+
verifyToken(e);
|
|
234
245
|
}
|
|
235
246
|
});
|
|
236
247
|
|