📦 update: valine

This commit is contained in:
shen-yu 2020-06-07 09:59:30 +08:00
parent 15ffef6fe6
commit 48d03030a8
2 changed files with 36 additions and 41 deletions

View File

@ -97,7 +97,7 @@ rss: /atom.xml
darkmode: true darkmode: true
# 动态背景效果: 0-关闭1-动态线条(跟随鼠标) # 动态背景效果: 0-关闭1-动态线条(跟随鼠标)
canvas_bg: 1 canvas_bg: 0
# 自定义鼠标样式,直接替换/images/mouse.cur文件 # 自定义鼠标样式,直接替换/images/mouse.cur文件
mouse: mouse:
@ -118,13 +118,11 @@ layout:
# 启用Valine必须先创建leancloud应用 获取 id|key 填入即可 # 启用Valine必须先创建leancloud应用 获取 id|key 填入即可
leancloud: leancloud:
enable: true enable: true
app_id: # app_id: chaSYi8FMdJBwzIBpxeNjqWC-gzGzoHsz
app_key: # app_key: PqqkLYgPkHvH1BmyQqySWnSK
# Valine配置 # Valine配置
valine: valine:
enable: true # 是否启用 enable: true # 是否启用
verify: false # 是否启用防垃圾验证
notify: false # 是否开启邮件提醒(https://valine.js.org/notify.html)
avatar: monsterid # 头像样式(https://valine.js.org/avatar.html) avatar: monsterid # 头像样式(https://valine.js.org/avatar.html)
placeholder: 给我的文章加点评论吧~ # placeholder placeholder: 给我的文章加点评论吧~ # placeholder

View File

@ -1,24 +1,21 @@
<% if (!index && theme.leancloud && theme.leancloud.enable){ %> <% if (!index && theme.leancloud && theme.leancloud.enable){ %>
<!-- valine评论 --> <!-- valine评论 -->
<div id="vcomments-box"> <div id="vcomments-box">
<div id="vcomments"> <div id="vcomments"></div>
</div>
</div> </div>
<script src="//cdn1.lncld.net/static/js/3.0.4/av-min.js"></script> <script src="//cdn1.lncld.net/static/js/3.0.4/av-min.js"></script>
<script src='https://cdn.jsdelivr.net/npm/valine@1.3.10/dist/Valine.min.js'></script> <script src="https://cdn.jsdelivr.net/npm/valine@1.4.14/dist/Valine.min.js"></script>
<script> <script>
new Valine({ new Valine({
el: '#vcomments', el: "#vcomments",
app_id: '<%- theme.leancloud.app_id %>', app_id: "<%- theme.leancloud.app_id %>",
app_key: '<%- theme.leancloud.app_key %>', app_key: "<%- theme.leancloud.app_key %>",
path: window.location.pathname, path: window.location.pathname,
notify: <%- theme.valine.notify %>, avatar: "<%- theme.valine.avatar %>",
verify: <%- theme.valine.verify %>, placeholder: "<%- theme.valine.placeholder %>",
avatar: '<%- theme.valine.avatar %>', recordIP: true,
placeholder: '<%- theme.valine.placeholder %>',
recordIP: true
}); });
const infoEle = document.querySelector('#vcomments .info'); const infoEle = document.querySelector("#vcomments .info");
if (infoEle && infoEle.childNodes && infoEle.childNodes.length > 0) { if (infoEle && infoEle.childNodes && infoEle.childNodes.length > 0) {
infoEle.childNodes.forEach(function (item) { infoEle.childNodes.forEach(function (item) {
item.parentNode.removeChild(item); item.parentNode.removeChild(item);