Improved the comments plug-in load function, close #12

This commit is contained in:
凡梦星尘
2022-07-13 21:25:15 +08:00
parent bf55ada93c
commit 81cff8a5c2
50 changed files with 405 additions and 326 deletions

View File

@@ -0,0 +1,48 @@
document.addEventListener('DOMContentLoaded', () => {
const element = '.waline-container';
if (!NexT.CONFIG.comments.enable
|| !NexT.CONFIG.waline
|| !NexT.utils.checkDOMExist(element)) return;
const {
emoji,
imguploader,
pageview,
placeholder,
requiredmeta,
serverurl,
wordlimit
} = NexT.CONFIG.waline.config;
const waline_css = NexT.utils.getCDNResource(NexT.CONFIG.waline.css);
NexT.utils.getStyle(waline_css, null);
const waline_js = NexT.utils.getCDNResource(NexT.CONFIG.waline.js);
const locale = {
placeholder: placeholder
};
NexT.utils.loadComments(element)
.then(() => NexT.utils.getScript(waline_js, {
}))
.then(() => {
Waline.init({
locale,
el : element,
pageview : pageview,
emoji : emoji,
imageUploader : imguploader,
wordLimit : wordlimit,
requiredMeta : requiredmeta,
serverURL : serverurl,
lang : NexT.CONFIG.lang,
dark : "auto"
});
NexT.utils.hiddeLodingCmp(element);
});
});