perf(comment): 允许全局关闭评论,文章、页面评论设置生效,#64

This commit is contained in:
nineya 2023-12-01 19:51:58 +08:00
parent 7c7b5e98bf
commit b480a428cc
7 changed files with 50 additions and 49 deletions

View File

@ -1,45 +1,46 @@
<html lang="zh" xmlns:th="https://www.thymeleaf.org" <html lang="zh" xmlns:th="https://www.thymeleaf.org"
th:class="${theme.config.basic_style.theme_style}" th:class="${theme.config.basic_style.theme_style}"
th:fragment="layout (title, canonical, content, isPost)"> th:fragment="layout (title, canonical, content, isPost)">
<th:block th:if="${!#strings.equals('',param._pjax)}" <th:block th:with="contributor = ${contributorFinder.getContributor(theme.config.basic_info.metadata_name)},
th:with="contributor = ${contributorFinder.getContributor(theme.config.basic_info.metadata_name)}"> enableComment = ${baseEnableComment && site.comment.enable && pluginFinder.available('PluginCommentWidget')}">
<th:block th:replace="~{common/head :: head}"/> <th:block th:if="${!#strings.equals('',param._pjax)}">
<body> <th:block th:replace="~{common/head :: head}"/>
<div class="column-main"> <body>
<th:block th:replace="${content}"/> <div class="column-main">
</div> <th:block th:replace="${content}"/>
<th:block th:replace="~{common/scripts}"/>
</body>
</th:block>
<th:block th:unless="${!#strings.equals('',param._pjax)}"
th:with="stats = ${siteStatsFinder.getStats()},
contributor = ${contributorFinder.getContributor(theme.config.basic_info.metadata_name)}">
<th:block th:replace="~{common/head :: head}"/>
<body>
<th:block th:replace="~{common/navbar}"/>
<th:block th:if="${theme.config.basic_style.enable_banner}">
<th:block th:replace="~{common/banner :: banner}"/>
</th:block>
<section class="section">
<div th:class="${theme.config.basic_style.sidebar_column != 'all' ? 'container two-column' : 'container' }">
<div class="columns">
<div class="column column-main">
<th:block th:replace="${content}"/>
</div>
<th:block
th:if="${theme.config.basic_style.sidebar_column!='only-right' && theme.config.basic_style.sidebar_column!='module-left'}">
<th:block th:replace="~{common/widget :: widget('left')}"/>
</th:block>
<th:block
th:if="${theme.config.basic_style.sidebar_column!='only-left' && theme.config.basic_style.sidebar_column!='module-right'}">
<th:block th:replace="~{common/widget :: widget('right')}"/>
</th:block>
</div>
</div> </div>
</section> <th:block th:replace="~{common/scripts}"/>
<th:block th:replace="~{common/actions}"/> </body>
<th:block th:replace="~{common/footer}"/> </th:block>
<th:block th:replace="~{common/scripts}"/> <th:block th:unless="${!#strings.equals('',param._pjax)}"
</body> th:with="stats = ${siteStatsFinder.getStats()}">
<th:block th:replace="~{common/head :: head}"/>
<body>
<th:block th:replace="~{common/navbar}"/>
<th:block th:if="${theme.config.basic_style.enable_banner}">
<th:block th:replace="~{common/banner :: banner}"/>
</th:block>
<section class="section">
<div th:class="${theme.config.basic_style.sidebar_column != 'all' ? 'container two-column' : 'container' }">
<div class="columns">
<div class="column column-main">
<th:block th:replace="${content}"/>
</div>
<th:block
th:if="${theme.config.basic_style.sidebar_column!='only-right' && theme.config.basic_style.sidebar_column!='module-left'}">
<th:block th:replace="~{common/widget :: widget('left')}"/>
</th:block>
<th:block
th:if="${theme.config.basic_style.sidebar_column!='only-left' && theme.config.basic_style.sidebar_column!='module-right'}">
<th:block th:replace="~{common/widget :: widget('right')}"/>
</th:block>
</div>
</div>
</section>
<th:block th:replace="~{common/actions}"/>
<th:block th:replace="~{common/footer}"/>
<th:block th:replace="~{common/scripts}"/>
</body>
</th:block>
</th:block> </th:block>
</html> </html>

View File

