@@ -3363,10 +3407,10 @@ class CLIProxyManager {
${this.escapeHtml(jsonContent)}
@@ -3383,13 +3427,40 @@ class CLIProxyManager {
// 添加新模态框
document.body.insertAdjacentHTML('beforeend', modalHtml);
- // 添加点击背景关闭功能
+ // 获取模态框元素
const modal = document.getElementById('json-modal');
+
+ // 添加点击背景关闭功能
modal.addEventListener('click', (e) => {
if (e.target === modal) {
this.closeJsonModal();
}
});
+
+ // 绑定模态框按钮事件(使用事件委托)
+ this.bindJsonModalEvents(modal);
+ }
+
+ // 绑定JSON模态框按钮事件(使用事件委托)
+ bindJsonModalEvents(modal) {
+ modal.addEventListener('click', (e) => {
+ // 查找最近的按钮元素
+ const button = e.target.closest('button[data-action]');
+ if (!button) return;
+
+ // 获取操作类型
+ const action = button.dataset.action;
+
+ // 根据操作类型调用相应的方法
+ switch (action) {
+ case 'copy':
+ this.copyJsonContent();
+ break;
+ case 'close':
+ this.closeJsonModal();
+ break;
+ }
+ });
}
// 关闭JSON模态框
@@ -3413,13 +3484,6 @@ class CLIProxyManager {
}
}
- // HTML转义函数
- escapeHtml(text) {
- const div = document.createElement('div');
- div.textContent = text;
- return div.innerHTML;
- }
-
// 下载认证文件
async downloadAuthFile(filename) {
try {
diff --git a/styles.css b/styles.css
index 1d87d29..11a2410 100644
--- a/styles.css
+++ b/styles.css
@@ -1701,6 +1701,10 @@ input:checked+.slider:before {
transition: all 0.3s ease;
}
+.file-item.hidden {
+ display: none;
+}
+
.key-item:hover,
.provider-item:hover,
.file-item:hover {