From 2611874b14cccab727e43a5f0aa623e5d21cfdc0 Mon Sep 17 00:00:00 2001 From: Warren Date: Sat, 16 May 2026 21:41:55 +0800 Subject: [PATCH] feat: Add Enter key support for admin password input MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit UX improvement: - Password input now accepts Enter key to submit - Added onkeypress=handleAdminKeyPress(event) to input field - New function handleAdminKeyPress(e) checks for Enter key - Enter key triggers submitAdminLogin() Implementation: - Modified showAdminLoginModal() to add onkeypress handler - Added handleAdminKeyPress(e) function - Supports both e.key==='Enter' and e.keyCode===13 (cross-browser) User workflow: 1. Open Settings → Password modal appears 2. Type password: admin123 3. Press Enter → Login submits (no need to click button) 4. Or click Login button → Both methods work Files changed: src/page.html (+8 lines) UX: Faster login, keyboard-friendly interface --- src/page.html | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/page.html b/src/page.html index f234da2..94dd215 100644 --- a/src/page.html +++ b/src/page.html @@ -197,7 +197,7 @@ function showAdminLoginModal(){ m.id='mb-admin-modal'; m.innerHTML=''+ '
Admin Authentication Required
'+ - ''+ + ''+ ''+ '
'; document.body.appendChild(m); @@ -209,6 +209,12 @@ function showAdminLoginModal(){ document.getElementById('admin-password').focus(); } +function handleAdminKeyPress(e){ + if(e.key==='Enter'||e.keyCode===13){ + submitAdminLogin(); + } +} + function submitAdminLogin(){ var pwd=document.getElementById('admin-password').value;