🎨 Improved page & comment counter, Close #74.
This commit is contained in:
42
assets/js/third-party/others/counter.js
vendored
42
assets/js/third-party/others/counter.js
vendored
@@ -1,35 +1,31 @@
|
||||
/* Page's view & comment counter plugin */
|
||||
NexT.plugins.others.counter = function() {
|
||||
let busz_postview = false;
|
||||
let pageview_js = undefined;
|
||||
let comment_js = undefined;
|
||||
|
||||
const busz = NexT.CONFIG.busuanzi;
|
||||
if (busz != undefined && busz.pageview) {
|
||||
busz_postview = true;
|
||||
}
|
||||
const post_meta = NexT.CONFIG.postmeta;
|
||||
|
||||
// Here can append others pageview & comment plugin
|
||||
const waline = NexT.CONFIG.waline;
|
||||
if (waline != undefined){
|
||||
if(!busz_postview && waline.cfg.pageview) {
|
||||
pageview_js = NexT.utils.getCDNResource(NexT.CONFIG.page.waline.js[0]);
|
||||
NexT.utils.getScript(pageview_js, function(){
|
||||
Waline.pageviewCount({
|
||||
serverURL: waline.cfg.serverurl
|
||||
const views = post_meta.views;
|
||||
if(views != undefined && views.enable) {
|
||||
if (views.plugin == 'waline') {
|
||||
pageview_js = NexT.utils.getCDNResource(NexT.CONFIG.page.waline.js[0]);
|
||||
NexT.utils.getScript(pageview_js, function(){
|
||||
Waline.pageviewCount({
|
||||
serverURL: NexT.CONFIG.waline.cfg.serverurl
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
if (waline.cfg.comment) {
|
||||
comment_js = NexT.utils.getCDNResource(NexT.CONFIG.page.waline.js[1]);
|
||||
NexT.utils.getScript(comment_js, function(){
|
||||
Waline.commentCount({
|
||||
serverURL: waline.cfg.serverurl
|
||||
const comments = post_meta.comments;
|
||||
if (comments != undefined && comments.enable) {
|
||||
if (comments.plugin == 'waline') {
|
||||
comment_js = NexT.utils.getCDNResource(NexT.CONFIG.page.waline.js[1]);
|
||||
NexT.utils.getScript(comment_js, function(){
|
||||
Waline.commentCount({
|
||||
serverURL: NexT.CONFIG.waline.cfg.serverurl
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user