feat: 取消跳过确认弹窗,简化操作逻辑
This commit is contained in:
+26
-23
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user