Skip to content

Commit

Permalink
Revert "📦 refactor: remove discuss comments system" (#898)
Browse files Browse the repository at this point in the history
  • Loading branch information
H authored Jul 7, 2023
1 parent ff3a430 commit 42d9b5e
Show file tree
Hide file tree
Showing 5 changed files with 46 additions and 1 deletion.
9 changes: 9 additions & 0 deletions _cdn.yml
Original file line number Diff line number Diff line change
Expand Up @@ -332,6 +332,15 @@ waline_js:
npm: true
static: false
cdnjs: true
discuss:
name: discuss
file: dist/discuss.js
cdnjs_file: dist/discuss.js
cdnjs_no_min_file: true
version: 1.1.4
npm: true
static: false
cdnjs: true
vssue_js:
name: vssue
file: dist/vssue.github.min.js
Expand Down
8 changes: 8 additions & 0 deletions _config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -539,6 +539,14 @@ comments:
# 组件属性地址:https://waline.js.org/reference/component.html
# meta: ['nick', 'mail', 'link']

# Discuss
# https://discuss.js.org
discuss:
serverURLs: # Discuss server address url
visitStat: true # 是否显示文章阅读数
# https://discuss.js.org/Quick-Start.html#path


############################### Comments ############################### > end

############################### Sidebar ############################### > start
Expand Down
5 changes: 5 additions & 0 deletions layout/_meta/counter.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
if (theme.plugins.busuanzi.enable
|| (theme.comments.service=='waline' && theme.comments.waline.pageview)
|| (theme.comments.service=='twikoo' && theme.comments.twikoo.visitor)
|| (theme.comments.service=='discuss' && theme.comments.discuss.visitStat)
|| (theme.comments.service=='artalk' && theme.comments.artalk.visitor)) {
checkComment = !checkComment;
}
Expand All @@ -35,6 +36,10 @@
<span id="twikoo_visitors">
<i class="fa-solid fa-loader fa-spin fa-fw" aria-hidden="true"></i>
</span>
<% } else if (theme.comments.service=='discuss' && theme.comments.discuss.visitStat) { %>
<span id="Discuss-Visitors">
<i class="fa-solid fa-loader fa-spin fa-fw" aria-hidden="true"></i>
</span>
<% } else if (theme.comments.service=='artalk' && theme.comments.artalk.visitor) { %>
<span id="artalk_visitors" data-page-key="<%- url_for(path) %>">
<i class="fa-light fa-loader fa-spin fa-fw" aria-hidden="true"></i>
Expand Down
23 changes: 23 additions & 0 deletions layout/_plugins/comments/discuss/script.ejs
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<script>
volantis.layoutHelper("comments",`<div id="discuss_container"></div>`)
function load_discuss() {
if(!document.querySelectorAll("#discuss_container")[0])return;
volantis.js("<%- theme.cdn.discuss %>", p_discuss)
}
function p_discuss() {
if(!document.querySelectorAll("#discuss_container")[0])return;
let path = pdata.commentPath;
let placeholder = pdata.commentPlaceholder || "<%= theme.comments.discuss.ph %>" || "";
if (path.length == 0) {
let defaultPath = '<%= theme.comments.discuss.path %>';
path = defaultPath || decodeURI(window.location.pathname);
}
discuss.init(Object.assign(Object.assign(<%- JSON.stringify(theme.comments.discuss) %>, {
el: '#discuss_container',
path: path,
ph: placeholder
}),pdata.commentConfig))
}
load_discuss();
</script>
2 changes: 1 addition & 1 deletion source/css/_first/base_first.styl
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ button
background: alpha($color-card, .9) !important
backdrop-filter: saturate(200%) blur(20px)

if hexo-config(hexo-config('comments.service')=='twikoo' || hexo-config('comments.service')=='waline'
if hexo-config('comments.service')=='discuss' || hexo-config('comments.service')=='twikoo' || hexo-config('comments.service')=='waline'
.blur#comments
@supports (backdrop-filter: blur(20px))
backdrop-filter: unset
Expand Down

0 comments on commit 42d9b5e

Please sign in to comment.