From 5fec876a9f3742153096e341593e02308adc4a91 Mon Sep 17 00:00:00 2001 From: QLHazyCoder <2825305047@qq.com> Date: Sat, 11 Apr 2026 17:27:27 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E5=8F=96=E6=B6=88=E8=B7=B3=E8=BF=87?= =?UTF-8?q?=E7=A1=AE=E8=AE=A4=E5=BC=B9=E7=AA=97=EF=BC=8C=E7=AE=80=E5=8C=96?= =?UTF-8?q?=E6=93=8D=E4=BD=9C=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sidepanel/sidepanel.js | 49 ++++++++++++++++++++++-------------------- 1 file changed, 26 insertions(+), 23 deletions(-) diff --git a/sidepanel/sidepanel.js b/sidepanel/sidepanel.js index f9ded6f..981e730 100644 --- a/sidepanel/sidepanel.js +++ b/sidepanel/sidepanel.js @@ -299,7 +299,7 @@ function updateSaveButtonState() { function scheduleSettingsAutoSave() { clearTimeout(settingsAutoSaveTimer); settingsAutoSaveTimer = setTimeout(() => { - saveSettings({ silent: true }).catch(() => {}); + saveSettings({ silent: true }).catch(() => { }); }, 500); } @@ -724,18 +724,15 @@ async function maybeTakeoverAutoRun(actionLabel) { } async function handleSkipStep(step) { - if (!(await maybeTakeoverAutoRun(`跳过步骤 ${step}`))) { - return; - } - - const confirmed = await openConfirmModal({ - title: '跳过步骤', - message: `这不会真正执行步骤 ${step},只会直接跳过该步骤并放行后续步骤。是否继续?`, - confirmLabel: `跳过步骤 ${step}`, - confirmVariant: 'btn-primary', - }); - if (!confirmed) { - return; + if (isAutoRunPausedPhase()) { + const takeoverResponse = await chrome.runtime.sendMessage({ + type: 'TAKEOVER_AUTO_RUN', + source: 'sidepanel', + payload: {}, + }); + if (takeoverResponse?.error) { + throw new Error(takeoverResponse.error); + } } const response = await chrome.runtime.sendMessage({ @@ -797,7 +794,7 @@ document.querySelectorAll('.step-btn').forEach(btn => { }); btnFetchEmail.addEventListener('click', async () => { - await fetchDuckEmail().catch(() => {}); + await fetchDuckEmail().catch(() => { }); }); btnTogglePassword.addEventListener('click', () => { @@ -815,7 +812,7 @@ btnSaveSettings.addEventListener('click', async () => { showToast('配置已是最新', 'info', 1400); return; } - await saveSettings({ silent: false }).catch(() => {}); + await saveSettings({ silent: false }).catch(() => { }); }); btnStop.addEventListener('click', async () => { @@ -929,7 +926,7 @@ inputVpsUrl.addEventListener('input', () => { scheduleSettingsAutoSave(); }); inputVpsUrl.addEventListener('blur', () => { - saveSettings({ silent: true }).catch(() => {}); + saveSettings({ silent: true }).catch(() => { }); }); inputVpsPassword.addEventListener('input', () => { @@ -937,7 +934,7 @@ inputVpsPassword.addEventListener('input', () => { scheduleSettingsAutoSave(); }); inputVpsPassword.addEventListener('blur', () => { - saveSettings({ silent: true }).catch(() => {}); + saveSettings({ silent: true }).catch(() => { }); }); inputPassword.addEventListener('input', () => { @@ -946,13 +943,13 @@ inputPassword.addEventListener('input', () => { scheduleSettingsAutoSave(); }); inputPassword.addEventListener('blur', () => { - saveSettings({ silent: true }).catch(() => {}); + saveSettings({ silent: true }).catch(() => { }); }); selectMailProvider.addEventListener('change', () => { updateMailProviderUI(); markSettingsDirty(true); - saveSettings({ silent: true }).catch(() => {}); + saveSettings({ silent: true }).catch(() => { }); }); inputInbucketMailbox.addEventListener('input', () => { @@ -960,7 +957,7 @@ inputInbucketMailbox.addEventListener('input', () => { scheduleSettingsAutoSave(); }); inputInbucketMailbox.addEventListener('blur', () => { - saveSettings({ silent: true }).catch(() => {}); + saveSettings({ silent: true }).catch(() => { }); }); inputInbucketHost.addEventListener('input', () => { @@ -968,12 +965,12 @@ inputInbucketHost.addEventListener('input', () => { scheduleSettingsAutoSave(); }); inputInbucketHost.addEventListener('blur', () => { - saveSettings({ silent: true }).catch(() => {}); + saveSettings({ silent: true }).catch(() => { }); }); inputAutoSkipFailures.addEventListener('change', () => { markSettingsDirty(true); - saveSettings({ silent: true }).catch(() => {}); + saveSettings({ silent: true }).catch(() => { }); }); // ============================================================ @@ -1009,7 +1006,7 @@ chrome.runtime.onMessage.addListener((message) => { } } } - ).catch(() => {}); + ).catch(() => { }); break; } @@ -1105,7 +1102,13 @@ btnTheme.addEventListener('click', () => { initializeManualStepActions(); initTheme(); +updateToastOffset(); updateSaveButtonState(); +window.addEventListener('resize', updateToastOffset); +window.addEventListener('load', updateToastOffset); +if (document.fonts?.ready) { + document.fonts.ready.then(updateToastOffset).catch(() => { }); +} restoreState().then(() => { syncPasswordToggleLabel(); syncVpsUrlToggleLabel();