perf: optimize Valine comment plugin
This commit is contained in:
parent
df637fd92f
commit
0b99f48e7d
|
@ -35,14 +35,15 @@
|
||||||
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) {
|
||||||
|
|
||||||
let author = '<%= theme.base_info.author || config.author %>';
|
let author = '<%= theme.base_info.author || config.author %>';
|
||||||
author && (author = author.toLocaleLowerCase());
|
|
||||||
|
|
||||||
|
if (author) {
|
||||||
for (let vcard of vcards) {
|
for (let vcard of vcards) {
|
||||||
const vnick = vcard.querySelector('.vhead .vnick');
|
const vnick_dom = vcard.querySelector('.vhead .vnick');
|
||||||
if (vnick.innerHTML.toLocaleLowerCase() === author) {
|
const vnick = vnick_dom.innerHTML;
|
||||||
vnick.innerHTML = `${author} <span class="author">${getAuthor(KEEP.hexo_config.language)}</span>`
|
if (vnick === author) {
|
||||||
|
vnick_dom.innerHTML = `${vnick} <span class="author">${getAuthor(KEEP.hexo_config.language)}</span>`
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
clearInterval(getValineDomTimer);
|
clearInterval(getValineDomTimer);
|
||||||
|
|
Loading…
Reference in New Issue