+ <>
+
+ href='/'
+ className='whitespace-nowrap py-6 text-2xl md:text-3xl font-bold text-gray-dark no-underline flex items-center'>
{siteConfig('TITLE')}
-
+
+
{/* 右侧菜单 */}
-
+ <>
+
+
+
+
+
+
+
+
+
+
+ {/* 移动端按钮 */}
+
+ >
-
-
+
+
+
+ {/* 移动端菜单 */}
+
+
+ >
)
}
diff --git a/themes/movie/components/MenuItemCollapse.js b/themes/movie/components/MenuItemCollapse.js
new file mode 100644
index 00000000..0f91f1d4
--- /dev/null
+++ b/themes/movie/components/MenuItemCollapse.js
@@ -0,0 +1,77 @@
+import Collapse from '@/components/Collapse'
+import Link from 'next/link'
+import { useState } from 'react'
+
+/**
+ * 折叠菜单
+ * @param {*} param0
+ * @returns
+ */
+export const MenuItemCollapse = props => {
+ const { link } = props
+ const [show, changeShow] = useState(false)
+ const hasSubMenu = link?.subMenus?.length > 0
+
+ const [isOpen, changeIsOpen] = useState(false)
+
+ const toggleShow = () => {
+ changeShow(!show)
+ }
+
+ const toggleOpenSubMenu = () => {
+ changeIsOpen(!isOpen)
+ }
+
+ if (!link || !link.show) {
+ return null
+ }
+
+ return (
+ <>
+
+ {!hasSubMenu && (
+
+
+ {link?.icon && }
+ {link?.name}
+
+
+ )}
+ {hasSubMenu && (
+
+
+ {link?.icon && }
+ {link?.name}
+
+
+
+ )}
+
+
+ {/* 折叠子菜单 */}
+ {hasSubMenu && (
+
+ {link.subMenus.map((sLink, index) => {
+ return (
+
+
+
+ {link?.icon && } {sLink.title}
+
+
+
+ )
+ })}
+
+ )}
+ >
+ )
+}
diff --git a/themes/movie/components/MenuItemDrop.js b/themes/movie/components/MenuItemDrop.js
index 501140a4..5d2f8a8d 100644
--- a/themes/movie/components/MenuItemDrop.js
+++ b/themes/movie/components/MenuItemDrop.js
@@ -18,7 +18,7 @@ export const MenuItemDrop = ({ link }) => {
{link?.icon &&
} {link?.name}
{hasSubMenu &&
}
diff --git a/themes/movie/components/MenuListTop.js b/themes/movie/components/MenuListTop.js
deleted file mode 100644
index d79b2ab5..00000000
--- a/themes/movie/components/MenuListTop.js
+++ /dev/null
@@ -1,65 +0,0 @@
-import { useGlobal } from '@/lib/global'
-import CONFIG from '../config'
-import { siteConfig } from '@/lib/config'
-import { MenuItemDrop } from './MenuItemDrop'
-
-export const MenuListTop = props => {
- const { customNav, customMenu } = props
- const { locale } = useGlobal()
-
- let links = [
- {
- id: 1,
- icon: 'fa-solid fa-house',
- name: locale.NAV.INDEX,
- to: '/',
- show: siteConfig('HEXO_MENU_INDEX', null, CONFIG)
- },
- {
- id: 2,
- icon: 'fas fa-search',
- name: locale.NAV.SEARCH,
- to: '/search',
- show: siteConfig('HEXO_MENU_SEARCH', null, CONFIG)
- },
- {
- id: 3,
- icon: 'fas fa-archive',
- name: locale.NAV.ARCHIVE,
- to: '/archive',
- show: siteConfig('HEXO_MENU_ARCHIVE', null, CONFIG)
- }
- // { icon: 'fas fa-folder', name: locale.COMMON.CATEGORY, to: '/category', show: siteConfig('MENU_CATEGORY', null, CONFIG) },
- // { icon: 'fas fa-tag', name: locale.COMMON.TAGS, to: '/tag', show: siteConfig('MENU_TAG', null, CONFIG) }
- ]
-
- if (customNav) {
- links = links.concat(customNav)
- }
-
- for (let i = 0; i < links.length; i++) {
- if (links[i].id !== i) {
- links[i].id = i
- }
- }
-
- // 如果 开启自定义菜单,则覆盖Page生成的菜单
- if (siteConfig('CUSTOM_MENU')) {
- links = customMenu
- }
-
- if (!links || links.length === 0) {
- return null
- }
-
- return (
- <>
-
- >
- )
-}
diff --git a/themes/movie/components/Nav.js b/themes/movie/components/Nav.js
deleted file mode 100644
index 08f5ca56..00000000
--- a/themes/movie/components/Nav.js
+++ /dev/null
@@ -1,73 +0,0 @@
-import { siteConfig } from '@/lib/config'
-import { useGlobal } from '@/lib/global'
-import CONFIG from '../config'
-import { MenuItemDrop } from './MenuItemDrop'
-
-/**
- * 菜单导航
- * @param {*} props
- * @returns
- */
-export const Nav = props => {
- const { customNav, customMenu } = props
- const { locale } = useGlobal()
-
- let links = [
- {
- id: 1,
- icon: 'fas fa-search',
- name: locale.NAV.SEARCH,
- to: '/search',
- show: siteConfig('EXAMPLE_MENU_SEARCH', null, CONFIG)
- },
- {
- id: 2,
- icon: 'fas fa-archive',
- name: locale.NAV.ARCHIVE,
- to: '/archive',
- show: siteConfig('EXAMPLE_MENU_ARCHIVE', null, CONFIG)
- },
- {
- id: 3,
- icon: 'fas fa-folder',
- name: locale.COMMON.CATEGORY,
- to: '/category',
- show: siteConfig('EXAMPLE_MENU_CATEGORY', null, CONFIG)
- },
- {
- id: 4,
- icon: 'fas fa-tag',
- name: locale.COMMON.TAGS,
- to: '/tag',
- show: siteConfig('EXAMPLE_MENU_TAG', null, CONFIG)
- }
- ]
-
- if (customNav) {
- links = links.concat(customNav)
- }
-
- // 如果 开启自定义菜单,则不再使用 Page生成菜单。
- if (siteConfig('CUSTOM_MENU')) {
- links = customMenu
- }
-
- if (!links || links.length === 0) {
- return null
- }
-
- return (
-
- )
-}
diff --git a/themes/movie/config.js b/themes/movie/config.js
index 181d3a93..48403075 100644
--- a/themes/movie/config.js
+++ b/themes/movie/config.js
@@ -3,12 +3,12 @@
*/
const CONFIG = {
// 菜单配置
- EXAMPLE_MENU_CATEGORY: true, // 显示分类
- EXAMPLE_MENU_TAG: true, // 显示标签
- EXAMPLE_MENU_ARCHIVE: true, // 显示归档
- EXAMPLE_MENU_SEARCH: true, // 显示搜索
+ MOVIE_MENU_CATEGORY: true, // 显示分类
+ MOVIE_MENU_TAG: true, // 显示标签
+ MOVIE_MENU_ARCHIVE: true, // 显示归档
+ MOVIE_MENU_SEARCH: true, // 显示搜索
- EXAMPLE_POST_LIST_COVER: true // 列表显示文章封面
+ MOVIE_POST_LIST_COVER: true // 列表显示文章封面
}
export default CONFIG
diff --git a/themes/movie/index.js b/themes/movie/index.js
index 2aaa95da..e34f0e83 100644
--- a/themes/movie/index.js
+++ b/themes/movie/index.js
@@ -1,37 +1,32 @@
'use client'
-import CONFIG from './config'
-import { createContext, useContext, useEffect, useRef } from 'react'
-import { Header } from './components/Header'
-import { Nav } from './components/Nav'
-import { Footer } from './components/Footer'
-import { Title } from './components/Title'
-import { SideBar } from './components/SideBar'
+import AlgoliaSearchModal from '@/components/AlgoliaSearchModal'
+import Comment from '@/components/Comment'
+import replaceSearchResult from '@/components/Mark'
+import NotionPage from '@/components/NotionPage'
+import ShareBar from '@/components/ShareBar'
+import { siteConfig } from '@/lib/config'
+import { useGlobal } from '@/lib/global'
+import { isBrowser } from '@/lib/utils'
+import { Transition } from '@headlessui/react'
+import { useRouter } from 'next/router'
+import { createContext, useContext, useEffect, useRef, useState } from 'react'
+import ArchiveDateList from './components/ArchiveDateList'
+import { ArticleInfo } from './components/ArticleInfo'
+import { ArticleLock } from './components/ArticleLock'
+import BlogListGroupByDate from './components/BlogListGroupByDate'
import { BlogListPage } from './components/BlogListPage'
import { BlogListScroll } from './components/BlogListScroll'
-import { useGlobal } from '@/lib/global'
-import { ArticleLock } from './components/ArticleLock'
-import { ArticleInfo } from './components/ArticleInfo'
-import JumpToTopButton from './components/JumpToTopButton'
-import NotionPage from '@/components/NotionPage'
-import Comment from '@/components/Comment'
-import ShareBar from '@/components/ShareBar'
-import SearchInput from './components/SearchInput'
-import replaceSearchResult from '@/components/Mark'
-import { isBrowser } from '@/lib/utils'
-import BlogListGroupByDate from './components/BlogListGroupByDate'
-import CategoryItem from './components/CategoryItem'
-import TagItem from './components/TagItem'
-import { useRouter } from 'next/router'
-import { Transition } from '@headlessui/react'
-import { Style } from './style'
-import { siteConfig } from '@/lib/config'
-import AlgoliaSearchModal from '@/components/AlgoliaSearchModal'
-import LatestPostsGroup from './components/LatestPostsGroup'
import CategoryGroup from './components/CategoryGroup'
-import { formatDateFmt } from '@/lib/utils/formatDate'
-import ArchiveDateList from './components/ArchiveDateList'
+import CategoryItem from './components/CategoryItem'
+import { Footer } from './components/Footer'
+import { Header } from './components/Header'
+import JumpToTopButton from './components/JumpToTopButton'
+import LatestPostsGroup from './components/LatestPostsGroup'
import TagGroups from './components/TagGroups'
+import TagItem from './components/TagItem'
+import CONFIG from './config'
+import { Style } from './style'
// 主题全局状态
const ThemeGlobalMovie = createContext()
@@ -47,56 +42,44 @@ export const useMovieGlobal = () => useContext(ThemeGlobalMovie)
const LayoutBase = props => {
const { children, slotTop } = props
const { onLoading, fullWidth } = useGlobal()
- const router = useRouter()
- const { category, tag } = props
- const searchModal = useRef(null)
+ const collapseRef = useRef(null)
- // 增加一个状态以触发 Transition 组件的动画
- // const [showTransition, setShowTransition] = useState(true)
- // useEffect(() => {
- // // 当 location 或 children 发生变化时,触发动画
- // setShowTransition(false)
- // setTimeout(() => setShowTransition(true), 5)
- // }, [onLoading])
+ const searchModal = useRef(null)
+ const [expandMenu, updateExpandMenu] = useState(false)
return (
-
+
+ id='theme-movie'
+ className={`${siteConfig('FONT_STYLE')} dark:text-gray-300 duration-300 transition-all bg-white dark:bg-[#2A2A2A] scroll-smooth min-h-screen flex flex-col justify-between`}>
{/* 页头 */}
{/* 主体 */}
-
+
{/* 标题栏 */}
{/* {fullWidth ? null :
} */}
+ }>
{/* 内容 */}
+ enter='transition ease-in-out duration-700 transform order-first'
+ enterFrom='opacity-0 translate-y-16'
+ enterTo='opacity-100'
+ leave='transition ease-in-out duration-300 transform'
+ leaveFrom='opacity-100 translate-y-0'
+ leaveTo='opacity-0 -translate-y-16'
+ unmount={false}>
{/* 嵌入模块 */}
{slotTop}
{children}
@@ -112,7 +95,7 @@ const LayoutBase = props => {
{/* 回顶按钮 */}
-
@@ -135,15 +118,7 @@ const LayoutIndex = props => {
* @returns
*/
const LayoutPostList = props => {
- return (
- <>
- {siteConfig('POST_LIST_STYLE') === 'page' ? (
-
- ) : (
-
- )}
- >
- )
+ return <>{siteConfig('POST_LIST_STYLE') === 'page' ? : }>
}
/**
@@ -174,16 +149,18 @@ const LayoutSlug = props => {
}, [post])
return (
<>
- {lock ? (
-
- ) : (
-
+ {!lock
+ ? (
+
- )}
+ )
+ : (
+
+ )}
>
)
}
@@ -215,27 +192,27 @@ const Layout404 = props => {
return (
<>
-
-
{locale.COMMON.NO_RESULTS_FOUND}
-
-
+
+
{locale.COMMON.NO_RESULTS_FOUND}
+
+
-
+
{/* 底部导航 */}
-
+
@@ -282,13 +259,9 @@ const LayoutArchive = props => {
const { archivePosts } = props
return (
<>
-
+
{Object.keys(archivePosts).map(archiveTitle => (
-
+
))}
>
@@ -304,7 +277,7 @@ const LayoutCategoryIndex = props => {
const { categoryOptions } = props
return (
<>
-
+
{categoryOptions?.map(category => (
))}
@@ -322,7 +295,7 @@ const LayoutTagIndex = props => {
const { tagOptions } = props
return (
<>
-
}
diff --git a/themes/fukasawa/components/Catalog.js b/themes/fukasawa/components/Catalog.js
index 522646af..d584d5de 100644
--- a/themes/fukasawa/components/Catalog.js
+++ b/themes/fukasawa/components/Catalog.js
@@ -58,29 +58,27 @@ const Catalog = ({ toc }) => {
if (!toc || toc?.length < 1) {
return <>>
}
- return
+ return
{locale.COMMON.TABLE_OF_CONTENTS}
-
+ {tocItem.text}
+
+
+ )
+ })}
+
}
From 999f116fc39f8ac6fa92af0fed11e66f13b7f962 Mon Sep 17 00:00:00 2001
From: "tangly1024.com"
Date: Fri, 15 Mar 2024 18:01:38 +0800
Subject: [PATCH 32/90] eslint
---
.eslintrc.js | 11 ++---------
package.json | 4 +++-
yarn.lock | 40 +++++++++++++++++++++++++++++++++++++++-
3 files changed, 44 insertions(+), 11 deletions(-)
diff --git a/.eslintrc.js b/.eslintrc.js
index 9836da77..c6fbb20a 100644
--- a/.eslintrc.js
+++ b/.eslintrc.js
@@ -4,11 +4,7 @@ module.exports = {
es2021: true,
node: true
},
- extends: [
- 'plugin:react/recommended',
- 'plugin:@next/next/recommended',
- 'standard'
- ],
+ extends: ['plugin:react/recommended', 'plugin:@next/next/recommended', 'standard', 'prettier'],
parserOptions: {
ecmaFeatures: {
jsx: true
@@ -16,10 +12,7 @@ module.exports = {
ecmaVersion: 12,
sourceType: 'module'
},
- plugins: [
- 'react',
- 'react-hooks'
- ],
+ plugins: ['react', 'react-hooks', 'prettier'],
settings: {
react: {
version: 'detect'
diff --git a/package.json b/package.json
index 0ccd17e1..13b60baf 100644
--- a/package.json
+++ b/package.json
@@ -57,9 +57,11 @@
"cross-env": "^7.0.3",
"eslint": "^7.26.0",
"eslint-config-next": "^13.1.1",
+ "eslint-config-prettier": "^9.1.0",
"eslint-config-standard": "^16.0.2",
"eslint-plugin-import": "^2.23.0",
"eslint-plugin-node": "^11.1.0",
+ "eslint-plugin-prettier": "^5.1.3",
"eslint-plugin-promise": "^5.1.0",
"eslint-plugin-react": "^7.23.2",
"eslint-plugin-react-hooks": "^4.6.0",
@@ -76,4 +78,4 @@
"url": "https://github.com/tangly/NotionNext/issues",
"email": "tlyong1992@hotmail.com"
}
-}
\ No newline at end of file
+}
diff --git a/yarn.lock b/yarn.lock
index 7935bfbc..8e4cfd52 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -869,6 +869,11 @@
resolved "https://registry.yarnpkg.com/@pkgjs/parseargs/-/parseargs-0.11.0.tgz#a77ea742fab25775145434eb1d2328cf5013ac33"
integrity sha512-+1VkjdD0QBLPodGrJUeqarH8VAIvQODIbwh9XpP5Syisf7YoQgsJKPNFoqqLQlu+VQ/tVSshMR6loPMn8U+dPg==
+"@pkgr/core@^0.1.0":
+ version "0.1.1"
+ resolved "https://r.cnpmjs.org/@pkgr/core/-/core-0.1.1.tgz#1ec17e2edbec25c8306d424ecfbf13c7de1aaa31"
+ integrity sha512-cq8o4cWH0ibXh9VGi5P20Tu9XF/0fFXl9EUinr9QfTM7a7p0oTA4iJRCQWppXR1Pg8dSM0UCItCkPwsk9qWWYA==
+
"@polka/url@^1.0.0-next.20", "@polka/url@^1.0.0-next.24":
version "1.0.0-next.24"
resolved "https://registry.yarnpkg.com/@polka/url/-/url-1.0.0-next.24.tgz#58601079e11784d20f82d0585865bb42305c4df3"
@@ -2415,6 +2420,11 @@ eslint-config-next@^13.1.1:
eslint-plugin-react "^7.33.2"
eslint-plugin-react-hooks "^4.5.0 || 5.0.0-canary-7118f5dd7-20230705"
+eslint-config-prettier@^9.1.0:
+ version "9.1.0"
+ resolved "https://r.cnpmjs.org/eslint-config-prettier/-/eslint-config-prettier-9.1.0.tgz#31af3d94578645966c082fcb71a5846d3c94867f"
+ integrity sha512-NSWl5BFQWEPi1j4TjVNItzYV7dZXZ+wP6I6ZhrBGpChQhZRUaElihE9uRRkcbRnNb76UMKDF3r+WTmNcGPKsqw==
+
eslint-config-standard@^16.0.2:
version "16.0.3"
resolved "https://registry.yarnpkg.com/eslint-config-standard/-/eslint-config-standard-16.0.3.tgz#6c8761e544e96c531ff92642eeb87842b8488516"
@@ -2514,6 +2524,14 @@ eslint-plugin-node@^11.1.0:
resolve "^1.10.1"
semver "^6.1.0"
+eslint-plugin-prettier@^5.1.3:
+ version "5.1.3"
+ resolved "https://r.cnpmjs.org/eslint-plugin-prettier/-/eslint-plugin-prettier-5.1.3.tgz#17cfade9e732cef32b5f5be53bd4e07afd8e67e1"
+ integrity sha512-C9GCVAs4Eq7ZC/XFQHITLiHJxQngdtraXaM+LoUFoFp/lHNl2Zn8f3WQbe9HvTBBQ9YnKFB0/2Ajdqwo5D1EAw==
+ dependencies:
+ prettier-linter-helpers "^1.0.0"
+ synckit "^0.8.6"
+
eslint-plugin-promise@^5.1.0:
version "5.2.0"
resolved "https://registry.yarnpkg.com/eslint-plugin-promise/-/eslint-plugin-promise-5.2.0.tgz#a596acc32981627eb36d9d75f9666ac1a4564971"
@@ -2685,6 +2703,11 @@ fast-deep-equal@^3.1.1, fast-deep-equal@^3.1.3:
resolved "https://registry.yarnpkg.com/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz#3a7d56b559d6cbc3eb512325244e619a65c6c525"
integrity sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==
+fast-diff@^1.1.2:
+ version "1.3.0"
+ resolved "https://r.cnpmjs.org/fast-diff/-/fast-diff-1.3.0.tgz#ece407fa550a64d638536cd727e129c61616e0f0"
+ integrity sha512-VxPP4NqbUjj6MaAOafWeUn2cXWLcCtljklUtZf0Ind4XQ+QPtmA0b18zZy0jIQx+ExRVCR/ZQpBmik5lXshNsw==
+
fast-glob@^3.2.9, fast-glob@^3.3.0, fast-glob@^3.3.1:
version "3.3.2"
resolved "https://registry.yarnpkg.com/fast-glob/-/fast-glob-3.3.2.tgz#a904501e57cfdd2ffcded45e99a54fef55e46129"
@@ -4133,6 +4156,13 @@ prelude-ls@^1.2.1:
resolved "https://registry.yarnpkg.com/prelude-ls/-/prelude-ls-1.2.1.tgz#debc6489d7a6e6b0e7611888cec880337d316396"
integrity sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g==
+prettier-linter-helpers@^1.0.0:
+ version "1.0.0"
+ resolved "https://r2.cnpmjs.org/prettier-linter-helpers/-/prettier-linter-helpers-1.0.0.tgz#d23d41fe1375646de2d0104d3454a3008802cf7b"
+ integrity sha512-GbK2cP9nraSSUF9N2XwUwqfzlAFlMNYYl+ShE/V+H8a9uNl/oUqB1w2EL54Jh0OlyRSd8RfWYJ3coVS4TROP2w==
+ dependencies:
+ fast-diff "^1.1.2"
+
prettier@3.2.5:
version "3.2.5"
resolved "https://r.cnpmjs.org/prettier/-/prettier-3.2.5.tgz#e52bc3090586e824964a8813b09aba6233b28368"
@@ -4831,6 +4861,14 @@ supports-preserve-symlinks-flag@^1.0.0:
resolved "https://registry.yarnpkg.com/supports-preserve-symlinks-flag/-/supports-preserve-symlinks-flag-1.0.0.tgz#6eda4bd344a3c94aea376d4cc31bc77311039e09"
integrity sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w==
+synckit@^0.8.6:
+ version "0.8.8"
+ resolved "https://r.cnpmjs.org/synckit/-/synckit-0.8.8.tgz#fe7fe446518e3d3d49f5e429f443cf08b6edfcd7"
+ integrity sha512-HwOKAP7Wc5aRGYdKH+dw0PRRpbO841v2DENBtjnR5HFWoiNByAl7vrx3p0G/rCyYXQsrxqtX48TImFtPcIHSpQ==
+ dependencies:
+ "@pkgr/core" "^0.1.0"
+ tslib "^2.6.2"
+
table@^6.0.9:
version "6.8.1"
resolved "https://registry.yarnpkg.com/table/-/table-6.8.1.tgz#ea2b71359fe03b017a5fbc296204471158080bdf"
@@ -4968,7 +5006,7 @@ tslib@^1.11.1:
resolved "https://registry.yarnpkg.com/tslib/-/tslib-1.14.1.tgz#cf2d38bdc34a134bcaf1091c41f6619e2f672d00"
integrity sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==
-tslib@^2.1.0, tslib@^2.3.1, tslib@^2.4.0, tslib@^2.5.0:
+tslib@^2.1.0, tslib@^2.3.1, tslib@^2.4.0, tslib@^2.5.0, tslib@^2.6.2:
version "2.6.2"
resolved "https://registry.yarnpkg.com/tslib/-/tslib-2.6.2.tgz#703ac29425e7b37cd6fd456e92404d46d1f3e4ae"
integrity sha512-AEYxH93jGFPn/a2iVAwW87VuUIkR1FVUKB77NwMF7nBTDkDrrT/Hpt/IrCJ0QXhW27jTBDcf5ZY7w6RiqTMw2Q==
From 35415f1007619b424be2cedf4c1b1a2197cf326b Mon Sep 17 00:00:00 2001
From: "tangly1024.com"
Date: Fri, 15 Mar 2024 18:01:59 +0800
Subject: [PATCH 33/90] =?UTF-8?q?movie=20=E8=AF=A6=E6=83=85=E9=A1=B5?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
themes/movie/components/ArticleInfo.js | 77 ++++++++++-----------
themes/movie/components/BlogListPage.js | 6 +-
themes/movie/components/BlogListScroll.js | 50 ++++++-------
themes/movie/components/BlogPostCard.js | 6 +-
themes/movie/components/PaginationNumber.js | 6 +-
themes/movie/components/SlotBar.js | 34 +++++++++
themes/movie/index.js | 24 +++++--
7 files changed, 125 insertions(+), 78 deletions(-)
create mode 100644 themes/movie/components/SlotBar.js
diff --git a/themes/movie/components/ArticleInfo.js b/themes/movie/components/ArticleInfo.js
index b502a9c9..782b760b 100644
--- a/themes/movie/components/ArticleInfo.js
+++ b/themes/movie/components/ArticleInfo.js
@@ -1,51 +1,50 @@
-import Link from 'next/link'
import { useGlobal } from '@/lib/global'
import { formatDateFmt } from '@/lib/utils/formatDate'
+import Link from 'next/link'
-export const ArticleInfo = (props) => {
+export const ArticleInfo = props => {
const { post } = props
-
const { locale } = useGlobal()
+ console.log(post)
return (
-
-
- {post?.type !== 'Page' && <>
-
+
+ {post?.title}
-
- {post?.category}
+
+
+ {post?.publishDay}
+
-
- |
- >}
+ {post?.type !== 'Page' && (
+ <>
+
+ {post?.category}
+
+ >
+ )}
- {post?.type !== 'Page' && (<>
-
-
- {post?.publishDay}
-
-
- |
-
- {locale.COMMON.LAST_EDITED_TIME}: {post?.lastEditedDay}
-
- |
-
-
-
-
-
- >)}
-
-
-
-
+
+ {post?.tags?.length > 0 && (
+ <>
+ {locale.COMMON.TAGS} :
+ >
+ )}
+ {post?.tags?.map(tag => {
+ return (
+
+ {tag}
+
+ )
+ })}
+
+
+
)
}
diff --git a/themes/movie/components/BlogListPage.js b/themes/movie/components/BlogListPage.js
index 925156bf..648f2ee2 100644
--- a/themes/movie/components/BlogListPage.js
+++ b/themes/movie/components/BlogListPage.js
@@ -4,7 +4,9 @@ import BlogPostCard from './BlogPostCard'
import PaginationNumber from './PaginationNumber'
export const BlogListPage = props => {
- const { posts } = props
+ const { page = 1, posts, postCount } = props
+ const totalPage = Math.ceil(postCount / parseInt(siteConfig('POSTS_PER_PAGE')))
+
const showPageCover = siteConfig('MOVIE_POST_LIST_COVER', null, CONFIG)
return (
@@ -17,7 +19,7 @@ export const BlogListPage = props => {
))}
-
+
)
}
diff --git a/themes/movie/components/BlogListScroll.js b/themes/movie/components/BlogListScroll.js
index e876f312..597ba7dc 100644
--- a/themes/movie/components/BlogListScroll.js
+++ b/themes/movie/components/BlogListScroll.js
@@ -1,9 +1,9 @@
import { siteConfig } from '@/lib/config'
import { useGlobal } from '@/lib/global'
-import { useCallback, useEffect, useRef, useState } from 'react'
import throttle from 'lodash.throttle'
-import BlogPostCard from './BlogPostCard'
+import { useCallback, useEffect, useRef, useState } from 'react'
import CONFIG from '../config'
+import BlogPostCard from './BlogPostCard'
export const BlogListScroll = props => {
const { posts } = props
@@ -12,9 +12,7 @@ export const BlogListScroll = props => {
const [page, updatePage] = useState(1)
let hasMore = false
- const postsToShow = posts
- ? Object.assign(posts).slice(0, parseInt(siteConfig('POSTS_PER_PAGE')) * page)
- : []
+ const postsToShow = posts ? Object.assign(posts).slice(0, parseInt(siteConfig('POSTS_PER_PAGE')) * page) : []
if (posts) {
const totalCount = posts.length
@@ -28,14 +26,16 @@ export const BlogListScroll = props => {
const targetRef = useRef(null)
// 监听滚动自动分页加载
- const scrollTrigger = useCallback(throttle(() => {
- const scrollS = window.scrollY + window.outerHeight
- const clientHeight = targetRef ? (targetRef.current ? (targetRef.current.clientHeight) : 0) : 0
- if (scrollS > clientHeight + 100) {
- handleGetMore()
- }
- }, 500))
- const showPageCover = siteConfig('EXAMPLE_POST_LIST_COVER', null, CONFIG)
+ const scrollTrigger = useCallback(
+ throttle(() => {
+ const scrollS = window.scrollY + window.outerHeight
+ const clientHeight = targetRef ? (targetRef.current ? targetRef.current.clientHeight : 0) : 0
+ if (scrollS > clientHeight + 100) {
+ handleGetMore()
+ }
+ }, 500)
+ )
+ const showPageCover = siteConfig('MOVIE_POST_LIST_COVER', null, CONFIG)
useEffect(() => {
window.addEventListener('scroll', scrollTrigger)
@@ -46,21 +46,15 @@ export const BlogListScroll = props => {
})
return (
+
+ {postsToShow?.map(post => (
+
+ ))}
-
-
- {postsToShow?.map(post => (
-
- ))}
-
-
- {' '}
- {hasMore ? locale.COMMON.MORE : `${locale.COMMON.NO_MORE} 😰`}{' '}
-
-
-
+
+ {' '}
+ {hasMore ? locale.COMMON.MORE : `${locale.COMMON.NO_MORE} 😰`}{' '}
+
+
)
}
diff --git a/themes/movie/components/BlogPostCard.js b/themes/movie/components/BlogPostCard.js
index 6aa84072..eadcfb7c 100644
--- a/themes/movie/components/BlogPostCard.js
+++ b/themes/movie/components/BlogPostCard.js
@@ -14,7 +14,7 @@ const BlogPostCard = ({ index, post, showSummary, siteInfo }) => {
const url = checkContainHttp(post.slug) ? sliceUrlFromHttp(post.slug) : `${siteConfig('SUB_PATH', '')}/${post.slug}`
return (
-
+
{/* 固定高度 ,空白用图片拉升填充 */}
@@ -44,6 +44,10 @@ const BlogPostCard = ({ index, post, showSummary, siteInfo }) => {
{post.title}
+
+ {post?.summary}
+
+
diff --git a/themes/movie/components/PaginationNumber.js b/themes/movie/components/PaginationNumber.js
index 54c1bf34..effc1835 100644
--- a/themes/movie/components/PaginationNumber.js
+++ b/themes/movie/components/PaginationNumber.js
@@ -13,6 +13,7 @@ import { useState } from 'react'
*/
const PaginationNumber = ({ page, totalPage }) => {
const router = useRouter()
+ const [value, setValue] = useState('')
const { locale } = useGlobal()
const currentPage = +page
const showNext = page < totalPage
@@ -22,8 +23,9 @@ const PaginationNumber = ({ page, totalPage }) => {
.replace(/\/page\/[1-9]\d*/, '')
.replace(/\/$/, '')
const pages = generatePages(pagePrefix, page, currentPage, totalPage)
-
- const [value, setValue] = useState('')
+ if (pages?.length <= 1) {
+ return <>>
+ }
const handleInputChange = event => {
const newValue = event.target.value.replace(/[^0-9]/g, '')
diff --git a/themes/movie/components/SlotBar.js b/themes/movie/components/SlotBar.js
new file mode 100644
index 00000000..e3bed727
--- /dev/null
+++ b/themes/movie/components/SlotBar.js
@@ -0,0 +1,34 @@
+import { useGlobal } from '@/lib/global'
+
+/**
+ * 博客列表上方嵌入条
+ * @param {*} props
+ * @returns
+ */
+export default function SlotBar(props) {
+ const { tag, category } = props
+ const { locale } = useGlobal()
+
+ if (tag) {
+ return (
+
+
+
+ {locale.COMMON.TAGS} : {tag}{' '}
+
+
+
+
+ )
+ } else if (category) {
+ return (
+
+
+ {locale.COMMON.CATEGORY} : {category}
+
+
+
+ )
+ }
+ return <>>
+}
diff --git a/themes/movie/index.js b/themes/movie/index.js
index e34f0e83..4b114d37 100644
--- a/themes/movie/index.js
+++ b/themes/movie/index.js
@@ -7,6 +7,7 @@ import NotionPage from '@/components/NotionPage'
import ShareBar from '@/components/ShareBar'
import { siteConfig } from '@/lib/config'
import { useGlobal } from '@/lib/global'
+import { loadWowJS } from '@/lib/plugins/wow'
import { isBrowser } from '@/lib/utils'
import { Transition } from '@headlessui/react'
import { useRouter } from 'next/router'
@@ -23,6 +24,7 @@ import { Footer } from './components/Footer'
import { Header } from './components/Header'
import JumpToTopButton from './components/JumpToTopButton'
import LatestPostsGroup from './components/LatestPostsGroup'
+import SlotBar from './components/SlotBar'
import TagGroups from './components/TagGroups'
import TagItem from './components/TagItem'
import CONFIG from './config'
@@ -46,6 +48,9 @@ const LayoutBase = props => {
const searchModal = useRef(null)
const [expandMenu, updateExpandMenu] = useState(false)
+ useEffect(() => {
+ loadWowJS()
+ }, [])
return (
@@ -118,7 +123,12 @@ const LayoutIndex = props => {
* @returns
*/
const LayoutPostList = props => {
- return <>{siteConfig('POST_LIST_STYLE') === 'page' ? : }>
+ return (
+ <>
+
+ {siteConfig('POST_LIST_STYLE') === 'page' ? : }
+ >
+ )
}
/**
@@ -149,18 +159,20 @@ const LayoutSlug = props => {
}, [post])
return (
<>
- {!lock
- ? (
+ {!lock ? (
+ {/* 标题 */}
+ {/* 页面元素 */}
+ {/* 分享栏目 */}
+ {/* 评论区 */}
- )
- : (
+ ) : (
- )}
+ )}
>
)
}
From 74add36f6332c8ba70605d10bb5538a840db82a2 Mon Sep 17 00:00:00 2001
From: Bhwa233 <404174262@qq.com>
Date: Fri, 15 Mar 2024 18:25:35 +0800
Subject: [PATCH 34/90] =?UTF-8?q?=E6=BA=A2=E5=87=BA=E6=96=87=E6=9C=AC?=
=?UTF-8?q?=E5=A2=9E=E5=8A=A0tooltip?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
themes/fukasawa/components/Catalog.js | 1 +
1 file changed, 1 insertion(+)
diff --git a/themes/fukasawa/components/Catalog.js b/themes/fukasawa/components/Catalog.js
index d584d5de..7823ff74 100644
--- a/themes/fukasawa/components/Catalog.js
+++ b/themes/fukasawa/components/Catalog.js
@@ -72,6 +72,7 @@ const Catalog = ({ toc }) => {
>
{tocItem.text}
From b1e162e61286ceb262ef9e3213d40ea51d0599af Mon Sep 17 00:00:00 2001
From: "tangly1024.com"
Date: Fri, 15 Mar 2024 18:27:11 +0800
Subject: [PATCH 35/90] =?UTF-8?q?movie=20=E5=AF=BC=E8=88=AA=E6=A0=8F?=
=?UTF-8?q?=E6=90=9C=E7=B4=A2?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
themes/movie/components/Header.js | 25 ++++++++++++++-----------
1 file changed, 14 insertions(+), 11 deletions(-)
diff --git a/themes/movie/components/Header.js b/themes/movie/components/Header.js
index 223df3e5..a0f2d78c 100644
--- a/themes/movie/components/Header.js
+++ b/themes/movie/components/Header.js
@@ -1,13 +1,13 @@
-import Link from 'next/link'
-import { siteConfig } from '@/lib/config'
-import { useMovieGlobal } from '..'
import Collapse from '@/components/Collapse'
-import { MenuItemCollapse } from './MenuItemCollapse'
+import { siteConfig } from '@/lib/config'
import { useGlobal } from '@/lib/global'
-import CONFIG from '../config'
-import { MenuItemDrop } from './MenuItemDrop'
-import { useEffect, useState } from 'react'
+import Link from 'next/link'
import { useRouter } from 'next/router'
+import { useEffect, useState } from 'react'
+import { useMovieGlobal } from '..'
+import CONFIG from '../config'
+import { MenuItemCollapse } from './MenuItemCollapse'
+import { MenuItemDrop } from './MenuItemDrop'
/**
* 网站顶部
@@ -77,7 +77,7 @@ export const Header = props => {
if (showSearch) {
setTimeout(() => {
document.getElementById('search').focus()
- }, 100);
+ }, 100)
}
}, [showSearch])
@@ -116,20 +116,23 @@ export const Header = props => {
-
+
-
+
{/* 移动端按钮 */}
From 69b4cc5c6f6644e28133462ee32586dc36ec7619 Mon Sep 17 00:00:00 2001
From: "tangly1024.com"
Date: Fri, 15 Mar 2024 18:50:55 +0800
Subject: [PATCH 36/90] =?UTF-8?q?hexo=20=E6=8E=A8=E8=8D=90=E5=8D=A1?=
=?UTF-8?q?=E7=89=8C=E5=BE=AE=E8=B0=83=EF=BC=8C=E5=87=B8=E6=98=BE=E6=96=87?=
=?UTF-8?q?=E5=AD=97?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
themes/hexo/components/ArticleRecommend.js | 88 +++++++++++-----------
1 file changed, 45 insertions(+), 43 deletions(-)
diff --git a/themes/hexo/components/ArticleRecommend.js b/themes/hexo/components/ArticleRecommend.js
index a3a40b7d..0bbcd937 100644
--- a/themes/hexo/components/ArticleRecommend.js
+++ b/themes/hexo/components/ArticleRecommend.js
@@ -1,9 +1,9 @@
-import Link from 'next/link'
-import CONFIG from '../config'
+import LazyImage from '@/components/LazyImage'
import { siteConfig } from '@/lib/config'
import { useGlobal } from '@/lib/global'
-import LazyImage from '@/components/LazyImage'
import { checkContainHttp, sliceUrlFromHttp } from '@/lib/utils'
+import Link from 'next/link'
+import CONFIG from '../config'
/**
* 关联推荐文章
@@ -13,50 +13,52 @@ import { checkContainHttp, sliceUrlFromHttp } from '@/lib/utils'
export default function ArticleRecommend({ recommendPosts, siteInfo }) {
const { locale } = useGlobal()
- if (
- !siteConfig('HEXO_ARTICLE_RECOMMEND', null, CONFIG) ||
- !recommendPosts ||
- recommendPosts.length === 0
- ) {
+ if (!siteConfig('HEXO_ARTICLE_RECOMMEND', null, CONFIG) || !recommendPosts || recommendPosts.length === 0) {
return <>>
}
return (
-
-
-
-
- {locale.COMMON.RELATE_POSTS}
-
-
-
- {recommendPosts.map(post => {
- const headerImage = post?.pageCoverThumbnail
- ? post.pageCoverThumbnail
- : siteInfo?.pageCover
- const url = checkContainHttp(post.slug) ? sliceUrlFromHttp(post.slug) : `${siteConfig('SUB_PATH', '')}/${post.slug}`
-
- return (
- (
-
-
-
- )
- )
- })}
-
+
+
+
+
+ {locale.COMMON.RELATE_POSTS}
+
+
+ {recommendPosts.map(post => {
+ const headerImage = post?.pageCoverThumbnail ? post.pageCoverThumbnail : siteInfo?.pageCover
+ const url = checkContainHttp(post.slug)
+ ? sliceUrlFromHttp(post.slug)
+ : `${siteConfig('SUB_PATH', '')}/${post.slug}`
+
+ return (
+
+
+
+
+
+ {/* 卡片的阴影遮罩,为了凸显图片上的文字 */}
+
+
+
+ )
+ })}
+
+
)
}
From b2c50ff73b9d0447b2ff24effe326d3fa665813f Mon Sep 17 00:00:00 2001
From: "tangly1024.com"
Date: Fri, 15 Mar 2024 19:17:59 +0800
Subject: [PATCH 37/90] =?UTF-8?q?=E8=A7=86=E9=A2=91=E8=81=9A=E5=90=88?=
=?UTF-8?q?=E8=BD=AE=E6=92=AD=E7=89=B9=E6=95=88?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
themes/movie/components/ArticleInfo.js | 8 +--
themes/movie/components/BlogRecommend.js | 62 +++++++++++++++++++++
themes/movie/config.js | 3 +-
themes/movie/index.js | 70 ++++++++++++++++++++++++
themes/movie/style.js | 14 +++++
5 files changed, 150 insertions(+), 7 deletions(-)
create mode 100644 themes/movie/components/BlogRecommend.js
diff --git a/themes/movie/components/ArticleInfo.js b/themes/movie/components/ArticleInfo.js
index 782b760b..9997579a 100644
--- a/themes/movie/components/ArticleInfo.js
+++ b/themes/movie/components/ArticleInfo.js
@@ -5,10 +5,9 @@ import Link from 'next/link'
export const ArticleInfo = props => {
const { post } = props
const { locale } = useGlobal()
- console.log(post)
return (
-
+
{post?.title}
@@ -21,10 +20,7 @@ export const ArticleInfo = props => {
{post?.type !== 'Page' && (
<>
-
+
{post?.category}
>
diff --git a/themes/movie/components/BlogRecommend.js b/themes/movie/components/BlogRecommend.js
new file mode 100644
index 00000000..c1b857f3
--- /dev/null
+++ b/themes/movie/components/BlogRecommend.js
@@ -0,0 +1,62 @@
+import LazyImage from '@/components/LazyImage'
+import { siteConfig } from '@/lib/config'
+import { useGlobal } from '@/lib/global'
+import { checkContainHttp, sliceUrlFromHttp } from '@/lib/utils'
+import Link from 'next/link'
+import CONFIG from '../config'
+
+/**
+ * 关联推荐文章
+ * @param {prev,next} param0
+ * @returns
+ */
+export default function BlogRecommend(props) {
+ const { recommendPosts, siteInfo } = props
+ const { locale } = useGlobal()
+ if (!siteConfig('MOVIE_ARTICLE_RECOMMEND', null, CONFIG) || !recommendPosts || recommendPosts.length === 0) {
+ return <>>
+ }
+
+ return (
+
+
+
+
+ {locale.COMMON.RELATE_POSTS}
+
+
+
+ {recommendPosts.map(post => {
+ const headerImage = post?.pageCoverThumbnail ? post.pageCoverThumbnail : siteInfo?.pageCover
+ const url = checkContainHttp(post.slug)
+ ? sliceUrlFromHttp(post.slug)
+ : `${siteConfig('SUB_PATH', '')}/${post.slug}`
+
+ return (
+
+
+
+ {/* 卡片的阴影遮罩,为了凸显图片上的文字 */}
+
+
+
+
+
+ )
+ })}
+
+
+ )
+}
diff --git a/themes/movie/config.js b/themes/movie/config.js
index 48403075..ad775bbd 100644
--- a/themes/movie/config.js
+++ b/themes/movie/config.js
@@ -8,7 +8,8 @@ const CONFIG = {
MOVIE_MENU_ARCHIVE: true, // 显示归档
MOVIE_MENU_SEARCH: true, // 显示搜索
- MOVIE_POST_LIST_COVER: true // 列表显示文章封面
+ MOVIE_ARTICLE_RECOMMEND: true, // 推荐关联内容在文章底部
+ MOVIE_POST_LIST_COVER: true // 列表显示文章封面
}
export default CONFIG
diff --git a/themes/movie/index.js b/themes/movie/index.js
index 4b114d37..e31e6a36 100644
--- a/themes/movie/index.js
+++ b/themes/movie/index.js
@@ -18,6 +18,7 @@ import { ArticleLock } from './components/ArticleLock'
import BlogListGroupByDate from './components/BlogListGroupByDate'
import { BlogListPage } from './components/BlogListPage'
import { BlogListScroll } from './components/BlogListScroll'
+import BlogRecommend from './components/BlogRecommend'
import CategoryGroup from './components/CategoryGroup'
import CategoryItem from './components/CategoryItem'
import { Footer } from './components/Footer'
@@ -140,6 +141,73 @@ const LayoutSlug = props => {
const { post, lock, validPassword } = props
const router = useRouter()
useEffect(() => {
+ // 用js 实现将页面中的多个视频聚合为一个分集的视频
+ function combineVideo() {
+ // 找到 id 为 notion-article 的元素
+ const notionArticle = document.getElementById('notion-article')
+ if (!notionArticle) return // 如果找不到对应的元素,则退出函数
+
+ // 找到所有的 .notion-asset-wrapper 元素
+ const assetWrappers = document.querySelectorAll('.notion-asset-wrapper')
+
+ // 创建一个新的容器元素
+ const carouselWrapper = document.createElement('div')
+ carouselWrapper.classList.add('notion-carousel-wrapper')
+
+ // 创建一个用于保存 figcaption 文本内容的数组
+ const figCaptionValues = []
+
+ // 遍历所有 .notion-asset-wrapper 元素
+ assetWrappers.forEach((wrapper, index) => {
+ // 检查 .notion-asset-wrapper 元素是否有子元素 figcaption
+ const figCaption = wrapper.querySelector('figcaption')
+ if (!figCaption) return // 如果没有子元素 figcaption,则不处理该元素
+
+ // 检查 .notion-asset-wrapper 元素是否有 notion-asset-wrapper-video 或 notion-asset-wrapper-embed 类
+ if (
+ !wrapper.classList.contains('notion-asset-wrapper-video') &&
+ !wrapper.classList.contains('notion-asset-wrapper-embed')
+ )
+ return
+
+ // 获取 figcaption 的文本内容并添加到数组中
+ figCaptionValues.push(figCaption.textContent.trim())
+
+ // 创建一个新的 div 元素用于包裹当前的 .notion-asset-wrapper 元素
+ const carouselItem = document.createElement('div')
+ carouselItem.classList.add('notion-carousel')
+ carouselItem.appendChild(wrapper.cloneNode(true))
+
+ // 如果是第一个元素,设置为 active
+ if (index === 0) {
+ carouselItem.classList.add('active')
+ }
+
+ // 将新创建的元素添加到容器中
+ carouselWrapper.appendChild(carouselItem)
+
+ // 从 DOM 中移除原始的 .notion-asset-wrapper 元素
+ wrapper.parentNode.removeChild(wrapper)
+ })
+
+ // 创建一个用于保存 figcaption 值的容器元素
+ const figCaptionWrapper = document.createElement('div')
+ figCaptionWrapper.classList.add('notion-carousel-route')
+
+ // 遍历 figCaptionValues 数组,并将每个值添加到容器元素中
+ figCaptionValues.forEach(value => {
+ const div = document.createElement('div')
+ div.textContent = value
+ figCaptionWrapper.appendChild(div)
+ })
+
+ // 将包含 figcaption 值的容器元素添加到 notion-article 的第一个子元素插入
+ notionArticle.insertBefore(figCaptionWrapper, notionArticle.firstChild)
+ // 将新创建的容器元素作为 notion-article 的第一个子元素插入
+ notionArticle.insertBefore(carouselWrapper, notionArticle.firstChild)
+ }
+
+ combineVideo()
// 404
if (!post) {
setTimeout(
@@ -165,6 +233,8 @@ const LayoutSlug = props => {
{/* 页面元素 */}
+ {/* 推荐 */}
+
{/* 分享栏目 */}
{/* 评论区 */}
diff --git a/themes/movie/style.js b/themes/movie/style.js
index 7aee6f73..04fa9e3a 100644
--- a/themes/movie/style.js
+++ b/themes/movie/style.js
@@ -17,6 +17,20 @@ const Style = () => {
0 26px 58px 0 rgba(0, 0, 0, 0.22),
0 5px 14px 0 rgba(0, 0, 0, 0.18);
}
+
+ // 视频聚合走马灯
+ .notion-carousel {
+ width: 100%; /* 根据需要调整 */
+ overflow: hidden;
+ }
+
+ .notion-carousel-wrapper .notion-carousel {
+ display: none;
+ }
+
+ .notion-carousel-wrapper .notion-carousel.active {
+ display: block;
+ }
`}
)
}
From 237ac41c9da4a4529224f6ef6b87c302a1c683bf Mon Sep 17 00:00:00 2001
From: tangly1024
Date: Fri, 15 Mar 2024 22:44:23 +0800
Subject: [PATCH 38/90] =?UTF-8?q?waline=20component=E8=B0=83=E6=95=B4?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
components/WalineComponent.js | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/components/WalineComponent.js b/components/WalineComponent.js
index 37247d48..cd2d78f5 100644
--- a/components/WalineComponent.js
+++ b/components/WalineComponent.js
@@ -1,4 +1,4 @@
-import React, { createRef } from 'react'
+import { createRef } from 'react'
import { init } from '@waline/client'
import { useRouter } from 'next/router'
import '@waline/client/dist/waline.css'
@@ -21,7 +21,7 @@ const WalineComponent = (props) => {
}
}
- React.useEffect(() => {
+ useEffect(() => {
if (!waline) {
waline = init({
...props,
From ae10ad1ebf9a3de46350f97f2062c969034368bd Mon Sep 17 00:00:00 2001
From: tangly1024
Date: Fri, 15 Mar 2024 23:30:21 +0800
Subject: [PATCH 39/90] =?UTF-8?q?=E8=A7=86=E9=A2=91=E8=81=9A=E5=90=88?=
=?UTF-8?q?=E6=92=AD=E6=94=BE=E6=95=88=E6=9E=9C?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
themes/movie/components/BlogRecommend.js | 2 +-
themes/movie/index.js | 65 +++++++++++++++++++-----
themes/movie/style.js | 9 ++++
3 files changed, 61 insertions(+), 15 deletions(-)
diff --git a/themes/movie/components/BlogRecommend.js b/themes/movie/components/BlogRecommend.js
index c1b857f3..9e434558 100644
--- a/themes/movie/components/BlogRecommend.js
+++ b/themes/movie/components/BlogRecommend.js
@@ -38,7 +38,7 @@ export default function BlogRecommend(props) {
title={post.title}
href={url}
passHref
- className='flex rounded-lg h-72 w-52 cursor-pointer overflow-hidden'>
+ className='flex rounded-lg h-60 w-48 cursor-pointer overflow-hidden'>
{post.title}
diff --git a/themes/movie/index.js b/themes/movie/index.js
index e31e6a36..75e9abae 100644
--- a/themes/movie/index.js
+++ b/themes/movie/index.js
@@ -149,6 +149,15 @@ const LayoutSlug = props => {
// 找到所有的 .notion-asset-wrapper 元素
const assetWrappers = document.querySelectorAll('.notion-asset-wrapper')
+ if (!assetWrappers || assetWrappers.length === 0) return // 如果找不到对应的元素,则退出函数
+
+ // 不要重复创建
+ const exists = document.querySelectorAll('.video-wrapper')
+ if (exists && exists.length > 0) return
+
+ // 创建一个新的容器元素
+ const videoWrapper = document.createElement('div')
+ videoWrapper.className = 'video-wrapper p-2 bg-gray-100 dark:bg-hexo-black-gray max-w-5xl mx-auto'
// 创建一个新的容器元素
const carouselWrapper = document.createElement('div')
@@ -171,43 +180,61 @@ const LayoutSlug = props => {
return
// 获取 figcaption 的文本内容并添加到数组中
- figCaptionValues.push(figCaption.textContent.trim())
+ const figCaptionValue = figCaption.textContent.trim()
+ figCaptionValues.push(figCaptionValue)
// 创建一个新的 div 元素用于包裹当前的 .notion-asset-wrapper 元素
const carouselItem = document.createElement('div')
carouselItem.classList.add('notion-carousel')
- carouselItem.appendChild(wrapper.cloneNode(true))
-
+ carouselItem.appendChild(wrapper)
// 如果是第一个元素,设置为 active
if (index === 0) {
carouselItem.classList.add('active')
}
-
- // 将新创建的元素添加到容器中
+ // 将元素添加到容器中
carouselWrapper.appendChild(carouselItem)
-
// 从 DOM 中移除原始的 .notion-asset-wrapper 元素
- wrapper.parentNode.removeChild(wrapper)
+ // wrapper.parentNode.removeChild(wrapper)
})
// 创建一个用于保存 figcaption 值的容器元素
const figCaptionWrapper = document.createElement('div')
- figCaptionWrapper.classList.add('notion-carousel-route')
+ figCaptionWrapper.className = 'notion-carousel-route py-2 max-h-36 overflow-y-auto'
// 遍历 figCaptionValues 数组,并将每个值添加到容器元素中
figCaptionValues.forEach(value => {
const div = document.createElement('div')
div.textContent = value
+ div.addEventListener('click', function () {
+ // 遍历所有的 carouselItem 元素
+ document.querySelectorAll('.notion-carousel').forEach(item => {
+ // 判断当前元素是否包含该 figCaption 的文本内容,如果是则设置为 active,否则取消 active
+ if (item.querySelector('figcaption').textContent.trim() === value) {
+ item.classList.add('active')
+ } else {
+ item.classList.remove('active')
+ // 不活跃窗口暂停播放,仅支持notion上传视频、不支持外链
+ item.querySelectorAll('video')?.forEach(video => {
+ video.pause()
+ })
+ }
+ })
+ })
figCaptionWrapper.appendChild(div)
})
- // 将包含 figcaption 值的容器元素添加到 notion-article 的第一个子元素插入
- notionArticle.insertBefore(figCaptionWrapper, notionArticle.firstChild)
- // 将新创建的容器元素作为 notion-article 的第一个子元素插入
- notionArticle.insertBefore(carouselWrapper, notionArticle.firstChild)
+ // 将包含 figcaption 值的容器元素添加到 notion-article 的第一个子元素插入
+ videoWrapper.appendChild(carouselWrapper)
+ if (figCaptionValues.length > 1) {
+ videoWrapper.appendChild(figCaptionWrapper)
+ }
+ notionArticle.insertBefore(videoWrapper, notionArticle.firstChild)
}
- combineVideo()
+ setTimeout(() => {
+ combineVideo()
+ }, 100)
+
// 404
if (!post) {
setTimeout(
@@ -224,11 +251,21 @@ const LayoutSlug = props => {
siteConfig('POST_WAITING_TIME_FOR_404') * 1000
)
}
+ return () => {
+ // 获取所有 class="video-wrapper" 的元素
+ const videoWrappers = document.querySelectorAll('.video-wrapper')
+
+ // 遍历所有匹配的元素并移除它们
+ videoWrappers.forEach(wrapper => {
+ wrapper.parentNode.removeChild(wrapper) // 从 DOM 中移除元素
+ })
+ }
}, [post])
+
return (
<>
{!lock ? (
-
+
{/* 标题 */}
{/* 页面元素 */}
diff --git a/themes/movie/style.js b/themes/movie/style.js
index 04fa9e3a..c619b509 100644
--- a/themes/movie/style.js
+++ b/themes/movie/style.js
@@ -31,6 +31,15 @@ const Style = () => {
.notion-carousel-wrapper .notion-carousel.active {
display: block;
}
+
+ .notion-carousel-route div {
+ cursor: pointer;
+ margin-bottom: 0.2rem;
+ }
+
+ .notion-carousel-route div:hover {
+ text-decoration: underline;
+ }
`}
)
}
From ad83d3134a118ca7139317d053ace5bf94db9d40 Mon Sep 17 00:00:00 2001
From: Bhwa233 <404174262@qq.com>
Date: Sat, 16 Mar 2024 11:13:24 +0800
Subject: [PATCH 40/90] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=A4=9C=E9=97=B4?=
=?UTF-8?q?=E6=A8=A1=E5=BC=8F=E6=8A=98=E5=8F=A0=E6=8C=89=E9=92=AE=E7=9C=8B?=
=?UTF-8?q?=E4=B8=8D=E5=88=B0?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
themes/fukasawa/components/AsideLeft.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/themes/fukasawa/components/AsideLeft.js b/themes/fukasawa/components/AsideLeft.js
index 5083269b..0c8aa27d 100644
--- a/themes/fukasawa/components/AsideLeft.js
+++ b/themes/fukasawa/components/AsideLeft.js
@@ -78,7 +78,7 @@ function AsideLeft(props) {
return
{/* 折叠按钮 */}
- {siteConfig('FUKASAWA_SIDEBAR_COLLAPSE_BUTTON', null, CONFIG) &&
+ {siteConfig('FUKASAWA_SIDEBAR_COLLAPSE_BUTTON', null, CONFIG) &&
{isCollapsed ? : }
}
From 2b70058f70f590b05b5de9cad2c5b2db37f97b9a Mon Sep 17 00:00:00 2001
From: Bhwa233 <404174262@qq.com>
Date: Sat, 16 Mar 2024 11:48:24 +0800
Subject: [PATCH 41/90] =?UTF-8?q?=E6=8A=98=E5=8F=A0=E6=8C=89=E9=92=AE?=
=?UTF-8?q?=E9=80=82=E9=85=8D=E5=8F=B3=E8=BE=B9=E6=A0=8F?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
themes/fukasawa/components/AsideLeft.js | 24 ++++++++++++++++++++----
1 file changed, 20 insertions(+), 4 deletions(-)
diff --git a/themes/fukasawa/components/AsideLeft.js b/themes/fukasawa/components/AsideLeft.js
index 0c8aa27d..984385cf 100644
--- a/themes/fukasawa/components/AsideLeft.js
+++ b/themes/fukasawa/components/AsideLeft.js
@@ -14,7 +14,7 @@ import { AdSlot } from '@/components/GoogleAdsense'
import { siteConfig } from '@/lib/config'
import MailChimpForm from './MailChimpForm'
import { useGlobal } from '@/lib/global'
-import { useEffect, useState } from 'react'
+import { useEffect, useMemo, useState } from 'react'
import { isBrowser } from '@/lib/utils'
import { debounce } from 'lodash'
@@ -75,14 +75,30 @@ function AsideLeft(props) {
}
}
}, [])
-
+ const position = useMemo(()=>{
+ const isReverse = JSON.parse(siteConfig('LAYOUT_SIDEBAR_REVERSE'))
+ if(isCollapsed){
+ if(isReverse){
+ return 'right-2'
+ }else{
+ return 'left-2'
+ }
+ }else{
+ if(isReverse){
+ return 'right-80'
+ }else{
+ return 'left-80'
+ }
+ }
+ },[isCollapsed] )
+
return
{/* 折叠按钮 */}
- {siteConfig('FUKASAWA_SIDEBAR_COLLAPSE_BUTTON', null, CONFIG) &&
+ {siteConfig('FUKASAWA_SIDEBAR_COLLAPSE_BUTTON', null, CONFIG) &&
{isCollapsed ? : }
}
-
+
From b1ffa283034cd02e27923be7d7cdacb1643a7254 Mon Sep 17 00:00:00 2001
From: Bhwa233 <404174262@qq.com>
Date: Sat, 16 Mar 2024 14:34:03 +0800
Subject: [PATCH 42/90] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E6=93=8D=E4=BD=9C?=
=?UTF-8?q?=E6=8F=90=E7=A4=BA?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
components/AlgoliaSearchModal.js | 28 +++++++++++++++++++++++++++-
components/ShortcutTag.js | 7 +++++++
2 files changed, 34 insertions(+), 1 deletion(-)
create mode 100644 components/ShortcutTag.js
diff --git a/components/AlgoliaSearchModal.js b/components/AlgoliaSearchModal.js
index 54465826..49cad8b2 100644
--- a/components/AlgoliaSearchModal.js
+++ b/components/AlgoliaSearchModal.js
@@ -1,4 +1,4 @@
-import { useState, useImperativeHandle, useRef, useEffect } from 'react'
+import { useState, useImperativeHandle, useRef, useEffect, Fragment } from 'react'
import algoliasearch from 'algoliasearch'
import replaceSearchResult from '@/components/Mark'
import Link from 'next/link'
@@ -6,6 +6,23 @@ import { useGlobal } from '@/lib/global'
import throttle from 'lodash/throttle'
import { siteConfig } from '@/lib/config'
import { useHotkeys } from 'react-hotkeys-hook';
+import ShortcutTag from '@/components/ShortcutTag'
+
+const ShortCutActions = [
+ {
+ key: '↑ ↓',
+ action: '选择'
+ },
+ {
+ key: 'Enter',
+ action: '跳转'
+ },
+ {
+ key: 'Esc',
+ action: '关闭'
+ }
+
+]
/**
* 结合 Algolia 实现的弹出式搜索框
@@ -234,6 +251,15 @@ export default function AlgoliaSearchModal({ cRef }) {
+ {totalHit === 0 && (
+ {
+ ShortCutActions.map((action, index) => {
+ return
{action.key}
+ {action.action}
+ })
+ }
+
)
+ }
{totalHit > 0 && (
diff --git a/components/ShortcutTag.js b/components/ShortcutTag.js
new file mode 100644
index 00000000..4e36e8be
--- /dev/null
+++ b/components/ShortcutTag.js
@@ -0,0 +1,7 @@
+// 操作提示标签
+import React from 'react';
+
+const ShortcutTag = ({ children, className }) => {
+ return
{children}
+}
+export default ShortcutTag
\ No newline at end of file
From c0acdbff4336cf9c7d8f1cc55228395d86516b76 Mon Sep 17 00:00:00 2001
From: Bhwa233 <404174262@qq.com>
Date: Sat, 16 Mar 2024 14:50:07 +0800
Subject: [PATCH 43/90] =?UTF-8?q?=E8=B0=83=E6=95=B4=E6=A0=B7=E5=BC=8F?=
=?UTF-8?q?=EF=BC=8C=E5=88=A0=E9=99=A4=E5=A4=9A=E4=BD=99=E4=BB=A3=E7=A0=81?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
components/AlgoliaSearchModal.js | 3 +--
components/ShortcutTag.js | 7 -------
2 files changed, 1 insertion(+), 9 deletions(-)
delete mode 100644 components/ShortcutTag.js
diff --git a/components/AlgoliaSearchModal.js b/components/AlgoliaSearchModal.js
index 49cad8b2..8fc62d91 100644
--- a/components/AlgoliaSearchModal.js
+++ b/components/AlgoliaSearchModal.js
@@ -6,7 +6,6 @@ import { useGlobal } from '@/lib/global'
import throttle from 'lodash/throttle'
import { siteConfig } from '@/lib/config'
import { useHotkeys } from 'react-hotkeys-hook';
-import ShortcutTag from '@/components/ShortcutTag'
const ShortCutActions = [
{
@@ -254,7 +253,7 @@ export default function AlgoliaSearchModal({ cRef }) {
{totalHit === 0 && (
{
ShortCutActions.map((action, index) => {
- return
{action.key}
+ return {action.key}
{action.action}
})
}
diff --git a/components/ShortcutTag.js b/components/ShortcutTag.js
deleted file mode 100644
index 4e36e8be..00000000
--- a/components/ShortcutTag.js
+++ /dev/null
@@ -1,7 +0,0 @@
-// 操作提示标签
-import React from 'react';
-
-const ShortcutTag = ({ children, className }) => {
- return {children}
-}
-export default ShortcutTag
\ No newline at end of file
From a407cd548d5eaff2a32e2ecfd91834f190809384 Mon Sep 17 00:00:00 2001
From: Bhwa233 <404174262@qq.com>
Date: Sat, 16 Mar 2024 15:01:18 +0800
Subject: [PATCH 44/90] =?UTF-8?q?format=20=E4=BB=A3=E7=A0=81?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
components/AlgoliaSearchModal.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/components/AlgoliaSearchModal.js b/components/AlgoliaSearchModal.js
index 8fc62d91..ea727a48 100644
--- a/components/AlgoliaSearchModal.js
+++ b/components/AlgoliaSearchModal.js
@@ -253,7 +253,7 @@ export default function AlgoliaSearchModal({ cRef }) {
{totalHit === 0 && (
{
ShortCutActions.map((action, index) => {
- return
{action.key}
+ return {action.key}
{action.action}
})
}
From a8b7f37377327d3ecb69b79df27cfaab9ce8ff4f Mon Sep 17 00:00:00 2001
From: Bhwa233 <404174262@qq.com>
Date: Sat, 16 Mar 2024 16:16:17 +0800
Subject: [PATCH 45/90] =?UTF-8?q?=E4=BF=AE=E5=A4=8DuseMemo=E4=BD=8D?=
=?UTF-8?q?=E7=BD=AE?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
themes/fukasawa/components/AsideLeft.js | 34 +++++++++++++------------
1 file changed, 18 insertions(+), 16 deletions(-)
diff --git a/themes/fukasawa/components/AsideLeft.js b/themes/fukasawa/components/AsideLeft.js
index 984385cf..f6025d04 100644
--- a/themes/fukasawa/components/AsideLeft.js
+++ b/themes/fukasawa/components/AsideLeft.js
@@ -45,6 +45,23 @@ function AsideLeft(props) {
}
}, [isCollapsed])
+ const position = useMemo(() => {
+ const isReverse = JSON.parse(siteConfig('LAYOUT_SIDEBAR_REVERSE'))
+ if (isCollapsed) {
+ if (isReverse) {
+ return 'right-2'
+ } else {
+ return 'left-2'
+ }
+ } else {
+ if (isReverse) {
+ return 'right-80'
+ } else {
+ return 'left-80'
+ }
+ }
+ }, [isCollapsed])
+
// 折叠侧边栏
const toggleOpen = () => {
setIsCollapse(!isCollapsed)
@@ -75,22 +92,7 @@ function AsideLeft(props) {
}
}
}, [])
- const position = useMemo(()=>{
- const isReverse = JSON.parse(siteConfig('LAYOUT_SIDEBAR_REVERSE'))
- if(isCollapsed){
- if(isReverse){
- return 'right-2'
- }else{
- return 'left-2'
- }
- }else{
- if(isReverse){
- return 'right-80'
- }else{
- return 'left-80'
- }
- }
- },[isCollapsed] )
+
return
{/* 折叠按钮 */}
From 65c498d0f11f543e6b8a7f92a23ab4766264c6b9 Mon Sep 17 00:00:00 2001
From: tangly1024
Date: Sat, 16 Mar 2024 20:39:18 +0800
Subject: [PATCH 46/90] =?UTF-8?q?gitbook=E6=9C=80=E6=96=B0=E6=9C=AA?=
=?UTF-8?q?=E8=AF=BB=E6=9C=BA=E5=88=B6=E4=BC=98=E5=8C=96?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
themes/gitbook/index.js | 17 ++++++++++-------
1 file changed, 10 insertions(+), 7 deletions(-)
diff --git a/themes/gitbook/index.js b/themes/gitbook/index.js
index 6a4affae..5f4169ba 100644
--- a/themes/gitbook/index.js
+++ b/themes/gitbook/index.js
@@ -46,13 +46,13 @@ export const useGitBookGlobal = () => useContext(ThemeGlobalGitbook)
* 给最新的文章标一个红点
*/
function getNavPagesWithLatest(allNavPages, latestPosts, post) {
- // 检测需要去除红点的文章 ; localStorage 的 posts_read = {"${post.id}":"Date()"} 保存了所有已读的页面id,和阅读时间;
- // 如果页面在这里面则不显示红点
- const postRead = JSON.parse(localStorage.getItem('post_read') || '[]');
- if (post && !postRead.includes(post.id)) {
- postRead.push(post.id);
+ // localStorage 保存id和上次阅读时间戳: posts_read_time = {"${post.id}":"Date()"}
+ const postReadTime = JSON.parse(localStorage.getItem('post_read_time') || '{}');
+ if (post) {
+ postReadTime[post.id] = new Date().getTime();
}
- localStorage.setItem('post_read', JSON.stringify(postRead));
+ // 更新
+ localStorage.setItem('post_read_time', JSON.stringify(postReadTime));
return allNavPages?.map(item => {
const res = {
@@ -66,7 +66,10 @@ function getNavPagesWithLatest(allNavPages, latestPosts, post) {
pageIcon: item.pageIcon || '',
lastEditedDate: item.lastEditedDate
}
- if (latestPosts.some(post => post.id === item.id) && !postRead.includes(item.id)) {
+ // 属于最新文章通常6篇 && (无阅读记录 || 最近更新时间大于上次阅读时间)
+ if (latestPosts.some(post => post.id === item.id) &&
+ (!postReadTime[item.id] || postReadTime[item.id] < new Date(item.lastEditedDate).getTime())
+ ) {
return { ...res, isLatest: true };
} else {
return res;
From e2080eabf9050d38103e0b892b7f9a72074d627b Mon Sep 17 00:00:00 2001
From: tangly1024
Date: Sat, 16 Mar 2024 23:20:25 +0800
Subject: [PATCH 47/90] =?UTF-8?q?movie=E4=B8=BB=E9=A2=98=E8=B0=83=E6=95=B4?=
=?UTF-8?q?=E3=80=81dplayer=E5=8A=A0=E5=85=A5?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
public/videos/dplayer.html | 50 +++++++++++++++++++++++++
themes/movie/components/BlogPostCard.js | 4 +-
themes/movie/components/CategoryItem.js | 2 +-
themes/movie/components/TagItem.js | 5 +--
themes/movie/components/TagItemMini.js | 4 +-
themes/movie/config.js | 1 +
themes/movie/index.js | 9 +++--
7 files changed, 63 insertions(+), 12 deletions(-)
create mode 100644 public/videos/dplayer.html
diff --git a/public/videos/dplayer.html b/public/videos/dplayer.html
new file mode 100644
index 00000000..66573c2b
--- /dev/null
+++ b/public/videos/dplayer.html
@@ -0,0 +1,50 @@
+
+
+
+
+
+
+ DPlayer Video Player
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/themes/movie/components/BlogPostCard.js b/themes/movie/components/BlogPostCard.js
index eadcfb7c..61954610 100644
--- a/themes/movie/components/BlogPostCard.js
+++ b/themes/movie/components/BlogPostCard.js
@@ -23,11 +23,11 @@ const BlogPostCard = ({ index, post, showSummary, siteInfo }) => {
-
+
{post?.tagItems && post?.tagItems.length > 0 && (
<>
diff --git a/themes/movie/components/CategoryItem.js b/themes/movie/components/CategoryItem.js
index d69de464..1190965b 100644
--- a/themes/movie/components/CategoryItem.js
+++ b/themes/movie/components/CategoryItem.js
@@ -12,7 +12,7 @@ export default function CategoryItem({ category }) {
href={`/category/${category.name}`}
passHref
legacyBehavior>
-
+
{category.name}({category.count})
diff --git a/themes/movie/components/TagItem.js b/themes/movie/components/TagItem.js
index dab00325..c608c8cb 100644
--- a/themes/movie/components/TagItem.js
+++ b/themes/movie/components/TagItem.js
@@ -12,10 +12,9 @@ export default function TagItem({ tag }) {
key={tag}
href={`/tag/${encodeURIComponent(tag.name)}`}
passHref
- className={`cursor-pointer inline-block rounded hover:bg-gray-500 hover:text-white duration-200 mr-2 py-1 px-2 text-xs whitespace-nowrap dark:hover:text-white text-gray-600 hover:shadow-xl notion-${tag.color}_background dark:bg-gray-800`}
+ className={`cursor-pointer inline-block rounded duration-200 mr-2 py-1 px-2 text-xs whitespace-nowrap`}
>
-
-
{' '}
+
{tag.name + (tag.count ? `(${tag.count})` : '')}{' '}
diff --git a/themes/movie/components/TagItemMini.js b/themes/movie/components/TagItemMini.js
index e5d29782..a4b7da1c 100644
--- a/themes/movie/components/TagItemMini.js
+++ b/themes/movie/components/TagItemMini.js
@@ -6,9 +6,9 @@ const TagItemMini = ({ tag, selected = false }) => {
key={tag}
href={selected ? '/' : `/tag/${encodeURIComponent(tag.name)}`}
passHref
- className={'inline-block rounded-xl py-0.5 mr-2 text-[#2EBF8B]'}
+ className={'inline-block rounded-xl py-0.5 mr-2'}
>
-
+
{selected && }{' '}
{tag.name + (tag.count ? `(${tag.count})` : '')}{' '}
diff --git a/themes/movie/config.js b/themes/movie/config.js
index ad775bbd..a2c5fd4d 100644
--- a/themes/movie/config.js
+++ b/themes/movie/config.js
@@ -9,6 +9,7 @@ const CONFIG = {
MOVIE_MENU_SEARCH: true, // 显示搜索
MOVIE_ARTICLE_RECOMMEND: true, // 推荐关联内容在文章底部
+ MOVIE_VIDEO_COMBINE: true, // 聚合视频,开启后一篇文章内的多个含caption的视频会被合并到文章开头,并展示分集按钮
MOVIE_POST_LIST_COVER: true // 列表显示文章封面
}
diff --git a/themes/movie/index.js b/themes/movie/index.js
index 75e9abae..5b7f9184 100644
--- a/themes/movie/index.js
+++ b/themes/movie/index.js
@@ -64,7 +64,7 @@ const LayoutBase = props => {
{/* 主体 */}
-
+
{/* 标题栏 */}
{/* {fullWidth ? null :
} */}
@@ -223,12 +223,13 @@ const LayoutSlug = props => {
figCaptionWrapper.appendChild(div)
})
- // 将包含 figcaption 值的容器元素添加到 notion-article 的第一个子元素插入
- videoWrapper.appendChild(carouselWrapper)
+ // 条件是带有caption的视频数量大于1个,否则不处理
if (figCaptionValues.length > 1) {
+ // 将包含 figcaption 值的容器元素添加到 notion-article 的第一个子元素插入
+ videoWrapper.appendChild(carouselWrapper)
videoWrapper.appendChild(figCaptionWrapper)
+ notionArticle.insertBefore(videoWrapper, notionArticle.firstChild)
}
- notionArticle.insertBefore(videoWrapper, notionArticle.firstChild)
}
setTimeout(() => {
From b89271cc4a7d0a1350f2705d55bf5e9a17ab9870 Mon Sep 17 00:00:00 2001
From: tangly1024
Date: Sat, 16 Mar 2024 23:27:02 +0800
Subject: [PATCH 48/90] build
---
components/WalineComponent.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/components/WalineComponent.js b/components/WalineComponent.js
index cd2d78f5..960f153f 100644
--- a/components/WalineComponent.js
+++ b/components/WalineComponent.js
@@ -1,4 +1,4 @@
-import { createRef } from 'react'
+import { createRef, useEffect } from 'react'
import { init } from '@waline/client'
import { useRouter } from 'next/router'
import '@waline/client/dist/waline.css'
From e74dc2b6378444d12bf957914ea61020dc6b7736 Mon Sep 17 00:00:00 2001
From: tangly1024
Date: Sat, 16 Mar 2024 23:56:08 +0800
Subject: [PATCH 49/90] Dplayer.htm
---
public/dplayer.htm | 50 ++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 50 insertions(+)
create mode 100644 public/dplayer.htm
diff --git a/public/dplayer.htm b/public/dplayer.htm
new file mode 100644
index 00000000..67348de4
--- /dev/null
+++ b/public/dplayer.htm
@@ -0,0 +1,50 @@
+
+
+
+
+
+
+ DPlayer Video Player
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
From f009bd6f9cdb33656326087ea91ccc4899ae2f14 Mon Sep 17 00:00:00 2001
From: tangly1024
Date: Sun, 17 Mar 2024 00:21:11 +0800
Subject: [PATCH 50/90] =?UTF-8?q?=E6=B7=B1=E8=89=B2=E9=A2=9D=E6=A8=A1?=
=?UTF-8?q?=E5=BC=8F=E9=80=BB=E8=BE=91?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
lib/global.js | 5 ++--
public/videos/dplayer.html | 50 --------------------------------------
themes/theme.js | 15 ++++++++----
3 files changed, 13 insertions(+), 57 deletions(-)
delete mode 100644 public/videos/dplayer.html
diff --git a/lib/global.js b/lib/global.js
index 4eadfa19..57f5e41d 100644
--- a/lib/global.js
+++ b/lib/global.js
@@ -16,7 +16,8 @@ export function GlobalContextProvider(props) {
const [lang, updateLang] = useState(NOTION_CONFIG?.LANG || LANG) // 默认语言
const [locale, updateLocale] = useState(generateLocaleDict(NOTION_CONFIG?.LANG || LANG)) // 默认语言
const [theme, setTheme] = useState(NOTION_CONFIG?.THEME || THEME) // 默认博客主题
- const [isDarkMode, updateDarkMode] = useState(NOTION_CONFIG?.APPEARANCE || APPEARANCE === 'dark') // 默认深色模式
+ const defaultDarkMode = NOTION_CONFIG?.APPEARANCE || APPEARANCE === 'dark'
+ const [isDarkMode, updateDarkMode] = useState(defaultDarkMode) // 默认深色模式
const [onLoading, setOnLoading] = useState(false) // 抓取文章数据
const router = useRouter()
@@ -57,7 +58,7 @@ export function GlobalContextProvider(props) {
}
useEffect(() => {
- initDarkMode(updateDarkMode)
+ initDarkMode(updateDarkMode,defaultDarkMode)
initLocale(lang, locale, updateLang, updateLocale)
}, [])
diff --git a/public/videos/dplayer.html b/public/videos/dplayer.html
deleted file mode 100644
index 66573c2b..00000000
--- a/public/videos/dplayer.html
+++ /dev/null
@@ -1,50 +0,0 @@
-
-
-
-
-
-
- DPlayer Video Player
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/themes/theme.js b/themes/theme.js
index 5a237dce..7b50b1ee 100644
--- a/themes/theme.js
+++ b/themes/theme.js
@@ -90,14 +90,19 @@ const checkThemeDOM = () => {
* @param updateDarkMode 更改主题ChangeState函数
* @description 读取cookie中存的用户主题
*/
-export const initDarkMode = (updateDarkMode) => {
+export const initDarkMode = (updateDarkMode,defaultDarkMode) => {
// 查看用户设备浏览器是否深色模型
let newDarkMode = isPreferDark()
- // 查看cookie中是否用户强制设置深色模式
- const cookieDarkMode = loadDarkModeFromLocalStorage()
- if (cookieDarkMode) {
- newDarkMode = JSON.parse(cookieDarkMode)
+ // 查看localStorage中用户记录的是否深色模式
+ const userDarkMode = loadDarkModeFromLocalStorage()
+ if (userDarkMode) {
+ newDarkMode = userDarkMode
+ }
+
+ // 如果站点强制设置默认深色,则优先级改过用
+ if(defaultDarkMode){
+ newDarkMode = defaultDarkMode
}
// url查询条件中是否深色模式
From 05059a6b498b3c78f41bbcaa9b53a5d5613688fc Mon Sep 17 00:00:00 2001
From: tangly1024
Date: Sun, 17 Mar 2024 11:18:15 +0800
Subject: [PATCH 51/90] =?UTF-8?q?=E6=9B=B4=E6=96=B0=20theme.js?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
themes/theme.js | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/themes/theme.js b/themes/theme.js
index 7b50b1ee..794b0303 100644
--- a/themes/theme.js
+++ b/themes/theme.js
@@ -101,9 +101,9 @@ export const initDarkMode = (updateDarkMode,defaultDarkMode) => {
}
// 如果站点强制设置默认深色,则优先级改过用
- if(defaultDarkMode){
- newDarkMode = defaultDarkMode
- }
+ //if(defaultDarkMode){
+ //newDarkMode = defaultDarkMode
+ //}
// url查询条件中是否深色模式
const queryMode = getQueryVariable('mode')
From 1099571e85f288f24a8c86477f5582b7bbd0fe99 Mon Sep 17 00:00:00 2001
From: tangly1024
Date: Sun, 17 Mar 2024 13:50:06 +0800
Subject: [PATCH 52/90] theme movie & dark mode
---
lib/global.js | 2 +-
public/dplayer.htm | 13 +++++++--
themes/movie/index.js | 2 +-
themes/theme.js | 62 ++++++++++++++++++++++++-------------------
4 files changed, 48 insertions(+), 31 deletions(-)
diff --git a/lib/global.js b/lib/global.js
index 57f5e41d..4b24b0d2 100644
--- a/lib/global.js
+++ b/lib/global.js
@@ -16,7 +16,7 @@ export function GlobalContextProvider(props) {
const [lang, updateLang] = useState(NOTION_CONFIG?.LANG || LANG) // 默认语言
const [locale, updateLocale] = useState(generateLocaleDict(NOTION_CONFIG?.LANG || LANG)) // 默认语言
const [theme, setTheme] = useState(NOTION_CONFIG?.THEME || THEME) // 默认博客主题
- const defaultDarkMode = NOTION_CONFIG?.APPEARANCE || APPEARANCE === 'dark'
+ const defaultDarkMode = NOTION_CONFIG?.APPEARANCE === 'dark' || APPEARANCE === 'dark'
const [isDarkMode, updateDarkMode] = useState(defaultDarkMode) // 默认深色模式
const [onLoading, setOnLoading] = useState(false) // 抓取文章数据
const router = useRouter()
diff --git a/public/dplayer.htm b/public/dplayer.htm
index 67348de4..73760fa3 100644
--- a/public/dplayer.htm
+++ b/public/dplayer.htm
@@ -8,8 +8,17 @@
@@ -25,7 +34,7 @@
+
+
+