2022-10-26 22:37:03 +08:00
|
|
|
/* Utterances comment plugin */
|
|
|
|
NexT.plugins.comments.utterances = function() {
|
2022-07-13 21:25:15 +08:00
|
|
|
const element = '.utterances-container';
|
2022-10-24 22:08:17 +08:00
|
|
|
if (!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
|
|
|
|
2022-10-24 22:08:17 +08:00
|
|
|
NexT.utils.lazyLoadComponent(element, function() {
|
|
|
|
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,
|
2022-10-24 22:08:17 +08:00
|
|
|
'label' : label,
|
2022-07-13 21:25:15 +08:00
|
|
|
'theme' : theme
|
2022-05-21 17:47:26 +08:00
|
|
|
},
|
2022-07-13 21:25:15 +08:00
|
|
|
parentNode: document.querySelector(element)
|
2022-10-24 22:08:17 +08:00
|
|
|
});
|
2022-07-13 21:25:15 +08:00
|
|
|
|
|
|
|
NexT.utils.hiddeLodingCmp(element);
|
2022-10-24 22:08:17 +08:00
|
|
|
});
|
|
|
|
}
|