From 0773da941db056dc22cd4658cbcc3169fd227525 Mon Sep 17 00:00:00 2001 From: chenxuan Date: Tue, 15 Sep 2026 01:09:11 +0800 Subject: [PATCH] 111 --- _locales/en/messages.json | 4 ++-- _locales/zh_CN/messages.json | 4 ++-- background.js | 2 ++ popup.css | 39 +++++++++++++++++++++--------------- popup.html | 11 ++++++---- popup.js | 17 +++++++++++++--- 6 files changed, 50 insertions(+), 27 deletions(-) diff --git a/_locales/en/messages.json b/_locales/en/messages.json index 3bf916e..4cabe33 100644 --- a/_locales/en/messages.json +++ b/_locales/en/messages.json @@ -260,8 +260,8 @@ "description": "Update config button" }, "configuredDomainsTitle": { - "message": "Configured Domains", - "description": "Configured domains section title" + "message": "Domain List", + "description": "Domain list section title" }, "exportBtn": { "message": "Export", diff --git a/_locales/zh_CN/messages.json b/_locales/zh_CN/messages.json index 2c30191..b343c67 100644 --- a/_locales/zh_CN/messages.json +++ b/_locales/zh_CN/messages.json @@ -260,8 +260,8 @@ "description": "更新配置按钮" }, "configuredDomainsTitle": { - "message": "已配置域名", - "description": "已配置域名区标题" + "message": "域名清单", + "description": "域名清单区标题" }, "exportBtn": { "message": "导出", diff --git a/background.js b/background.js index 85678c3..cf2b980 100644 --- a/background.js +++ b/background.js @@ -7,6 +7,8 @@ const AUTO_LOCK_MS = 10 * 60 * 1000; // 10 分钟无操作自动锁定 chrome.runtime.onInstalled.addListener(() => { chrome.sidePanel.setPanelBehavior({ openPanelOnActionClick: true }) .catch((err) => console.warn("[AutoLogin] 设置 sidePanel 行为失败:", err)); + chrome.sidePanel.setOptions({ panelWidth: 340 }) + .catch((err) => console.warn("[AutoLogin] 设置 sidePanel 宽度失败:", err)); migrateLegacyVault(); console.log("[AutoLogin] 扩展已安装"); }); diff --git a/popup.css b/popup.css index 0213db5..3ec8fd3 100644 --- a/popup.css +++ b/popup.css @@ -4,6 +4,10 @@ box-sizing: border-box; } +[hidden] { + display: none !important; +} + body { width: 100%; min-width: 0; @@ -214,35 +218,37 @@ h2 { line-height: 0; } -/* 悬浮搜索框 */ -.search-box { - position: absolute; - top: 38px; - right: 0; - z-index: 50; +/* 内联展开式搜索框:点击搜索图标后向左展开 */ +.search-box-inline { align-items: center; - gap: 4px; + gap: 0; background: #16213e; border: 1px solid #0f3460; border-radius: 6px; - padding: 6px 8px; - box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4); - width: 220px; + padding: 0 2px; + width: 190px; + height: 24px; box-sizing: border-box; + overflow: hidden; } -.search-box:not([hidden]) { +.search-box-inline:not([hidden]) { display: flex; } -.search-box input { +.search-box-inline .btn-icon { + padding: 2px; +} + +.search-box-inline input { flex: 1; min-width: 0; background: transparent; border: none; color: #e0e0e0; - font-size: 13px; + font-size: 12px; outline: none; + padding: 2px 2px; } .search-clear { @@ -251,7 +257,7 @@ h2 { color: #888; cursor: pointer; font-size: 16px; - padding: 0 4px; + padding: 0 2px; line-height: 1; } @@ -746,12 +752,13 @@ h2 { .list-actions { display: flex; + align-items: center; gap: 6px; } .btn-io { padding: 4px 10px; - background: #0f3460; + background: transparent; border: none; border-radius: 6px; color: #e0e0e0; @@ -761,7 +768,7 @@ h2 { } .btn-io:hover { - background: #1a4a8a; + background: #0f3460; } .config-item { diff --git a/popup.html b/popup.html index 2f291fa..544b858 100644 --- a/popup.html +++ b/popup.html @@ -129,6 +129,13 @@ + @@ -138,10 +145,6 @@ -
diff --git a/popup.js b/popup.js index 576da3d..8e7330a 100644 --- a/popup.js +++ b/popup.js @@ -88,6 +88,7 @@ document.addEventListener("DOMContentLoaded", () => { const searchBox = $("searchBox"); const searchInput = $("searchInput"); const searchClear = $("searchClear"); + const searchToggleBtn = $("searchToggleBtn"); let searchKeyword = ""; // 锁定界面 @@ -925,10 +926,20 @@ document.addEventListener("DOMContentLoaded", () => { editDomainInput.focus(); }); - // 搜索按钮:切换悬浮搜索框 + // 搜索按钮:展开内联搜索框 searchBtn.addEventListener("click", () => { - searchBox.hidden = !searchBox.hidden; - if (!searchBox.hidden) searchInput.focus(); + searchBtn.hidden = true; + searchBox.hidden = false; + searchInput.focus(); + }); + + // 搜索框内搜索图标:收起回图标按钮 + searchToggleBtn.addEventListener("click", () => { + searchInput.value = ""; + searchKeyword = ""; + searchBox.hidden = true; + searchBtn.hidden = false; + renderConfigList(); }); // 搜索输入:实时过滤