perf: when the Valine meta is empty, use ['nick', 'mail', 'link'] configuration item

This commit is contained in:
XPoet 2020-12-27 21:27:57 +08:00
parent 344aab9e89
commit 6c2721286d
1 changed files with 3 additions and 3 deletions

View File

@ -7,19 +7,19 @@
<script src='//unpkg.com/valine/dist/Valine.min.js'></script> <script src='//unpkg.com/valine/dist/Valine.min.js'></script>
<div id="vcomments"></div> <div id="vcomments"></div>
<script> <script>
const temp_valine_input_meta = '<%= theme.comment.valine.meta %>';
new Valine({ new Valine({
el: '#vcomments', el: '#vcomments',
appId: '<%= theme.comment.valine.appid %>', appId: '<%= theme.comment.valine.appid %>',
appKey: '<%= theme.comment.valine.appkey %>', appKey: '<%= theme.comment.valine.appkey %>',
meta: '<%= theme.comment.valine.meta %>'.split(','), meta: temp_valine_input_meta ? temp_valine_input_meta.split(',') : ['nick', 'mail', 'link'],
avatar: 'wavatar', avatar: 'wavatar',
enableQQ: true, enableQQ: true,
placeholder: '<%= theme.comment.valine.placeholder %>', placeholder: '<%= theme.comment.valine.placeholder %>',
lang: '<%= config.language %>'.toLowerCase() lang: '<%= config.language %>'.toLowerCase()
}); });
// Add "Author" identify
// Valine 评论列表增加"博主"标识
const getValineDomTimer = setInterval(() => { const getValineDomTimer = setInterval(() => {
const vcards = document.querySelectorAll('#vcomments .vcards .vcard'); const vcards = document.querySelectorAll('#vcomments .vcards .vcard');
if (vcards.length > 0) { if (vcards.length > 0) {