Projects STRLCPY link-lock Commits f098b46f
🤬
  • ■ ■ ■ ■
    index.html
    skipped 39 lines
    40 40   <hr />
    41 41   
    42 42   <label for="password">password</label>
    43  - <input type="password" id="password" />
     43 + <input type="password" id="password" autofocus />
    44 44   <button id="unlockbutton">Unlock link</button>
    45 45   </div>
    46 46   
    skipped 12 lines
  • ■ ■ ■ ■ ■
    index.js
    skipped 7 lines
    8 8  function main() {
    9 9   document.querySelector(".form").style.display = "inherit";
    10 10   document.querySelector("#password").value = "";
     11 + document.querySelector("#password").focus();
    11 12   document.querySelector(".error").style.display = "none";
    12 13   document.querySelector("#errortext").innerText = "";
    13 14   
    skipped 43 lines
    57 58   document.querySelector("#hint").innerText = "Hint: " + hint;
    58 59   }
    59 60   
    60  - document.querySelector("#unlockbutton").addEventListener("click", async () => {
    61  - password = document.querySelector("#password").value;
     61 + const unlockButton = document.querySelector("#unlockbutton");
     62 + const passwordPrompt = document.querySelector("#password");
     63 + passwordPrompt.addEventListener("keypress", (e) => {
     64 + if (e.key === "Enter") {
     65 + unlockButton.click();
     66 + }
     67 + });
     68 + unlockButton.addEventListener("click", async () => {
     69 + password = passwordPrompt.value;
    62 70   
    63 71   // Decrypt and redirect if possible
    64 72   let url;
    skipped 47 lines
Please wait...
Page is in error, reload to recover