@ -14,9 +14,7 @@
<script th:if="${isJournals}" data-pjax th:src="@{/assets/js/journals.min.js(mew=${theme.spec.version})}"></script> <script th:if="${isJournals}" data-pjax th:src="@{/assets/js/journals.min.js(mew=${theme.spec.version})}"></script>
</th:block> </th:block>
<script th:if="${isPhotos}" data-pjax th:src="@{/assets/lib/justifiedGallery@3.8.1/jquery.justifiedGallery.min.js}"></script> <script th:if="${isPhotos}" data-pjax th:src="@{/assets/lib/justifiedGallery@3.8.1/jquery.justifiedGallery.min.js}"></script>
<th:block th:if="${isPost || enableComment != null}"> <script th:if="${enableComment}" data-pjax src="/plugins/PluginCommentWidget/assets/static/comment-widget.iife.js"></script>
<script th:if="${pluginFinder.available('PluginCommentWidget') && (post != null || singlePage != null || enableComment != null)}" data-pjax src="/plugins/PluginCommentWidget/assets/static/comment-widget.iife.js"></script>
</th:block>
<script th:src="@{/assets/js/mew-custom.min.js(mew=${theme.spec.version})}"></script> <script th:src="@{/assets/js/mew-custom.min.js(mew=${theme.spec.version})}"></script>

View File

@ -1,7 +1,7 @@
<!DOCTYPE html> <!DOCTYPE html>
<th:block xmlns:th="https://www.thymeleaf.org" <th:block xmlns:th="https://www.thymeleaf.org"
th:insert="~{common/layout :: layout (title = '友链 - ' + ${site.title}, canonical = @{/links}, content = ~{::content}, isPost = false)}" th:insert="~{common/layout :: layout (title = '友链 - ' + ${site.title}, canonical = @{/links}, content = ~{::content}, isPost = false)}"
th:with="enableComment = ${!#strings.isEmpty(theme.config.page_config.link_comment_id)}"> th:with="baseEnableComment = ${!#strings.isEmpty(theme.config.page_config.link_comment_id)}">
<th:block th:fragment="content" <th:block th:fragment="content"
th:with="defaultAvatar = ${#strings.defaultString(theme.config.page_config.links_default_avatar, #theme.assets('/img/avatar.svg'))}"> th:with="defaultAvatar = ${#strings.defaultString(theme.config.page_config.links_default_avatar, #theme.assets('/img/avatar.svg'))}">
<div class="card"> <div class="card">
@ -46,7 +46,7 @@
</div> </div>
</div> </div>
</div> </div>
<div class="card card-content" id="comment-wrapper" th:if="${pluginFinder.available('PluginCommentWidget') && enableComment}"> <div class="card card-content" id="comment-wrapper" th:if="${enableComment}">
<h3 class="comment-title">评论</h3> <h3 class="comment-title">评论</h3>
<div class="widget-comment" th:data-id="${theme.config.page_config.link_comment_id}" data-target="SinglePage"></div> <div class="widget-comment" th:data-id="${theme.config.page_config.link_comment_id}" data-target="SinglePage"></div>
</div> </div>

View File

@ -89,7 +89,7 @@
</div> </div>
</th:block> </th:block>
<div class="card card-content" id="comment-wrapper" th:if="${pluginFinder.available('PluginCommentWidget')}"> <div class="card card-content" id="comment-wrapper" th:if="${enableComment}">
<h3 class="comment-title">评论</h3> <h3 class="comment-title">评论</h3>
<div class="widget-comment" th:data-id="${post.metadata.name}" th:data-target="${type}"></div> <div class="widget-comment" th:data-id="${post.metadata.name}" th:data-target="${type}"></div>
</div> </div>

View File

