(message, isError = false)
| 281 | |
| 282 | // 显示通知 |
| 283 | function showNotification(message, isError = false) { |
| 284 | // 移除现有通知 |
| 285 | const existingNotification = document.querySelector('.notification'); |
| 286 | if (existingNotification) { |
| 287 | existingNotification.remove(); |
| 288 | } |
| 289 | |
| 290 | // 创建新通知 |
| 291 | const notification = document.createElement('div'); |
| 292 | notification.className = 'notification' + (isError ? ' error' : ''); |
| 293 | notification.textContent = message; |
| 294 | |
| 295 | // 添加到文档 |
| 296 | document.body.appendChild(notification); |
| 297 | |
| 298 | // 显示通知 |
| 299 | setTimeout(() => notification.classList.add('show'), 10); |
| 300 | |
| 301 | // 自动隐藏 |
| 302 | setTimeout(() => { |
| 303 | notification.classList.remove('show'); |
| 304 | setTimeout(() => notification.remove(), 300); |
| 305 | }, 3000); |
| 306 | } |
| 307 | |
| 308 | // 解析输入数据 |
| 309 | function parseInputData() { |
no test coverage detected