(message, type = 'info')
| 519 | // 工具函数 |
| 520 | // ===================================================================== |
| 521 | function showStatus(message, type = 'info') { |
| 522 | const statusSection = document.getElementById('statusSection'); |
| 523 | if (statusSection) { |
| 524 | // 清除之前的定时器 |
| 525 | if (window._statusTimeout) { |
| 526 | clearTimeout(window._statusTimeout); |
| 527 | } |
| 528 | |
| 529 | // 创建新的 toast |
| 530 | statusSection.innerHTML = `<div class="status ${type}">${message}</div>`; |
| 531 | const statusDiv = statusSection.querySelector('.status'); |
| 532 | |
| 533 | // 强制重绘以触发动画 |
| 534 | statusDiv.offsetHeight; |
| 535 | statusDiv.classList.add('show'); |
| 536 | |
| 537 | // 3秒后淡出并移除 |
| 538 | window._statusTimeout = setTimeout(() => { |
| 539 | statusDiv.classList.add('fade-out'); |
| 540 | setTimeout(() => { |
| 541 | statusSection.innerHTML = ''; |
| 542 | }, 300); // 等待淡出动画完成 |
| 543 | }, 3000); |
| 544 | } else { |
| 545 | showMessageModal('提示', message, 'info'); |
| 546 | } |
| 547 | } |
| 548 | |
| 549 | // 将文本中的链接转换为可点击的HTML链接 |
| 550 | function linkifyText(text) { |
no test coverage detected