修复钓鱼通知与游戏配置保存问题
This commit is contained in:
@@ -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 · 可拖动`;
|
||||
}
|
||||
|
||||
/**
|
||||
* 给停止自动钓鱼按钮绑定拖拽和点击停止事件。
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user