mirror of
https://github.com/d0zingcat/NotionNext.git
synced 2026-05-14 07:26:52 +00:00
@@ -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
|
||||
|
||||
@@ -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 '>
|
||||
@@ -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)
|
||||
|
||||
@@ -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)
|
||||
@@ -178,7 +178,7 @@ const LayoutSlug = props => {
|
||||
<>
|
||||
{lock ? (
|
||||
<PostLock validPassword={validPassword} />
|
||||
) : (
|
||||
) : post && (
|
||||
<div>
|
||||
<PostMeta post={post} />
|
||||
<div id='article-wrapper'>
|
||||
|
||||
@@ -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)
|
||||
@@ -159,7 +159,7 @@ const LayoutSlug = props => {
|
||||
<>
|
||||
{lock ? (
|
||||
<ArticleLock validPassword={validPassword} />
|
||||
) : (
|
||||
) : post && (
|
||||
<ArticleDetail {...props} />
|
||||
)}
|
||||
</>
|
||||
|
||||
@@ -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`}>
|
||||
|
||||
@@ -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页面: ',
|
||||
@@ -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)
|
||||
|
||||
@@ -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)
|
||||
@@ -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
|
||||
|
||||
@@ -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)
|
||||
@@ -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'
|
||||
@@ -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)
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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)
|
||||
@@ -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} />
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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)
|
||||
@@ -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' && (
|
||||
@@ -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)
|
||||
|
||||
@@ -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)
|
||||
@@ -209,7 +209,7 @@ const LayoutSlug = props => {
|
||||
{/* 文章锁 */}
|
||||
{lock && <ArticleLock validPassword={validPassword} />}
|
||||
|
||||
{!lock && (
|
||||
{!lock && post && (
|
||||
<div>
|
||||
{/* 文章信息 */}
|
||||
<ArticleInfo {...props} />
|
||||
|
||||
@@ -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 元素
|
||||
@@ -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)
|
||||
@@ -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'>
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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)
|
||||
@@ -243,7 +243,7 @@ const LayoutSlug = props => {
|
||||
<>
|
||||
{lock && <ArticleLock validPassword={validPassword} />}
|
||||
|
||||
{!lock && (
|
||||
{!lock && post && (
|
||||
<div className='px-2'>
|
||||
<>
|
||||
<ArticleInfo post={post} />
|
||||
|
||||
@@ -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 元素
|
||||
@@ -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)
|
||||
@@ -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'>
|
||||
|
||||
@@ -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)
|
||||
@@ -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} />
|
||||
|
||||
@@ -224,35 +224,37 @@ const LayoutSlug = props => {
|
||||
<>
|
||||
{lock && <ArticleLock validPassword={validPassword} />}
|
||||
|
||||
<div className={`px-2 ${fullWidth ? '' : 'xl:max-w-4xl 2xl:max-w-6xl'}`}>
|
||||
{/* 文章信息 */}
|
||||
<ArticleInfo post={post} />
|
||||
{!lock && post && (
|
||||
<div className={`px-2 ${fullWidth ? '' : 'xl:max-w-4xl 2xl:max-w-6xl'}`}>
|
||||
{/* 文章信息 */}
|
||||
<ArticleInfo post={post} />
|
||||
|
||||
{/* 广告嵌入 */}
|
||||
{/* <AdSlot type={'in-article'} /> */}
|
||||
<WWAds orientation='horizontal' className='w-full' />
|
||||
{/* 广告嵌入 */}
|
||||
{/* <AdSlot type={'in-article'} /> */}
|
||||
<WWAds orientation='horizontal' className='w-full' />
|
||||
|
||||
<div id='article-wrapper'>
|
||||
{/* Notion文章主体 */}
|
||||
{!lock && <NotionPage post={post} />}
|
||||
<div id='article-wrapper'>
|
||||
{/* Notion文章主体 */}
|
||||
{!lock && <NotionPage post={post} />}
|
||||
</div>
|
||||
|
||||
{/* 分享 */}
|
||||
<ShareBar post={post} />
|
||||
|
||||
{/* 广告嵌入 */}
|
||||
<AdSlot type={'in-article'} />
|
||||
|
||||
{post?.type === 'Post' && (
|
||||
<>
|
||||
<ArticleAround prev={prev} next={next} />
|
||||
<RecommendPosts recommendPosts={recommendPosts} />
|
||||
</>
|
||||
)}
|
||||
|
||||
{/* 评论区 */}
|
||||
<Comment frontMatter={post} />
|
||||
</div>
|
||||
|
||||
{/* 分享 */}
|
||||
<ShareBar post={post} />
|
||||
|
||||
{/* 广告嵌入 */}
|
||||
<AdSlot type={'in-article'} />
|
||||
|
||||
{post?.type === 'Post' && (
|
||||
<>
|
||||
<ArticleAround prev={prev} next={next} />
|
||||
<RecommendPosts recommendPosts={recommendPosts} />
|
||||
</>
|
||||
)}
|
||||
|
||||
{/* 评论区 */}
|
||||
<Comment frontMatter={post} />
|
||||
</div>
|
||||
)}
|
||||
</>
|
||||
)
|
||||
}
|
||||
@@ -271,7 +273,7 @@ const Layout404 = 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)
|
||||
|
||||
@@ -159,7 +159,7 @@ const LayoutSlug = props => {
|
||||
<div id='container-inner' className='w-full p-4'>
|
||||
{lock && <ArticleLock validPassword={validPassword} />}
|
||||
|
||||
{!lock && (
|
||||
{!lock && post && (
|
||||
<div id='article-wrapper' className='mx-auto'>
|
||||
<NotionPage {...props} />
|
||||
<Comment frontMatter={post} />
|
||||
|
||||
Reference in New Issue
Block a user