46 lines
1.7 KiB
Plaintext
Executable File
46 lines
1.7 KiB
Plaintext
Executable File
<% if(
|
|
theme.comment.valine.enable
|
|
&& theme.comment.valine.appid
|
|
&& theme.comment.valine.appkey
|
|
) { %>
|
|
<div class="valine-container">
|
|
<script src='//unpkg.com/valine/dist/Valine.min.js'></script>
|
|
<div id="vcomments"></div>
|
|
<script>
|
|
new Valine({
|
|
el: '#vcomments',
|
|
appId: '<%= theme.comment.valine.appid %>',
|
|
appKey: '<%= theme.comment.valine.appkey %>',
|
|
meta: '<%= theme.comment.valine.meta %>'.split(','),
|
|
avatar: 'wavatar',
|
|
enableQQ: true,
|
|
placeholder: '<%= theme.comment.valine.placeholder %>',
|
|
lang: '<%= config.language %>'.toLowerCase()
|
|
});
|
|
|
|
|
|
// Valine 评论列表增加"博主"标识
|
|
const getValineDomTimer = setInterval(() => {
|
|
const vcards = document.querySelectorAll('#vcomments .vcards .vcard');
|
|
if (vcards.length > 0) {
|
|
|
|
let author = '<%= theme.base_info.author || config.author %>';
|
|
if (author) {
|
|
author = author.toLocaleLowerCase();
|
|
}
|
|
|
|
for (let vcard of vcards) {
|
|
const vnick = vcard.querySelector('.vhead .vnick');
|
|
if (vnick.innerHTML.toLocaleLowerCase() === author) {
|
|
vcard.classList.add('author');
|
|
}
|
|
}
|
|
clearInterval(getValineDomTimer);
|
|
} else {
|
|
clearInterval(getValineDomTimer);
|
|
}
|
|
}, 2000);
|
|
</script>
|
|
</div>
|
|
<% } %>
|