diff --git a/layout/_partial/scripts.ejs b/layout/_partial/scripts.ejs index eb02023..5c6be02 100644 --- a/layout/_partial/scripts.ejs +++ b/layout/_partial/scripts.ejs @@ -30,12 +30,14 @@ const { <% } %>
- <% if (t_toc?.enable === true && is_post()) { %> + <% if (is_post()) { %> <%- __js([ 'js/post-helper.js', - 'js/toc.js', 'js/libs/anime.min.js' ]) %> + <% if (t_toc?.enable === true) { %> + <%- __js('js/toc.js') %> + <% } %> <% } %>
diff --git a/scripts/helpers/export-config.js b/scripts/helpers/export-config.js index 9b5770f..f08e837 100644 --- a/scripts/helpers/export-config.js +++ b/scripts/helpers/export-config.js @@ -44,6 +44,7 @@ hexo.extend.helper.register('export_config', function () { side_tools: theme.side_tools || {}, pjax: theme.pjax || {}, lazyload: theme.lazyload || {}, + comment: theme.comment || {}, version: require('../../package.json').version } diff --git a/source/css/layout/page.styl b/source/css/layout/page.styl index 70e3d1e..afd4832 100644 --- a/source/css/layout/page.styl +++ b/source/css/layout/page.styl @@ -136,6 +136,7 @@ position fixed top $header-height + $component-spacing-value left 'calc((100vw - %s / 2) - 5rem)' % $content-max-width + box-sizing border-box opacity 0 transition-t("top, transform, opacity, left", "0, 0, 0.2, 0", "0.2, 0.2, 0.2, 0.2", "ease, ease, ease, ease") diff --git a/source/js/post-helper.js b/source/js/post-helper.js index 8e8b02a..bfb9cd2 100644 --- a/source/js/post-helper.js +++ b/source/js/post-helper.js @@ -114,10 +114,14 @@ function initToggleShowToc() { observer.observe(commentsCountDom, config) } } - KEEP.utils.postHelper.initToggleToc() KEEP.utils.postHelper.initSetPostToolsLeft() - KEEP.utils.postHelper.goToComments() - KEEP.utils.postHelper.watchPostCommentsCount() + if (KEEP.theme_config.toc.enable === true) { + KEEP.utils.postHelper.initToggleToc() + } + if (KEEP.theme_config.comment.enable === true) { + KEEP.utils.postHelper.goToComments() + KEEP.utils.postHelper.watchPostCommentsCount() + } } if (KEEP.theme_config.pjax.enable === true && KEEP.utils) {