2022-10-26 22:37:03 +08:00
|
|
|
/* Waline comment plugin */
|
|
|
|
NexT.plugins.comments.waline = function() {
|
2022-07-13 21:25:15 +08:00
|
|
|
const element = '.waline-container';
|
2022-10-24 22:08:17 +08:00
|
|
|
if (!NexT.CONFIG.waline
|
2022-07-13 21:25:15 +08:00
|
|
|
|| !NexT.utils.checkDOMExist(element)) return;
|
|
|
|
|
|
|
|
const {
|
|
|
|
emoji,
|
|
|
|
imguploader,
|
|
|
|
placeholder,
|
2022-10-01 18:21:35 +08:00
|
|
|
sofa,
|
2022-07-13 21:25:15 +08:00
|
|
|
requiredmeta,
|
|
|
|
serverurl,
|
2022-10-01 18:21:35 +08:00
|
|
|
wordlimit,
|
|
|
|
reaction,
|
|
|
|
reactiontext,
|
|
|
|
reactiontitle
|
2022-07-22 18:35:04 +08:00
|
|
|
} = NexT.CONFIG.waline.cfg;
|
2022-07-13 21:25:15 +08:00
|
|
|
|
2022-07-22 18:35:04 +08:00
|
|
|
const waline_js = NexT.utils.getCDNResource(NexT.CONFIG.waline.js);
|
2022-07-13 21:25:15 +08:00
|
|
|
|
2022-10-01 18:21:35 +08:00
|
|
|
let locale = {
|
|
|
|
placeholder : placeholder,
|
|
|
|
sofa : sofa,
|
|
|
|
reactionTitle : reactiontitle
|
2022-07-13 21:25:15 +08:00
|
|
|
};
|
|
|
|
|
2022-10-01 18:21:35 +08:00
|
|
|
reactiontext.forEach(function(value, index){
|
|
|
|
locale['reaction'+index] = value;
|
|
|
|
});
|
|
|
|
|
2022-10-24 22:08:17 +08:00
|
|
|
NexT.utils.lazyLoadComponent(element, function () {
|
|
|
|
NexT.utils.getScript(waline_js, function(){
|
|
|
|
const waline_css = NexT.utils.getCDNResource(NexT.CONFIG.waline.css);
|
2022-10-27 08:54:54 +08:00
|
|
|
NexT.utils.getStyle(waline_css, 'before');
|
2022-07-13 21:25:15 +08:00
|
|
|
|
|
|
|
Waline.init({
|
|
|
|
locale,
|
|
|
|
el : element,
|
|
|
|
emoji : emoji,
|
|
|
|
imageUploader : imguploader,
|
|
|
|
wordLimit : wordlimit,
|
|
|
|
requiredMeta : requiredmeta,
|
2022-10-01 18:21:35 +08:00
|
|
|
reaction : reaction,
|
2022-07-13 21:25:15 +08:00
|
|
|
serverURL : serverurl,
|
2022-07-22 18:35:04 +08:00
|
|
|
lang : NexT.CONFIG.lang,
|
2022-09-27 11:01:43 +08:00
|
|
|
dark : 'html[data-theme="dark"]'
|
2022-07-13 21:25:15 +08:00
|
|
|
});
|
|
|
|
|
|
|
|
NexT.utils.hiddeLodingCmp(element);
|
2022-10-24 22:08:17 +08:00
|
|
|
})
|
2022-07-13 21:25:15 +08:00
|
|
|
});
|
2022-10-24 22:08:17 +08:00
|
|
|
}
|