diff --git a/src/app/play/page.tsx b/src/app/play/page.tsx index 05348a3..fe6f195 100644 --- a/src/app/play/page.tsx +++ b/src/app/play/page.tsx @@ -1975,48 +1975,13 @@ function PlayPageClient() { }, }); artPlayerRef.current.setting.update({ - name: '设置片头', - html: '设置片头', - icon: '', + name: '跳过配置', + html: '跳过配置', + icon: '', tooltip: - skipConfigRef.current.intro_time === 0 - ? '设置片头时间' - : `${formatTime(skipConfigRef.current.intro_time)}`, - onClick: function () { - const currentTime = artPlayerRef.current?.currentTime || 0; - if (currentTime > 0) { - const newConfig = { - ...skipConfigRef.current, - intro_time: currentTime, - }; - handleSkipConfigChange(newConfig); - return `${formatTime(currentTime)}`; - } - }, - }); - artPlayerRef.current.setting.update({ - name: '设置片尾', - html: '设置片尾', - icon: '', - tooltip: - skipConfigRef.current.outro_time >= 0 - ? '设置片尾时间' - : `-${formatTime(-skipConfigRef.current.outro_time)}`, - onClick: function () { - const outroTime = - -( - artPlayerRef.current?.duration - - artPlayerRef.current?.currentTime - ) || 0; - if (outroTime < 0) { - const newConfig = { - ...skipConfigRef.current, - outro_time: outroTime, - }; - handleSkipConfigChange(newConfig); - return `-${formatTime(-outroTime)}`; - } - }, + skipConfigRef.current.intro_time === 0 && skipConfigRef.current.outro_time === 0 + ? '设置跳过配置' + : `片头: ${formatTime(skipConfigRef.current.intro_time)} | 片尾: ${formatTime(Math.abs(skipConfigRef.current.outro_time))}`, }); } catch (settingErr) { console.warn('更新播放器设置失败:', settingErr); @@ -3918,63 +3883,166 @@ function PlayPageClient() { }, }, { - html: '删除跳过配置', - onClick: function () { - handleSkipConfigChange({ - enable: false, - intro_time: 0, - outro_time: 0, - }); - return ''; - }, - }, - { - name: '设置片头', - html: '设置片头', - icon: '', + name: '跳过配置', + html: '跳过配置', + icon: '', tooltip: - skipConfigRef.current.intro_time === 0 - ? '设置片头时间' - : `${formatTime(skipConfigRef.current.intro_time)}`, - onClick: function () { - // 安全地获取当前播放时间,避免循环依赖 + skipConfigRef.current.intro_time === 0 && skipConfigRef.current.outro_time === 0 + ? '设置跳过配置' + : `片头: ${formatTime(skipConfigRef.current.intro_time)} | 片尾: ${formatTime(Math.abs(skipConfigRef.current.outro_time))}`, + onClick: async function () { const player = artPlayerRef.current; - if (player && player.currentTime) { - const currentTime = player.currentTime || 0; - if (currentTime > 0) { + if (player) { + // 如果处于全屏状态,先退出全屏 + if (player.fullscreen) { + player.fullscreen = false; + // 等待全屏退出动画完成 + await new Promise(resolve => setTimeout(resolve, 300)); + } + + // 使用 ArtPlayer 的 prompt 功能创建输入弹窗 + const currentIntro = skipConfigRef.current.intro_time || 0; + const currentOutro = Math.abs(skipConfigRef.current.outro_time) || 0; + + // 创建一个自定义的提示框 + const container = document.createElement('div'); + container.style.cssText = ` + position: fixed; + top: 50%; + left: 50%; + transform: translate(-50%, -50%); + background: rgba(0, 0, 0, 0.9); + padding: 20px; + border-radius: 8px; + z-index: 9999; + min-width: 300px; + box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5); + `; + + container.innerHTML = ` +