fix(ui): 移除 keys_status 自动刷新开关及相关逻辑

移除 keys_status 页面的自动刷新开关与定时器逻辑,删除模板中的
开关控件,并移除 initializeAutoRefreshControls 函数及其调用。周
期性刷新会重置分页和搜索状态,影响使用体验;保留手动刷新按钮以
在需要时更新数据。
This commit is contained in:
snaily
2025-08-18 03:19:59 +08:00
parent 96c4b4fa50
commit 7827283d0a
2 changed files with 0 additions and 61 deletions

View File

@@ -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(); // 初始化下拉菜单

View File

@@ -1103,24 +1103,6 @@ endblock %} {% block head_extra_styles %}
<!-- Increased max-width -->
<div class="glass-card rounded-2xl shadow-xl p-6 md:p-8">
<div class="absolute top-6 right-6 flex items-center gap-3">
<!-- 自动刷新开关 -->
<div class="flex items-center text-sm select-none font-semibold" style="color: #1f2937 !important;">
<span class="mr-2">自动刷新</span>
<div
class="relative inline-block w-10 mr-2 align-middle select-none transition duration-200 ease-in"
>
<input
type="checkbox"
name="autoRefreshToggle"
id="autoRefreshToggle"
class="toggle-checkbox absolute block w-6 h-6 rounded-full bg-white border-4 appearance-none cursor-pointer"
/>
<label
for="autoRefreshToggle"
class="toggle-label block overflow-hidden h-6 rounded-full bg-gray-300 cursor-pointer"
></label>
</div>
</div>
<!-- 手动刷新按钮 -->
<button
class="bg-white bg-opacity-20 hover:bg-opacity-30 rounded-full w-8 h-8 flex items-center justify-center text-primary-600 transition-all duration-300"