From 98ab5b5b7d29c43566a54e080c8dcef30f109fc9 Mon Sep 17 00:00:00 2001 From: "yinjun.chen1" Date: Fri, 18 Sep 2026 10:08:27 +0800 Subject: [PATCH] =?UTF-8?q?=E5=88=A0=E9=99=A4=E5=9F=9F=E5=90=8D=E6=97=B6?= =?UTF-8?q?=E4=BA=8C=E6=AC=A1=E7=A1=AE=E8=AE=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- _locales/en/messages.json | 8 ++++++++ _locales/zh_CN/messages.json | 8 ++++++++ src/content.ts | 33 +++++++++++++++++++++++++++++++++ src/popup/config-list.ts | 2 ++ 4 files changed, 51 insertions(+) diff --git a/_locales/en/messages.json b/_locales/en/messages.json index eb1b8a6..c51c24b 100644 --- a/_locales/en/messages.json +++ b/_locales/en/messages.json @@ -523,6 +523,10 @@ "message": "Delete environment \"$1\"?", "description": "Confirm delete empty env, $1 env name" }, + "confirmDeleteConfig": { + "message": "Delete \"$1\"?", + "description": "Confirm delete domain config, $1 alias or domain" + }, "toastEnvDeleted": { "message": "Environment deleted", "description": "Toast - env deleted" @@ -767,6 +771,10 @@ "message": "$1. Credentials filled. Complete the captcha and click login.", "description": "Captcha toast body, $1 reason" }, + "fillToastMsg": { + "message": "Username and password filled", + "description": "Fill complete lightweight toast" + }, "logNoPasswordField": { "message": "Password input not found", "description": "Log - no password field" diff --git a/_locales/zh_CN/messages.json b/_locales/zh_CN/messages.json index 5f6088f..1e92a58 100644 --- a/_locales/zh_CN/messages.json +++ b/_locales/zh_CN/messages.json @@ -523,6 +523,10 @@ "message": "确认删除环境「$1」?", "description": "删除空环境确认,$1 为环境名" }, + "confirmDeleteConfig": { + "message": "确认删除「$1」?", + "description": "删除域名配置确认,$1 为别名或域名" + }, "toastEnvDeleted": { "message": "已删除环境", "description": "toast - 删除环境成功" @@ -755,6 +759,10 @@ "message": "$1,已为你填充账密,请完成验证码后点击登录", "description": "验证码浮窗内容,$1 为检测原因" }, + "fillToastMsg": { + "message": "已填充用户名和密码", + "description": "填充完成轻量提示" + }, "logNoPasswordField": { "message": "未找到密码输入框", "description": "日志 - 未找到密码输入框" diff --git a/src/content.ts b/src/content.ts index 13ae497..3174b29 100644 --- a/src/content.ts +++ b/src/content.ts @@ -340,6 +340,7 @@ function fillForm(config: Config, canSubmit = true, onSubmitted?: () => void): b setNativeValue(passwordField, config.password); debugLog(t("logFilledPassword")); + showFillToast(); // 检测到验证码则强制不自动提交,提示用户手动操作 const captcha = detectCaptcha(); @@ -425,6 +426,38 @@ function showCaptchaToast(reason: string): void { showPageToast(t("captchaToastTitle"), t("captchaToastBody", reason)); } +/** 填充完成轻量提示:右下角小浮条,2 秒自动消失 */ +let fillToastEl: HTMLElement | null = null; +function showFillToast(): void { + if (!isTopFrame()) return; + if (fillToastEl && fillToastEl.parentNode) fillToastEl.parentNode.removeChild(fillToastEl); + const el = document.createElement("div"); + el.style.cssText = ` + position: fixed; + bottom: 16px; + right: 16px; + z-index: 2147483647; + background: #1a1a2e; + border: 1px solid #27ae60; + border-radius: 6px; + padding: 6px 12px; + color: #e0e0e0; + font-size: 12px; + font-family: "Segoe UI","Microsoft YaHei",sans-serif; + box-shadow: 0 2px 8px rgba(0,0,0,0.3); + opacity: 0; + transition: opacity 0.2s; + `; + el.textContent = t("fillToastMsg"); + document.body.appendChild(el); + requestAnimationFrame(() => (el.style.opacity = "1")); + fillToastEl = el; + setTimeout(() => { + if (el && el.parentNode) el.parentNode.removeChild(el); + fillToastEl = null; + }, 2000); +} + /** * 连续自动提交达到上限时的可见提示。 * 只写日志的话用户完全不知道"为什么只填不提交"(调试日志默认还是静默的)。 diff --git a/src/popup/config-list.ts b/src/popup/config-list.ts index 031e06d..18896e3 100644 --- a/src/popup/config-list.ts +++ b/src/popup/config-list.ts @@ -213,6 +213,8 @@ export function initConfigList(ctx: PopupCtx) { delItem.addEventListener("click", async (e) => { e.stopPropagation(); closeAllMenus(); + const label = cfg.alias || cfg.domain; + if (!confirm(t("confirmDeleteConfig", label))) return; const updated = configs.filter((c) => c.id !== cfg.id); await saveConfigs(updated); ctx.showToast(t("toastDeleted"));