update gitalk

i18n
xaoxuu 5 years ago
parent b8e0a55e8f
commit c3bce6794e
  1. 14
      _config.yml
  2. 27
      layout/_partial/scripts.ejs
  3. 21
      layout/_third-party/comments.ejs

@ -217,10 +217,9 @@ share:
# footer: '页脚文字,支持[markdown](/)'
############################### 评论 ###############################
# disqus_shortname: xaoxuu
# livere_uid:
# valine
############################### 杂项,请勿删除 ###############################
#valine配置
valine:
enable: true # 如果你想用Valine评论系统,请设置enable为true
volantis: true # 是否启用volantis版本(禁止匿名,增加若干贴吧、QQ表情)
@ -231,17 +230,12 @@ valine:
guest_info: nick,mail,link #valine comment header info
placeholder: 快来评论吧~ # valine comment input placeholder(like: Please leave your footprints )
avatar: mp # gravatar style https://valine.js.org/avatar
pageSize: 20 # comment list page size
pageSize: 10 # comment list page size
verify: false # valine verify code (true/false)
notify: false # valine mail notify (true/false)
lang: zh-cn
highlight: false
############################### 杂项,请勿删除 ###############################
# 搜索配置
search:
enable: true

@ -58,6 +58,7 @@
<%
var enableDisqus = false;
var enableLivere = false;
var enableGitalk = false;
var enableValine = false;
if (page && page.comments != false) {
if (config.disqus_shortname) {
@ -66,7 +67,10 @@
if (config.livere_uid) {
enableLivere = true;
}
if (theme.valine && theme.valine.enable && config.leancloud) {
if (config.gitalk) {
enableGitalk = true;
}
if (theme.valine.enable && config.leancloud) {
enableValine = true;
}
}
@ -98,6 +102,27 @@
})(document, 'script');
</script>
<% } %>
<% if (enableGitalk) { %>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/gitalk@1/dist/gitalk.css">
<script src="https://cdn.jsdelivr.net/npm/gitalk@1/dist/gitalk.min.js"></script>
<script type="text/javascript">
var gitalk = new Gitalk({
clientID: "<%- config.gitalk.clientID %>",
clientSecret: "<%- config.gitalk.clientSecret %>",
repo: "<%- config.gitalk.repo %>",
owner: "<%- config.gitalk.owner %>",
admin: "<%- config.gitalk.admin %>",
<% if(page.gitalk && page.gitalk.id) { %>
id: "<%= page.gitalk.id %>",
<% } else { %>
id: location.pathname, // Ensure uniqueness and length less than 50
<% } %>
distractionFreeMode: true // Facebook-like distraction free mode
});
gitalk.render('gitalk-container');
</script>
<% } %>
<% if (enableValine){ %>
<script src="//cdn1.lncld.net/static/js/3.0.4/av-min.js"></script>
<% if (theme.valine.volantis == true) { %>

@ -2,6 +2,7 @@
<%
var enableDisqus = false;
var enableLivere = false;
var enableGitalk = false;
var enableValine = false;
if (page && page.comments != false) {
if (config.disqus_shortname) {
@ -10,13 +11,16 @@
if (config.livere_uid) {
enableLivere = true;
}
if (theme.valine && theme.valine.enable && config.leancloud) {
if (config.gitalk) {
enableGitalk = true;
}
if (theme.valine.enable && config.leancloud) {
enableValine = true;
}
}
%>
<% if (enableDisqus || enableLivere || enableValine) { %>
<% if (enableDisqus || enableLivere || enableGitalk || enableValine) { %>
<article class="post white-box comments">
<section class="article typo">
<h4><i class="fas fa-comments fa-fw" aria-hidden="true"></i>&nbsp;<%- __('post.comments') %></h4>
@ -24,12 +28,6 @@
<section id="comments">
<div id="disqus_thread">
<div><i class='fas fa-exclamation-triangle'>&nbsp;<%- __('post.comments_placeholder', 'Disqus') %></div>
<% if (enableValine) { %>
<div id="valine_container" class="valine_thread">
<i class="fas fa-spinner fa-spin fa-fw"></i>
</div>
<% } else { %>
<% } %>
</div>
</section>
<% } %>
@ -40,7 +38,12 @@
</div>
</section>
<% } %>
<% if (!enableDisqus && enableValine){ %>
<% if (enableGitalk){ %>
<section id="comments">
<div id="gitalk-container"></div>
</section>
<% } %>
<% if (enableValine){ %>
<section id="comments">
<div id="valine_container" class="valine_thread">
<i class="fas fa-spinner fa-spin fa-fw"></i>

Loading…
Cancel
Save