ghuser1 commited on
Commit
27e5f19
·
verified ·
1 Parent(s): fccdf92

Upload 2 files

Browse files
Files changed (2) hide show
  1. app.js +11 -1
  2. index.html +2 -2
app.js CHANGED
@@ -75,7 +75,11 @@ const els = {
75
  };
76
 
77
  render();
78
- if (!authStatus.authenticated) showAuthGate(authStatus.configured);
 
 
 
 
79
 
80
  window.addEventListener("beforeunload", flushPendingSave);
81
 
@@ -389,6 +393,7 @@ async function getAuthStatus() {
389
  }
390
 
391
  function showAuthGate(configured) {
 
392
  els.authTitle.textContent = configured ? "登录" : "设置密码";
393
  els.authPassword.autocomplete = configured ? "current-password" : "new-password";
394
  els.authPassword.placeholder = configured ? "密码" : "设置至少 8 位密码";
@@ -397,6 +402,11 @@ function showAuthGate(configured) {
397
  els.authPassword.focus();
398
  }
399
 
 
 
 
 
 
400
  function saveSelectedNote({ immediate = false } = {}) {
401
  saveUiState();
402
  const note = getSelectedNote();
 
75
  };
76
 
77
  render();
78
+ if (authStatus.authenticated) {
79
+ hideAuthGate();
80
+ } else {
81
+ showAuthGate(authStatus.configured);
82
+ }
83
 
84
  window.addEventListener("beforeunload", flushPendingSave);
85
 
 
393
  }
394
 
395
  function showAuthGate(configured) {
396
+ els.authGate.setAttribute("aria-busy", "false");
397
  els.authTitle.textContent = configured ? "登录" : "设置密码";
398
  els.authPassword.autocomplete = configured ? "current-password" : "new-password";
399
  els.authPassword.placeholder = configured ? "密码" : "设置至少 8 位密码";
 
402
  els.authPassword.focus();
403
  }
404
 
405
+ function hideAuthGate() {
406
+ els.authGate.hidden = true;
407
+ els.authGate.setAttribute("aria-busy", "false");
408
+ }
409
+
410
  function saveSelectedNote({ immediate = false } = {}) {
411
  saveUiState();
412
  const note = getSelectedNote();
index.html CHANGED
@@ -7,9 +7,9 @@
7
  <link rel="stylesheet" href="styles.css">
8
  </head>
9
  <body>
10
- <section class="auth-gate" id="authGate" hidden>
11
  <form class="auth-panel" id="authForm">
12
- <h1 id="authTitle">登录</h1>
13
  <input id="authPassword" type="password" autocomplete="current-password" minlength="8" placeholder="密码" aria-label="密码">
14
  <button id="authSubmit" type="submit">继续</button>
15
  <p id="authMessage"></p>
 
7
  <link rel="stylesheet" href="styles.css">
8
  </head>
9
  <body>
10
+ <section class="auth-gate" id="authGate" aria-busy="true">
11
  <form class="auth-panel" id="authForm">
12
+ <h1 id="authTitle">正在加载</h1>
13
  <input id="authPassword" type="password" autocomplete="current-password" minlength="8" placeholder="密码" aria-label="密码">
14
  <button id="authSubmit" type="submit">继续</button>
15
  <p id="authMessage"></p>