Refactoring the comments component js scripts.

This commit is contained in:
凡梦星尘
2022-10-24 22:08:17 +08:00
parent b9511728f3
commit 90df1e1247
9 changed files with 79 additions and 80 deletions

View File

@@ -1,11 +1,9 @@
document.addEventListener('DOMContentLoaded', () => {
NexT.comments.giscus = function() {
const element = '#lv-container';
if (!NexT.CONFIG.page.comments
|| !NexT.CONFIG.livere
if (!NexT.CONFIG.livere
|| !NexT.utils.checkDOMExist(element)) return;
NexT.utils.loadComments(element).then(() => {
NexT.utils.lazyLoadComponent(element, function() {
NexT.utils.getScript(NexT.CONFIG.livere.js, {
attributes: {
async: true
@@ -15,4 +13,4 @@ document.addEventListener('DOMContentLoaded', () => {
NexT.utils.hiddeLodingCmp(element);
});
});
}