diff --git a/danmu_api/configs/globals.js b/danmu_api/configs/globals.js index 1fa9a2c..4f09105 100644 --- a/danmu_api/configs/globals.js +++ b/danmu_api/configs/globals.js @@ -13,7 +13,7 @@ export const Globals = { accessedEnvVars: {}, // 静态常量 - VERSION: '1.16.1', + VERSION: '1.16.2', MAX_LOGS: 1000, // 日志存储,最多保存 1000 行 MAX_ANIMES: 100, MAX_RECORDS: 100, // 请求记录最大数量 diff --git a/danmu_api/ui/js/apitest.js b/danmu_api/ui/js/apitest.js index ab053de..2726c06 100644 --- a/danmu_api/ui/js/apitest.js +++ b/danmu_api/ui/js/apitest.js @@ -579,10 +579,21 @@ function displayManualEpisodeList(animeTitle, episodes) { let html = backBtnHtml('返回搜索结果', 'backToManualSearch()'); html += '

剧集列表

'; html += '

' + escapeHtml(animeTitle) + '

'; + + // 添加跳转到指定集数的功能 + html += \` +
+ 跳转到第 + + 集 + + 共\${episodes.length}集 +
\`; + html += '
'; episodes.forEach(ep => { const title = escapeHtml(animeTitle) + ' 第' + ep.episodeNumber + '集'; - html += '
'; + html += '
'; html += '
第' + ep.episodeNumber + '集 - ' + escapeHtml(ep.episodeTitle || '无标题') + '
'; html += ''; html += '
'; @@ -603,6 +614,31 @@ function backToEpisodeList() { showDanmuView(['manual-episode-list'], ['danmu-result-area']); } +// 跳转到指定集数 +function jumpToEpisode() { + const episodeInput = document.getElementById('jump-episode-input'); + const episodeNumber = parseInt(episodeInput.value); + + if (!episodeNumber || episodeNumber <= 0) { + customAlert('请输入有效的集数(正整数)'); + return; + } + + // 查找对应集数的元素 + const episodeElement = document.getElementById('episode-item-' + episodeNumber); + if (episodeElement) { + // 滚动到指定元素位置 + episodeElement.scrollIntoView({ behavior: 'smooth', block: 'center' }); + // 添加高亮效果以便识别 + episodeElement.style.backgroundColor = '#fff3cd'; // 黄色背景高亮 + setTimeout(() => { + episodeElement.style.backgroundColor = ''; // 恢复原色 + }, 2000); + } else { + customAlert('找不到第' + episodeNumber + '集'); + } +} + // ===================== // 获取弹幕并展示结果 // ===================== diff --git a/danmu_api/ui/js/pushdanmu.js b/danmu_api/ui/js/pushdanmu.js index caeb7c9..0dc1f2c 100644 --- a/danmu_api/ui/js/pushdanmu.js +++ b/danmu_api/ui/js/pushdanmu.js @@ -138,13 +138,25 @@ function getBangumiForPush(animeId, pushUrl) { // 展示剧集列表用于推送 function displayEpisodeListForPush(animeTitle, episodes, pushUrl) { const container = document.getElementById('push-episode-list'); - let html = \`

剧集列表

\${animeTitle}

\`; - + let html = \`

剧集列表

\${animeTitle}

\`; + + // 添加跳转到指定集数的功能 + html += \` +
+ 跳转到第 + + 集 + + 共\${episodes.length}集 +
\`; + + html += '
'; + episodes.forEach(episode => { // 生成弹幕URL const commentUrl = window.location.origin + buildApiUrl('/api/v2/comment/' + episode.episodeId + '?format=xml'); html += \` -
+
第\${episode.episodeNumber}集 - \${episode.episodeTitle || '无标题'}
@@ -165,6 +177,31 @@ function displayEpisodeListForPush(animeTitle, episodes, pushUrl) { }, 10); } +// 跳转到指定集数(推送弹幕版) +function jumpToEpisodeForPushDanmu() { + const episodeInput = document.getElementById('jump-episode-input-push'); + const episodeNumber = parseInt(episodeInput.value); + + if (!episodeNumber || episodeNumber <= 0) { + customAlert('请输入有效的集数(正整数)'); + return; + } + + // 查找对应集数的元素 + const episodeElement = document.getElementById('episode-item-push-' + episodeNumber); + if (episodeElement) { + // 滚动到指定元素位置 + episodeElement.scrollIntoView({ behavior: 'smooth', block: 'center' }); + // 添加高亮效果以便识别 + episodeElement.style.backgroundColor = '#fff3cd'; // 黄色背景高亮 + setTimeout(() => { + episodeElement.style.backgroundColor = ''; // 恢复原色 + }, 2000); + } else { + customAlert('找不到第' + episodeNumber + '集'); + } +} + // 推送弹幕 async function pushDanmu(pushUrl, commentUrl, episodeTitle) { // 获取推送按钮元素