From 707eb063c3197551a774869e7695234e20e91761 Mon Sep 17 00:00:00 2001 From: the1812 Date: Thu, 17 Mar 2022 22:27:30 +0800 Subject: [PATCH] Disable auto play on last video (#2940) --- .../components/video/player/legacy-auto-play/index.ts | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/registry/lib/components/video/player/legacy-auto-play/index.ts b/registry/lib/components/video/player/legacy-auto-play/index.ts index f841ceee3..fa422d273 100644 --- a/registry/lib/components/video/player/legacy-auto-play/index.ts +++ b/registry/lib/components/video/player/legacy-auto-play/index.ts @@ -7,7 +7,7 @@ import { videoUrls } from '@/core/utils/urls' export const component: ComponentMetadata = { name: 'legacyAutoPlay', displayName: '传统连播模式', - description: '模拟传统的多 P 连播策略: 仅连播视频的分 P 和番剧的多集, 最后 1P 放完禁止连播其他推荐视频.', + description: '模拟传统的多 P 连播策略: 仅连播视频的分 P, 最后 1P 放完禁止连播其他推荐视频.', tags: [componentsTags.video], urlInclude: videoUrls, entry: async () => { @@ -19,10 +19,15 @@ export const component: ComponentMetadata = { ], disable: ['.recommend-list .next-button'], } + // 最后 1P 时不能开启连播 const disableConditions = [ - // 最后 1P 时不能开启连播 + // 传统分 P () => Boolean(dq('.multi-page .list-box li.on:last-child')), - // TODO: 合计列表如何确定是最后 1P? + // 替代分 P 的合集 + // & 可分子合集的分 P 合集, 布局长得比下面那个丑一点 + () => Boolean(dq('.video-sections-item:last-child .video-episode-card:last-child .video-episode-card__info-playing')), + // 可分子合集的合集 + () => Boolean(dq('.video-sections-item:last-child .video-episode-card:last-child .video-episode-card__info-title-playing')), ] const isChecked = (container: HTMLElement) => Boolean( container.querySelector('.switch-button.on') || container.matches(':checked'),