Skip to content

Commit f4bc1e4

Browse files
committed
theme-movie
1 parent 8c8abd7 commit f4bc1e4

File tree

3 files changed

+22
-16
lines changed

3 files changed

+22
-16
lines changed

themes/movie/config.js

-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ const CONFIG = {
1010

1111
MOVIE_ARTICLE_RECOMMEND: true, // 推荐关联内容在文章底部
1212
MOVIE_VIDEO_COMBINE: true, // 聚合视频,开启后一篇文章内的多个含caption的视频会被合并到文章开头,并展示分集按钮
13-
MOVIE_VIDEO_COMBINE_AUTO: true, //没有caption的视频也加入聚合,并且自动编号
1413
MOVIE_VIDEO_COMBINE_SHOW_PAGE_FORCE: false, // 即使只有一集也显示集数切换按钮
1514

1615
MOVIE_POST_LIST_COVER: true // 列表显示文章封面

themes/movie/index.js

+17-15
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ const LayoutBase = props => {
7575
'relative mx-auto justify-center md:flex items-start py-8 px-2'
7676
}>
7777
{/* 内容 */}
78-
<div className={`w-full ${fullWidth ? '' : ''} px-4 max-w-[90rem] mx-auto`}>
78+
<div className={`w-full ${fullWidth ? '' : ''} px-4`}>
7979
<Transition
8080
show={!onLoading}
8181
appear={true}
@@ -125,10 +125,10 @@ const LayoutIndex = props => {
125125
*/
126126
const LayoutPostList = props => {
127127
return (
128-
<>
128+
<div className='max-w-[90rem] mx-auto'>
129129
<SlotBar {...props} />
130130
{siteConfig('POST_LIST_STYLE') === 'page' ? <BlogListPage {...props} /> : <BlogListScroll {...props} />}
131-
</>
131+
</div>
132132
)
133133
}
134134

@@ -155,15 +155,15 @@ const LayoutSlug = props => {
155155
const exists = document.querySelectorAll('.video-wrapper')
156156
if (exists && exists.length > 0) return
157157

158-
// 创建一个新的容器元素
158+
// 创建视频区块容器元素
159159
const videoWrapper = document.createElement('div')
160160
videoWrapper.className = 'video-wrapper py-1 px-3 bg-gray-100 dark:bg-white dark:text-black mx-auto'
161161

162-
// 创建一个新的容器元素
162+
// 创建走马灯封装容器元素
163163
const carouselWrapper = document.createElement('div')
164164
carouselWrapper.classList.add('notion-carousel-wrapper')
165165

166-
// 创建一个用于保存 figcaption 文本内容的数组
166+
// 创建分集按钮figcaption文本的数组
167167
const figCaptionValues = []
168168

169169
// 遍历所有 .notion-asset-wrapper 元素
@@ -178,7 +178,7 @@ const LayoutSlug = props => {
178178
)
179179
return
180180

181-
if (!figCaption && siteConfig('MOVIE_VIDEO_COMBINE_AUTO', false, CONFIG)) return // 如果没有子元素 figcaption,则不处理该元素
181+
if (!figCaption) return // 如果没有子元素 figcaption,则不处理该元素
182182

183183
// 获取 figcaption 的文本内容并添加到数组中
184184
const figCaptionValue = figCaption ? figCaption?.textContent?.trim() : `P-${index}`
@@ -224,14 +224,16 @@ const LayoutSlug = props => {
224224
figCaptionWrapper.appendChild(div)
225225
})
226226

227-
// 将包含 figcaption 值的容器元素添加到 notion-article 的第一个子元素插入
228-
videoWrapper.appendChild(carouselWrapper)
229-
// 显示分集按钮 ,caption的视频数量大于1个
230-
if (figCaptionValues.length > 1 || siteConfig('MOVIE_VIDEO_COMBINE_SHOW_PAGE_FORCE', false, CONFIG)) {
231-
videoWrapper.appendChild(figCaptionWrapper)
227+
if (carouselWrapper.children.length > 0) {
228+
// 将包含 figcaption 值的容器元素添加到 notion-article 的第一个子元素插入
229+
videoWrapper.appendChild(carouselWrapper)
230+
// 显示分集按钮 大于1集才显示 ;或者用户 要求强制显示
231+
if (figCaptionWrapper.children.length > 1 || siteConfig('MOVIE_VIDEO_COMBINE_SHOW_PAGE_FORCE', false, CONFIG)) {
232+
videoWrapper.appendChild(figCaptionWrapper)
233+
}
234+
// 放入页面
235+
notionArticle.insertBefore(videoWrapper, notionArticle.firstChild)
232236
}
233-
234-
notionArticle.insertBefore(videoWrapper, notionArticle.firstChild)
235237
}
236238

237239
setTimeout(() => {
@@ -268,7 +270,7 @@ const LayoutSlug = props => {
268270
return (
269271
<>
270272
{!lock ? (
271-
<div id='article-wrapper' className='px-2 max-w-6xl mx-auto'>
273+
<div id='article-wrapper' className='px-2 max-w-5xl 2xl:max-w-[70%] mx-auto'>
272274
{/* 标题 */}
273275
<ArticleInfo post={post} />
274276
{/* 页面元素 */}

themes/movie/style.js

+5
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,11 @@ const Style = () => {
4040
.notion-carousel-route div:hover {
4141
text-decoration: underline;
4242
}
43+
44+
.notion-carousel div {
45+
height: auto !important;
46+
aspect-ratio: 2/1 !important;
47+
}
4348
`}</style>
4449
)
4550
}

0 commit comments

Comments
 (0)