Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
tangly1024 committed Nov 13, 2024
2 parents 1c654a5 + f32142a commit cb07937
Show file tree
Hide file tree
Showing 22 changed files with 66 additions and 64 deletions.
2 changes: 1 addition & 1 deletion components/WordCount.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export default function WordCount() {
* 更新字数统计和阅读时间
*/
function countWords() {
const articleText = deleteHtmlTag(document.getElementById('notion-article')?.innerHTML)
const articleText = deleteHtmlTag(document.querySelector('#article-wrapper #notion-article')?.innerHTML)
const wordCount = fnGetCpmisWords(articleText)
// 阅读速度 300-500每分钟
document.getElementById('wordCount').innerHTML = wordCount
Expand Down
4 changes: 2 additions & 2 deletions themes/commerce/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ const LayoutSlug = props => {
<div className='w-full max-w-screen-xl mx-auto lg:hover:shadow lg:border lg:px-2 lg:py-4 bg-white dark:bg-hexo-black-gray dark:border-black article'>
{lock && <ArticleLock validPassword={validPassword} />}

{!lock && (
{!lock && post && (
<div
id='article-wrapper'
className='overflow-x-auto flex-grow mx-auto md:w-full md:px-5 '>
Expand Down Expand Up @@ -304,7 +304,7 @@ const Layout404 = props => {
// 延时3秒如果加载失败就返回首页
setTimeout(() => {
if (isBrowser) {
const article = document.getElementById('notion-article')
const article = document.querySelector('#article-wrapper #notion-article')
if (!article) {
router.push('/').then(() => {
// console.log('找不到页面', router.asPath)
Expand Down
4 changes: 2 additions & 2 deletions themes/example/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ const LayoutSlug = props => {
setTimeout(
() => {
if (isBrowser) {
const article = document.getElementById('notion-article')
const article = document.querySelector('#article-wrapper #notion-article')
if (!article) {
router.push('/404').then(() => {
console.warn('找不到页面', router.asPath)
Expand All @@ -178,7 +178,7 @@ const LayoutSlug = props => {
<>
{lock ? (
<PostLock validPassword={validPassword} />
) : (
) : post && (
<div>
<PostMeta post={post} />
<div id='article-wrapper'>
Expand Down
4 changes: 2 additions & 2 deletions themes/fukasawa/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ const LayoutSlug = props => {
setTimeout(
() => {
if (isBrowser) {
const article = document.getElementById('notion-article')
const article = document.querySelector('#article-wrapper #notion-article')
if (!article) {
router.push('/404').then(() => {
console.warn('找不到页面', router.asPath)
Expand All @@ -159,7 +159,7 @@ const LayoutSlug = props => {
<>
{lock ? (
<ArticleLock validPassword={validPassword} />
) : (
) : post && (
<ArticleDetail {...props} />
)}
</>
Expand Down
2 changes: 1 addition & 1 deletion themes/game/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,7 @@ const LayoutSlug = props => {
<>
{lock && <ArticleLock validPassword={validPassword} />}

{!lock && (
{!lock && post && (
<div id='article-wrapper'>
<div className='game-detail-wrapper w-full grow flex'>
<div className={`w-full md:py-2`}>
Expand Down
4 changes: 2 additions & 2 deletions themes/gitbook/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@ const LayoutIndex = props => {
// 重定向到指定文章
router.push(index).then(() => {
setTimeout(() => {
const article = document.getElementById('notion-article')
const article = document.querySelector('#article-wrapper #notion-article')
if (!article) {
console.log(
'请检查您的Notion数据库中是否包含此slug页面: ',
Expand Down Expand Up @@ -309,7 +309,7 @@ const LayoutSlug = props => {
setTimeout(
() => {
if (isBrowser) {
const article = document.getElementById('notion-article')
const article = document.querySelector('#article-wrapper #notion-article')
if (!article) {
router.push('/404').then(() => {
console.warn('找不到页面', router.asPath)
Expand Down
4 changes: 2 additions & 2 deletions themes/heo/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,7 @@ const LayoutSlug = props => {
setTimeout(
() => {
if (isBrowser) {
const article = document.getElementById('notion-article')
const article = document.querySelector('#article-wrapper #notion-article')
if (!article) {
router.push('/404').then(() => {
console.warn('找不到页面', router.asPath)
Expand All @@ -292,7 +292,7 @@ const LayoutSlug = props => {
{/* 文章锁 */}
{lock && <PostLock validPassword={validPassword} />}

{!lock && (
{!lock && post && (
<div className='mx-auto md:w-full md:px-5'>
{/* 文章主体 */}
<article
Expand Down
6 changes: 3 additions & 3 deletions themes/hexo/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@ const LayoutSlug = props => {
setTimeout(
() => {
if (isBrowser) {
const article = document.getElementById('notion-article')
const article = document.querySelector('#article-wrapper #notion-article')
if (!article) {
router.push('/404').then(() => {
console.warn('找不到页面', router.asPath)
Expand All @@ -286,7 +286,7 @@ const LayoutSlug = props => {
<div className='w-full lg:hover:shadow lg:border rounded-t-xl lg:rounded-xl lg:px-2 lg:py-4 bg-white dark:bg-hexo-black-gray dark:border-black article'>
{lock && <ArticleLock validPassword={validPassword} />}

{!lock && (
{!lock && post && (
<div className='overflow-x-auto flex-grow mx-auto md:w-full md:px-5 '>
<article
id='article-wrapper'
Expand Down Expand Up @@ -333,7 +333,7 @@ const Layout404 = props => {
// 延时3秒如果加载失败就返回首页
setTimeout(() => {
if (isBrowser) {
const article = document.getElementById('notion-article')
const article = document.querySelector('#article-wrapper #notion-article')
if (!article) {
router.push('/').then(() => {
// console.log('找不到页面', router.asPath)
Expand Down
2 changes: 1 addition & 1 deletion themes/landing/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ const LayoutSlug = props => {
setTimeout(
() => {
if (isBrowser) {
const article = document.getElementById('notion-article')
const article = document.querySelector('#article-wrapper #notion-article')
if (!article) {
router.push('/404').then(() => {
console.warn('找不到页面', router.asPath)
Expand Down
4 changes: 2 additions & 2 deletions themes/magzine/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ const LayoutSlug = props => {
setTimeout(
() => {
if (isBrowser) {
const article = document.getElementById('notion-article')
const article = document.querySelector('#article-wrapper #notion-article')
if (!article) {
router.push('/404').then(() => {
console.warn('找不到页面', router.asPath)
Expand All @@ -177,7 +177,7 @@ const LayoutSlug = props => {
{/* 文章锁 */}
{lock && <ArticleLock validPassword={validPassword} />}

{!lock && (
{!lock && post && (
<div className='w-full max-w-screen-3xl mx-auto'>
{/* 文章信息 */}
<ArticleInfo {...props} />
Expand Down
2 changes: 1 addition & 1 deletion themes/matery/components/WordCount.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export default function WordCount() {
* 更新字数统计和阅读时间
*/
function countWords() {
const articleText = deleteHtmlTag(document.getElementById('notion-article')?.innerHTML)
const articleText = deleteHtmlTag(document.querySelector('#article-wrapper #notion-article')?.innerHTML)
const wordCount = fnGetCpmisWords(articleText)
// 阅读速度 300-500每分钟
document.getElementById('wordCount').innerHTML = wordCount
Expand Down
6 changes: 3 additions & 3 deletions themes/matery/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ const LayoutSlug = props => {
setTimeout(
() => {
if (isBrowser) {
const article = document.getElementById('notion-article')
const article = document.querySelector('#article-wrapper #notion-article')
if (!article) {
router.push('/404').then(() => {
console.warn('找不到页面', router.asPath)
Expand All @@ -253,7 +253,7 @@ const LayoutSlug = props => {
className={`${fullWidth ? '' : '-mt-32'} transition-all duration-300 rounded-md mx-3 lg:border lg:rounded-xl lg:py-4 bg-white dark:bg-hexo-black-gray dark:border-black`}>
{lock && <ArticleLock validPassword={validPassword} />}

{!lock && (
{!lock && post && (
<div className='overflow-x-auto md:w-full px-3 '>
{/* 文章信息 */}
{post?.type && post?.type === 'Post' && (
Expand Down Expand Up @@ -320,7 +320,7 @@ const Layout404 = props => {
setTimeout(() => {
const article =
typeof document !== 'undefined' &&
document.getElementById('notion-article')
document.querySelector('#article-wrapper #notion-article')
if (!article) {
router.push('/').then(() => {
// console.log('找不到页面', router.asPath)
Expand Down
4 changes: 2 additions & 2 deletions themes/medium/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ const LayoutSlug = props => {
setTimeout(
() => {
if (isBrowser) {
const article = document.getElementById('notion-article')
const article = document.querySelector('#article-wrapper #notion-article')
if (!article) {
router.push('/404').then(() => {
console.warn('找不到页面', router.asPath)
Expand All @@ -209,7 +209,7 @@ const LayoutSlug = props => {
{/* 文章锁 */}
{lock && <ArticleLock validPassword={validPassword} />}

{!lock && (
{!lock && post && (
<div>
{/* 文章信息 */}
<ArticleInfo {...props} />
Expand Down
6 changes: 3 additions & 3 deletions themes/movie/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ const LayoutSlug = props => {
// 用js 实现将页面中的多个视频聚合为一个分集的视频
function combineVideo() {
// 找到 id 为 notion-article 的元素
const notionArticle = document.getElementById('notion-article')
const notionArticle = document.querySelector('#article-wrapper #notion-article')
if (!notionArticle) return // 如果找不到对应的元素,则退出函数

// 找到所有的 .notion-asset-wrapper 元素
Expand Down Expand Up @@ -291,7 +291,7 @@ const LayoutSlug = props => {
setTimeout(
() => {
if (isBrowser) {
const article = document.getElementById('notion-article')
const article = document.querySelector('#article-wrapper #notion-article')
if (!article) {
router.push('/404').then(() => {
console.warn('找不到页面', router.asPath)
Expand All @@ -315,7 +315,7 @@ const LayoutSlug = props => {

return (
<>
{!lock ? (
{!lock ? post && (
<div
id='article-wrapper'
className='px-2 max-w-5xl 2xl:max-w-[70%] mx-auto'>
Expand Down
2 changes: 1 addition & 1 deletion themes/nav/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,7 @@ const LayoutSlug = props => {
setTimeout(
() => {
if (isBrowser) {
const article = document.getElementById('notion-article')
const article = document.querySelector('#article-wrapper #notion-article')
if (!article) {
router.push('/404').then(() => {
console.warn('找不到页面', router.asPath)
Expand Down
2 changes: 1 addition & 1 deletion themes/next/components/WordCount.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export default function WordCount() {
* 更新字数统计和阅读时间
*/
function countWords() {
const articleText = deleteHtmlTag(document.getElementById('notion-article')?.innerHTML)
const articleText = deleteHtmlTag(document.querySelector('#article-wrapper #notion-article')?.innerHTML)
const wordCount = fnGetCpmisWords(articleText)
// 阅读速度 300-500每分钟
document.getElementById('wordCount').innerHTML = wordCount
Expand Down
2 changes: 1 addition & 1 deletion themes/next/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -328,7 +328,7 @@ const LayoutSlug = props => {
setTimeout(
() => {
if (isBrowser) {
const article = document.getElementById('notion-article')
const article = document.querySelector('#article-wrapper #notion-article')
if (!article) {
router.push('/404').then(() => {
console.warn('找不到页面', router.asPath)
Expand Down
4 changes: 2 additions & 2 deletions themes/nobelium/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ const LayoutSlug = props => {
setTimeout(
() => {
if (isBrowser) {
const article = document.getElementById('notion-article')
const article = document.querySelector('#article-wrapper #notion-article')
if (!article) {
router.push('/404').then(() => {
console.warn('找不到页面', router.asPath)
Expand All @@ -243,7 +243,7 @@ const LayoutSlug = props => {
<>
{lock && <ArticleLock validPassword={validPassword} />}

{!lock && (
{!lock && post && (
<div className='px-2'>
<>
<ArticleInfo post={post} />
Expand Down
6 changes: 3 additions & 3 deletions themes/photo/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ const LayoutSlug = props => {
// 用js 实现将页面中的多个视频聚合为一个分集的视频
function combineVideo() {
// 找到 id 为 notion-article 的元素
const notionArticle = document.getElementById('notion-article')
const notionArticle = document.querySelector('#article-wrapper #notion-article')
if (!notionArticle) return // 如果找不到对应的元素,则退出函数

// 找到所有的 .notion-asset-wrapper 元素
Expand Down Expand Up @@ -291,7 +291,7 @@ const LayoutSlug = props => {
setTimeout(
() => {
if (isBrowser) {
const article = document.getElementById('notion-article')
const article = document.querySelector('#article-wrapper #notion-article')
if (!article) {
router.push('/404').then(() => {
console.warn('找不到页面', router.asPath)
Expand All @@ -315,7 +315,7 @@ const LayoutSlug = props => {

return (
<>
{!lock ? (
{!lock ? post && (
<div
id='article-wrapper'
className='px-2 max-w-5xl 2xl:max-w-[70%] mx-auto'>
Expand Down
4 changes: 2 additions & 2 deletions themes/plog/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ const LayoutSlug = props => {
setTimeout(
() => {
if (isBrowser) {
const article = document.getElementById('notion-article')
const article = document.querySelector('#article-wrapper #notion-article')
if (!article) {
router.push('/404').then(() => {
console.warn('找不到页面', router.asPath)
Expand All @@ -198,7 +198,7 @@ const LayoutSlug = props => {
<>
{lock && <ArticleLock validPassword={validPassword} />}

{!lock && (
{!lock && post && (
<div className='px-2 my-16 max-w-6xl mx-auto'>
<>
<ArticleInfo post={post} />
Expand Down
Loading

0 comments on commit cb07937

Please sign in to comment.