mirror of
https://github.com/snailyp/gemini-balance.git
synced 2026-09-05 07:26:39 +08:00
fix(ui): 移除 keys_status 自动刷新开关及相关逻辑
移除 keys_status 页面的自动刷新开关与定时器逻辑,删除模板中的 开关控件,并移除 initializeAutoRefreshControls 函数及其调用。周 期性刷新会重置分页和搜索状态,影响使用体验;保留手动刷新按钮以 在需要时更新数据。
This commit is contained in:
@@ -1188,48 +1188,6 @@ function initializeKeySelectionListeners() {
|
||||
setupEventListenersForList("invalidKeys", "invalid");
|
||||
}
|
||||
|
||||
function initializeAutoRefreshControls() {
|
||||
const autoRefreshToggle = document.getElementById("autoRefreshToggle");
|
||||
const autoRefreshIntervalTime = 60000; // 60秒
|
||||
let autoRefreshTimer = null;
|
||||
|
||||
function startAutoRefresh() {
|
||||
if (autoRefreshTimer) return;
|
||||
console.log("启动自动刷新...");
|
||||
showNotification("自动刷新已启动", "info", 2000);
|
||||
autoRefreshTimer = setInterval(() => {
|
||||
console.log("自动刷新 keys_status 页面...");
|
||||
location.reload();
|
||||
}, autoRefreshIntervalTime);
|
||||
}
|
||||
|
||||
function stopAutoRefresh() {
|
||||
if (autoRefreshTimer) {
|
||||
console.log("停止自动刷新...");
|
||||
showNotification("自动刷新已停止", "info", 2000);
|
||||
clearInterval(autoRefreshTimer);
|
||||
autoRefreshTimer = null;
|
||||
}
|
||||
}
|
||||
|
||||
if (autoRefreshToggle) {
|
||||
const isAutoRefreshEnabled =
|
||||
localStorage.getItem("autoRefreshEnabled") === "true";
|
||||
autoRefreshToggle.checked = isAutoRefreshEnabled;
|
||||
if (isAutoRefreshEnabled) {
|
||||
startAutoRefresh();
|
||||
}
|
||||
autoRefreshToggle.addEventListener("change", () => {
|
||||
if (autoRefreshToggle.checked) {
|
||||
localStorage.setItem("autoRefreshEnabled", "true");
|
||||
startAutoRefresh();
|
||||
} else {
|
||||
localStorage.setItem("autoRefreshEnabled", "false");
|
||||
stopAutoRefresh();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
// Debounce function
|
||||
function debounce(func, delay) {
|
||||
@@ -1485,7 +1443,6 @@ document.addEventListener("DOMContentLoaded", () => {
|
||||
initializeKeyFilterControls();
|
||||
initializeGlobalBatchVerificationHandlers();
|
||||
initializeKeySelectionListeners();
|
||||
initializeAutoRefreshControls();
|
||||
initializeKeyPaginationAndSearch(); // This will also handle initial display
|
||||
registerServiceWorker();
|
||||
initializeDropdownMenu(); // 初始化下拉菜单
|
||||
|
||||
Reference in New Issue
Block a user