From 512b7f36ce3e6d34d70ae2108c4e21135c47a52b Mon Sep 17 00:00:00 2001
From: huangxd- <649924757@qq.com>
Date: Thu, 12 Mar 2026 23:36:31 +0800
Subject: [PATCH] =?UTF-8?q?=E6=8E=A8=E9=80=81=E5=BC=B9=E5=B9=95=E6=A0=87?=
=?UTF-8?q?=E7=AD=BE=E9=A1=B5=E5=92=8C=E5=BC=B9=E5=B9=95=E6=B5=8B=E8=AF=95?=
=?UTF-8?q?=E6=A0=87=E7=AD=BE=E9=A1=B5=E4=B8=AD=E6=96=B0=E5=A2=9E=E8=B7=B3?=
=?UTF-8?q?=E8=BD=AC=E5=88=B0=E6=8C=87=E5=AE=9A=E9=9B=86=E6=95=B0=E7=9A=84?=
=?UTF-8?q?=E5=8A=9F=E8=83=BD=20(#229)?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
* 推送弹幕标签页和弹幕测试标签页中新增跳转到指定集数的功能,解决比如像名侦探柯南这种集数很多的剧,要滑动很久才能定位到集的问题
* 修复两边都渲染后冲突的问题
---
danmu_api/configs/globals.js | 2 +-
danmu_api/ui/js/apitest.js | 38 ++++++++++++++++++++++++++++++-
danmu_api/ui/js/pushdanmu.js | 43 +++++++++++++++++++++++++++++++++---
3 files changed, 78 insertions(+), 5 deletions(-)
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) {
// 获取推送按钮元素