修复钓鱼通知与游戏配置保存问题

This commit is contained in:
pllx
2026-04-29 15:23:32 +08:00
parent c640a31302
commit 4fe4155ec0
5 changed files with 275 additions and 26 deletions
+17
View File
@@ -241,6 +241,7 @@ function startAutoFishingCooldown(cooldown) {
autoFishCooldownCountdown = window.setInterval(() => {
const remaining = Math.max(0, Math.ceil((endTime - Date.now()) / 1000));
setFishingButton(`⏳ 冷却 ${remaining}s`, true);
updateAutoFishStopButtonCountdown(remaining);
if (remaining <= 0) {
window.clearInterval(autoFishCooldownCountdown);
@@ -299,6 +300,22 @@ function showAutoFishStopButton(cooldown) {
document.body.appendChild(button);
}
/**
* 同步更新停止自动钓鱼浮层上的冷却秒数,避免与主按钮倒计时不一致。
*
* @param {number} cooldown
* @returns {void}
*/
function updateAutoFishStopButtonCountdown(cooldown) {
const hint = document.querySelector("#auto-fish-stop-btn .drag-hint");
if (!(hint instanceof HTMLElement)) {
return;
}
hint.textContent = `冷却 ${Number(cooldown) || 0}s · 可拖动`;
}
/**
* 给停止自动钓鱼按钮绑定拖拽和点击停止事件。
*