@@ -272,6 +272,80 @@ <h3 class="font-bold text-sm md:text-base mb-1">{{ rec_movie.vod_name }}</h3>
272272 initPlayHistory ( ) ;
273273 } ) ;
274274
275+ // 播放结束时显示下一集提示
276+ function showNextEpisodeModal ( ) {
277+ const nextBtn = document . getElementById ( 'nextEpisode' ) ;
278+ if ( ! nextBtn || nextBtn . disabled ) {
279+ // 没有下一集,不显示提示
280+ return ;
281+ }
282+
283+ const nextUrl = nextBtn . getAttribute ( 'data-url' ) ;
284+ if ( ! nextUrl ) {
285+ return ;
286+ }
287+
288+ // 创建modal弹窗
289+ const modal = document . createElement ( 'div' ) ;
290+ modal . id = 'nextEpisodeModal' ;
291+ modal . innerHTML = `
292+ <div id="nextEpisodeModalOverlay" class="fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50">
293+ <div class="bg-card-bg rounded-2xl p-6 md:p-8 max-w-md mx-4 shadow-xl">
294+ <h3 class="text-xl md:text-2xl font-bold mb-4 text-center">即将播放下一集</h3>
295+ <p class="text-secondary mb-6 text-center">
296+ 将在 <span id="countdown" class="text-primary font-bold text-lg">5</span> 秒后自动播放下一集
297+ </p>
298+ <div class="flex gap-4 justify-center">
299+ <button id="playNextBtn" class="bg-primary hover:bg-primary-dark text-white px-6 py-3 rounded-lg font-medium transition-colors">
300+ <i class="fas fa-play mr-2"></i>立刻播放
301+ </button>
302+ <button id="cancelBtn" class="bg-gray-600 hover:bg-gray-700 text-white px-6 py-3 rounded-lg font-medium transition-colors">
303+ <i class="fas fa-times mr-2"></i>取消
304+ </button>
305+ </div>
306+ </div>
307+ </div>
308+ ` ;
309+ document . body . appendChild ( modal ) ;
310+
311+ let countdown = 5 ;
312+ const countdownElement = document . getElementById ( 'countdown' ) ;
313+ const playNextBtn = document . getElementById ( 'playNextBtn' ) ;
314+ const cancelBtn = document . getElementById ( 'cancelBtn' ) ;
315+ const modalOverlay = document . getElementById ( 'nextEpisodeModalOverlay' ) ;
316+
317+ // 倒计时功能
318+ const countdownInterval = setInterval ( ( ) => {
319+ countdown -- ;
320+ countdownElement . textContent = countdown ;
321+
322+ if ( countdown <= 0 ) {
323+ clearInterval ( countdownInterval ) ;
324+ window . location . href = nextUrl ;
325+ }
326+ } , 1000 ) ;
327+
328+ // 立刻播放按钮
329+ playNextBtn . addEventListener ( 'click' , ( ) => {
330+ clearInterval ( countdownInterval ) ;
331+ window . location . href = nextUrl ;
332+ } ) ;
333+
334+ // 取消按钮
335+ cancelBtn . addEventListener ( 'click' , ( ) => {
336+ clearInterval ( countdownInterval ) ;
337+ modal . remove ( ) ;
338+ } ) ;
339+
340+ // 点击背景关闭
341+ modalOverlay . addEventListener ( 'click' , ( e ) => {
342+ if ( e . target === modalOverlay ) {
343+ clearInterval ( countdownInterval ) ;
344+ modal . remove ( ) ;
345+ }
346+ } ) ;
347+ }
348+
275349 // VIP权限验证函数
276350 async function checkVipAccess ( ) {
277351 const videoId = "{{ video._id['$oid'] }}" ;
@@ -422,6 +496,9 @@ <h3 class="text-2xl font-bold mb-2">VIP专享内容</h3>
422496 const video = document . getElementById ( 'video-player' ) ;
423497 const videoSrc = video . querySelector ( 'source' ) . src ;
424498
499+ // Add video ended event listener
500+ video . addEventListener ( 'ended' , showNextEpisodeModal ) ;
501+
425502 // Check if the video source is an m3u8 file
426503 if ( videoSrc . includes ( '.m3u8' ) ) {
427504 // Use HLS.js for m3u8 files
0 commit comments