@ -1,7 +1,7 @@
<!DOCTYPE html> <!DOCTYPE html>
<th:block <th:block
th:insert="~{common/layout :: layout (title = '瞬间 - ' + ${site.title}, canonical = @{/moments}, content = ~{::content}, isPost = true)}" th:insert="~{common/layout :: layout (title = '瞬间 - ' + ${site.title}, canonical = @{/moments}, content = ~{::content}, isPost = true)}"
th:with="isJournals = true, enableShare = ${theme.config.post.enable_post_share}, enableComment = ${theme.config.page_config.enable_journals_comment}" th:with="isJournals = true, enableShare = ${theme.config.post.enable_post_share}, baseEnableComment = ${theme.config.page_config.enable_journals_comment}"
xmlns:th="https://www.thymeleaf.org"> xmlns:th="https://www.thymeleaf.org">
<th:block th:fragment="content"> <th:block th:fragment="content">
<div class="card card-content journal" th:each="moment : ${moments.items}"> <div class="card card-content journal" th:each="moment : ${moments.items}">
@ -37,7 +37,7 @@
<a class="share"><i class="ri-share-forward-line"></i><em>分享</em></a> <a class="share"><i class="ri-share-forward-line"></i><em>分享</em></a>
</span> </span>
</div> </div>
<div class="journal-comment" th:if="${enableComment && pluginFinder.available('PluginCommentWidget')}"> <div class="journal-comment" th:if="${enableComment}">
<div class="widget-comment" data-target="Moment" th:data-id="${moment.metadata.name}"></div> <div class="widget-comment" data-target="Moment" th:data-id="${moment.metadata.name}"></div>
</div> </div>
</div> </div>

View File

@ -4,5 +4,6 @@
th:with="enableKatex = ${!#strings.isEmpty(singlePage.metadata.annotations.get('enable_katex'))? singlePage.metadata.annotations.get('enable_katex') : theme.config.post.enable_katex}, th:with="enableKatex = ${!#strings.isEmpty(singlePage.metadata.annotations.get('enable_katex'))? singlePage.metadata.annotations.get('enable_katex') : theme.config.post.enable_katex},
enableShare = ${!#strings.isEmpty(singlePage.metadata.annotations.get('enable_share'))? singlePage.metadata.annotations.get('enable_share') : theme.config.post.enable_post_share}, enableShare = ${!#strings.isEmpty(singlePage.metadata.annotations.get('enable_share'))? singlePage.metadata.annotations.get('enable_share') : theme.config.post.enable_post_share},
enableCopyright = ${!#strings.isEmpty(singlePage.metadata.annotations.get('enable_copyright'))? singlePage.metadata.annotations.get('enable_copyright') : theme.config.post.enable_copyright}, enableCopyright = ${!#strings.isEmpty(singlePage.metadata.annotations.get('enable_copyright'))? singlePage.metadata.annotations.get('enable_copyright') : theme.config.post.enable_copyright},
enableDonate = ${!#strings.isEmpty(singlePage.metadata.annotations.get('enable_donate'))? singlePage.metadata.annotations.get('enable_donate') : theme.config.post.enable_post_donate}"> enableDonate = ${!#strings.isEmpty(singlePage.metadata.annotations.get('enable_donate'))? singlePage.metadata.annotations.get('enable_donate') : theme.config.post.enable_post_donate},
baseEnableComment = ${singlePage.spec.allowComment}">
</th:block> </th:block>

View File

@ -4,5 +4,6 @@
th:with="enableKatex = ${!#strings.isEmpty(post.metadata.annotations.get('enable_katex'))? post.metadata.annotations.get('enable_katex') : theme.config.post.enable_katex}, th:with="enableKatex = ${!#strings.isEmpty(post.metadata.annotations.get('enable_katex'))? post.metadata.annotations.get('enable_katex') : theme.config.post.enable_katex},
enableShare = ${!#strings.isEmpty(post.metadata.annotations.get('enable_share'))? post.metadata.annotations.get('enable_share') : theme.config.post.enable_post_share}, enableShare = ${!#strings.isEmpty(post.metadata.annotations.get('enable_share'))? post.metadata.annotations.get('enable_share') : theme.config.post.enable_post_share},
enableCopyright = ${!#strings.isEmpty(post.metadata.annotations.get('enable_copyright'))? post.metadata.annotations.get('enable_copyright') : theme.config.post.enable_copyright}, enableCopyright = ${!#strings.isEmpty(post.metadata.annotations.get('enable_copyright'))? post.metadata.annotations.get('enable_copyright') : theme.config.post.enable_copyright},
enableDonate = ${!#strings.isEmpty(post.metadata.annotations.get('enable_donate'))? post.metadata.annotations.get('enable_donate') : theme.config.post.enable_post_donate}"> enableDonate = ${!#strings.isEmpty(post.metadata.annotations.get('enable_donate'))? post.metadata.annotations.get('enable_donate') : theme.config.post.enable_post_donate},
baseEnableComment = ${post.spec.allowComment}">
</th:block> </th:block>