删除域名时二次确认
This commit is contained in:
@@ -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"
|
||||
|
||||
@@ -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": "日志 - 未找到密码输入框"
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
/**
|
||||
* 连续自动提交达到上限时的可见提示。
|
||||
* 只写日志的话用户完全不知道"为什么只填不提交"(调试日志默认还是静默的)。
|
||||
|
||||
@@ -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"));
|
||||
|
||||
Reference in New Issue
Block a user