hexo-theme-ayer/layout/_partial/post/valine.ejs

49 lines
1.2 KiB
JavaScript
Raw Normal View History

2020-11-27 07:52:22 +00:00
<% if (!index && theme.leancloud && theme.leancloud.enable && post.comments){ %>
2019-12-03 11:37:44 +00:00
<!-- valine评论 -->
<div id="vcomments-box">
2020-06-07 01:59:30 +00:00
<div id="vcomments"></div>
2019-12-03 11:37:44 +00:00
</div>
<script src="//cdn1.lncld.net/static/js/3.0.4/av-min.js"></script>
2020-06-07 01:59:30 +00:00
<script src="https://cdn.jsdelivr.net/npm/valine@1.4.14/dist/Valine.min.js"></script>
2019-12-03 11:37:44 +00:00
<script>
2020-06-07 01:59:30 +00:00
new Valine({
el: "#vcomments",
app_id: "<%- theme.leancloud.app_id %>",
app_key: "<%- theme.leancloud.app_key %>",
path: window.location.pathname,
avatar: "<%- theme.valine.avatar %>",
placeholder: "<%- theme.valine.placeholder %>",
recordIP: true,
});
const infoEle = document.querySelector("#vcomments .info");
if (infoEle && infoEle.childNodes && infoEle.childNodes.length > 0) {
infoEle.childNodes.forEach(function (item) {
item.parentNode.removeChild(item);
2019-12-03 11:37:44 +00:00
});
2020-06-07 01:59:30 +00:00
}
2019-12-03 11:37:44 +00:00
</script>
<style>
2020-06-07 01:59:30 +00:00
#vcomments-box {
padding: 5px 30px;
}
@media screen and (max-width: 800px) {
2019-12-03 11:37:44 +00:00
#vcomments-box {
2020-06-07 01:59:30 +00:00
padding: 5px 0px;
2019-12-03 11:37:44 +00:00
}
2020-06-07 01:59:30 +00:00
}
2019-12-03 11:37:44 +00:00
2020-06-07 01:59:30 +00:00
#vcomments-box #vcomments {
background-color: #fff;
}
2019-12-03 11:37:44 +00:00
2020-06-07 01:59:30 +00:00
.v .vlist .vcard .vh {
padding-right: 20px;
}
2019-12-03 11:37:44 +00:00
2020-06-07 01:59:30 +00:00
.v .vlist .vcard {
padding-left: 10px;
}
2019-12-03 11:37:44 +00:00
</style>
2020-06-07 01:59:30 +00:00
<% } %>