Feat: A simple and minimalist comment system

This commit is contained in:
MHuiG
2020-04-08 19:26:39 +08:00
parent 4c16804821
commit c5c22237f0
3 changed files with 70 additions and 3 deletions

View File

@@ -81,5 +81,9 @@
<% if (is_post()) { %>
<%- partial('post/gitalk') %>
<% } %>
<% if (is_post()) { %>
<%- partial('post/minivaline') %>
<% } %>
</article>

View File

@@ -0,0 +1,49 @@
<% if (!index && theme.leancloud && theme.leancloud.enable){ %>
<!-- minivaline评论 -->
<div id="vcomments-box">
<div id="vcomments">
</div>
</div>
<script src='https://unpkg.com/minivaline/dist/MiniValine.min.js'></script>
<script>
new MiniValine({
el: '#vcomments',
appId: '<%- theme.leancloud.app_id %>',
appKey: '<%- theme.leancloud.app_key %>',
placeholder: '<%- theme.minivaline.placeholder %>',
lang: '<%- theme.minivaline.lang %>',
adminEmailMd5: '<%- theme.minivaline.adminEmailMd5 %>',
math: <%- theme.minivaline.math %>,
md: <%- theme.minivaline.md %>
});
const infoEle = document.querySelector('#vcomments .info');
if (infoEle && infoEle.childNodes && infoEle.childNodes.length > 0) {
infoEle.childNodes.forEach(function (item) {
item.parentNode.removeChild(item);
});
}
</script>
<style>
#vcomments-box {
padding: 5px 30px;
}
@media screen and (max-width: 800px) {
#vcomments-box {
padding: 5px 0px;
}
}
#vcomments-box #vcomments {
background-color: #fff;
}
.v .vlist .vcard .vh {
padding-right: 20px;
}
.v .vlist .vcard {
padding-left: 10px;
}
</style>
<% } %>