()
| 401 | } |
| 402 | |
| 403 | function updateNavigationButtons() { |
| 404 | const hasPrev = currentFileIndex > 0; |
| 405 | const hasNext = currentFileIndex >= 0 && currentFileIndex < currentFileList.length - 1; |
| 406 | |
| 407 | elements.prevFileBtn.disabled = !hasPrev; |
| 408 | elements.nextFileBtn.disabled = !hasNext; |
| 409 | |
| 410 | // 更新按钮提示文本 |
| 411 | if (currentFileIndex >= 0 && currentFileList.length > 0) { |
| 412 | const prevFile = hasPrev ? currentFileList[currentFileIndex - 1] : null; |
| 413 | const nextFile = hasNext ? currentFileList[currentFileIndex + 1] : null; |
| 414 | |
| 415 | elements.prevFileBtn.title = prevFile ? `上一个: ${prevFile.name}` : '没有上一个文件'; |
| 416 | elements.nextFileBtn.title = nextFile ? `下一个: ${nextFile.name}` : '没有下一个文件'; |
| 417 | } else { |
| 418 | elements.prevFileBtn.title = '上一个文件'; |
| 419 | elements.nextFileBtn.title = '下一个文件'; |
| 420 | } |
| 421 | } |
| 422 | |
| 423 | // 键盘快捷键处理 |
| 424 | function handleKeyboardShortcuts(event) { |
no outgoing calls
no test coverage detected