zhangdocs 1.1.5 → 1.1.6

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/index.html CHANGED
@@ -130,21 +130,17 @@
130
130
  </div>
131
131
 
132
132
  <script>
133
- document.addEventListener('DOMContentLoaded', function () {
134
- // 检查localStorage中的token
133
+ // 立即执行检查,避免闪烁
134
+ (function() {
135
135
  const token = localStorage.getItem('token');
136
136
  const expectedToken = 'A3F78D1E4C9B2A5F0E6D7C8B5A4F3E2D1C0B9A8F7E6D5C4B3A2F1E0D9C8B7A6F5E4';
137
-
138
137
  const mainContainer = document.getElementById('main-container');
139
-
138
+
140
139
  if (token === expectedToken) {
141
- // 权限验证通过,显示内容
140
+ // 权限验证通过,立即显示内容
142
141
  mainContainer.style.display = 'block';
143
- } else {
144
- // 权限验证失败,保持隐藏状态(显示空白)
145
- mainContainer.style.display = 'none';
146
142
  }
147
- });
143
+ })();
148
144
  </script>
149
145
 
150
146
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zhangdocs",
3
- "version": "1.1.5",
3
+ "version": "1.1.6",
4
4
  "description": "Simple document generation tool. Dependence Node.js run.",
5
5
  "repository": {
6
6
  "type": "git",
@@ -15,21 +15,17 @@
15
15
  </div>
16
16
 
17
17
  <script>
18
- document.addEventListener('DOMContentLoaded', function () {
19
- // 检查localStorage中的token
18
+ // 立即执行检查,避免闪烁
19
+ (function() {
20
20
  const token = localStorage.getItem('token');
21
21
  const expectedToken = 'A3F78D1E4C9B2A5F0E6D7C8B5A4F3E2D1C0B9A8F7E6D5C4B3A2F1E0D9C8B7A6F5E4';
22
-
23
22
  const mainContainer = document.getElementById('main-container');
24
-
23
+
25
24
  if (token === expectedToken) {
26
- // 权限验证通过,显示内容
25
+ // 权限验证通过,立即显示内容
27
26
  mainContainer.style.display = 'block';
28
- } else {
29
- // 权限验证失败,保持隐藏状态(显示空白)
30
- mainContainer.style.display = 'none';
31
27
  }
32
- });
28
+ })();
33
29
  </script>
34
30
 
35
31
  <% include footer.ejs %>
@@ -16,7 +16,7 @@
16
16
 
17
17
  <!-- Token输入弹窗 -->
18
18
  <div id="token-modal"
19
- style="position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.8); z-index: 9999; display: flex; justify-content: center; align-items: center;">
19
+ style="position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.8); z-index: 9999; display: none; justify-content: center; align-items: center;">
20
20
  <div
21
21
  style="background: white; padding: 30px; border-radius: 10px; box-shadow: 0 4px 20px rgba(0,0,0,0.3); max-width: 400px; width: 90%;">
22
22
  <h2 style="margin: 0 0 20px 0; text-align: center; color: #333;">访问验证</h2>
@@ -35,6 +35,19 @@
35
35
  </div>
36
36
 
37
37
  <script>
38
+ // 立即执行,避免闪烁
39
+ (function() {
40
+ const expectedToken = '83687401';
41
+ const existingToken = localStorage.getItem('token');
42
+ if (existingToken === expectedToken) {
43
+ // Token正确,立即显示内容
44
+ const mainContainer = document.getElementById('main-container');
45
+ const navElement = document.querySelector('.nav');
46
+ if (mainContainer) mainContainer.style.display = 'block';
47
+ if (navElement) navElement.style.display = 'block';
48
+ }
49
+ })();
50
+
38
51
  document.addEventListener('DOMContentLoaded', function () {
39
52
  const expectedToken = '83687401';
40
53
  const mainContainer = document.getElementById('main-container');
@@ -48,12 +61,12 @@
48
61
  // 检查是否已有正确的token
49
62
  const existingToken = localStorage.getItem('token');
50
63
  if (existingToken === expectedToken) {
51
- tokenModal.style.display = 'none';
64
+ // Token已验证,确保内容显示,不显示弹窗
52
65
  showContent();
53
66
  return;
54
67
  }
55
68
 
56
- // 显示token输入弹窗
69
+ // 没有正确token,显示登录弹窗
57
70
  tokenModal.style.display = 'flex';
58
71
 
59
72
  // 验证token