2022-10-24 22:08:17 +08:00
|
|
|
NexT.comments.giscus = function() {
|
2022-07-13 21:25:15 +08:00
|
|
|
const element = '.giscus-container';
|
2022-07-22 17:16:34 +08:00
|
|
|
if (!NexT.CONFIG.page.comments
|
2022-07-22 18:35:04 +08:00
|
|
|
|| !NexT.CONFIG.giscus
|
2022-07-13 21:25:15 +08:00
|
|
|
|| !NexT.utils.checkDOMExist(element)) return;
|
|
|
|
|
|
|
|
const {
|
|
|
|
category,
|
|
|
|
categoryid,
|
|
|
|
emit,
|
|
|
|
inputposition,
|
|
|
|
mapping,
|
|
|
|
reactions,
|
|
|
|
repo,
|
|
|
|
repoid,
|
2022-07-22 18:35:04 +08:00
|
|
|
theme } = NexT.CONFIG.giscus.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.giscus.js, {
|
2022-07-13 21:25:15 +08:00
|
|
|
attributes: {
|
|
|
|
'async' : true,
|
|
|
|
'crossorigin' : 'anonymous',
|
|
|
|
'data-repo' : repo,
|
|
|
|
'data-repo-id' : repoid,
|
|
|
|
'data-category' : category,
|
|
|
|
'data-category-id' : categoryid,
|
|
|
|
'data-mapping' : mapping,
|
|
|
|
'data-reactions-enabled' : reactions ? 1:0,
|
|
|
|
'data-emit-metadata' : emit ? 1:0,
|
|
|
|
'data-input-position' : inputposition,
|
|
|
|
'data-theme' : theme,
|
2022-07-22 18:35:04 +08:00
|
|
|
'data-lang' : NexT.CONFIG.lang,
|
2022-07-13 21:25:15 +08:00
|
|
|
'data-loading' : 'lazy'
|
|
|
|
},
|
|
|
|
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
|
|
|
});
|
|
|
|
}
|