2022-07-13 21:25:15 +08:00
|
|
|
document.addEventListener('DOMContentLoaded', () => {
|
2022-05-21 17:47:26 +08:00
|
|
|
|
2022-07-13 21:25:15 +08:00
|
|
|
const element = '.utterances-container';
|
2022-07-22 17:16:34 +08:00
|
|
|
if (!NexT.CONFIG.page.comments
|
2022-07-22 18:35:04 +08:00
|
|
|
|| !NexT.CONFIG.utterances
|
2022-07-13 21:25:15 +08:00
|
|
|
|| !NexT.utils.checkDOMExist(element)) return;
|
2022-05-21 17:47:26 +08:00
|
|
|
|
2022-07-13 21:25:15 +08:00
|
|
|
const {
|
|
|
|
repo,
|
|
|
|
issueterm,
|
|
|
|
label,
|
2022-07-22 18:35:04 +08:00
|
|
|
theme } = NexT.CONFIG.utterances.cfg;
|
2022-07-13 21:25:15 +08:00
|
|
|
|
|
|
|
NexT.utils.loadComments(element)
|
2022-07-22 18:35:04 +08:00
|
|
|
.then(() => NexT.utils.getScript(NexT.CONFIG.utterances.js, {
|
2022-05-21 17:47:26 +08:00
|
|
|
attributes: {
|
2022-07-13 21:25:15 +08:00
|
|
|
'async' : true,
|
|
|
|
'crossorigin' : 'anonymous',
|
|
|
|
'repo' : repo,
|
|
|
|
'issue-term' : issueterm,
|
|
|
|
'theme' : theme
|
2022-05-21 17:47:26 +08:00
|
|
|
},
|
2022-07-13 21:25:15 +08:00
|
|
|
parentNode: document.querySelector(element)
|
2022-05-21 17:47:26 +08:00
|
|
|
}));
|
2022-07-13 21:25:15 +08:00
|
|
|
|
|
|
|
NexT.utils.hiddeLodingCmp(element);
|
2022-05-21 17:47:26 +08:00
|
|
|
});
|