Commit 946fd727 authored by Van's avatar Van

💄 #46

parent 7f44c38e
......@@ -8637,9 +8637,9 @@
"dev": true
},
"uvstat": {
"version": "1.0.6",
"resolved": "https://registry.npmjs.org/uvstat/-/uvstat-1.0.6.tgz",
"integrity": "sha512-Rl7ENBVv7ZtZ2kdDL5Vv4BVsbCP0qxcyOWhRBEpEfY5LHv5nB3iPMbBbSngLRsGPX2eAEboBwseScvIdu0i6eA=="
"version": "1.0.7",
"resolved": "https://registry.npmjs.org/uvstat/-/uvstat-1.0.7.tgz",
"integrity": "sha512-pwZMTmJDdtlLUWGGVrmWb8XoY5TAGoJfVgJP2d/uVFbrB7p9b3uaG9IqGDw1i0S9NNnE1aeNlzk4oSBRUyz6Jw=="
},
"v8-compile-cache": {
"version": "2.0.3",
......
......@@ -47,7 +47,7 @@
"dependencies": {
"jquery": "^3.4.1",
"nprogress": "^0.2.0",
"uvstat": "^1.0.6",
"uvstat": "^1.0.7",
"vcmt": "^1.0.9",
"vditor": "^2.1.1"
}
......
This diff is collapsed.
......@@ -43,11 +43,11 @@ window.Util = {
/**
* 初始化浏览数
*/
initViewCnt: function () {
initViewCnt: function (cb) {
Util.uvstat = new Uvstat()
Util.uvstat.addStat()
Util.uvstat.renderStat()
Util.uvstat.renderCmtStat()
Util.uvstat.renderCmtStat(cb)
},
/**
* 是否为文章页面
......@@ -120,7 +120,7 @@ window.Util = {
Util.parseMarkdown()
Util.uvstat.addStat()
Util.uvstat.renderStat()
Util.uvstat.renderCmtStat()
Util.uvstat.renderCmtStat(window.utilOptions && window.utilOptions.cmtCountCB)
cb && cb()
},
})
......@@ -247,13 +247,13 @@ window.Util = {
/**
* @description 页面初始化执行的函数
*/
init: function () {
init: function (options) {
Util.killIE()
Util.parseMarkdown()
Util.initSW()
Util.previewImg()
Util.initDebugInfo()
Util.initViewCnt()
Util.initViewCnt(options && options.cmtCountCB)
},
/**
* 调试区域文案
......@@ -305,5 +305,5 @@ window.Util = {
}
$(document).ready(function () {
Util.init()
Util.init(window.utilOptions)
})
This diff is collapsed.
......@@ -69,14 +69,13 @@
<img src="${article.authorThumbnailURL}" />
</a>
<#if commentable>
<a class="item__meta" href="${servePath}${article.articlePermalink}#b3logsolocomments">
<span data-uvstatcmt="${article.oId}"><span data-uvstatcmt="${article.oId}">${article.articleCommentCount}</span></span> ${commentLabel}
<a class="item__meta fn__none" href="${servePath}${article.articlePermalink}#b3logsolocomments">
<span data-uvstatcmt="${article.oId}">${article.articleCommentCount}</span> ${commentLabel}
</a>
<#else>
<a class="item__meta" href="${servePath}${article.articlePermalink}">
<span data-uvstaturl="${servePath}${article.articlePermalink}">${article.articleViewCount}</span> ${viewLabel}
</a>
</#if>
<a class="item__meta" href="${servePath}${article.articlePermalink}">
<span data-uvstaturl="${servePath}${article.articlePermalink}">${article.articleViewCount}</span> ${viewLabel}
</a>
</div>
</div>
</article>
......
......@@ -24,6 +24,14 @@
import '../../../js/common'
window.utilOptions = {
cmtCountCB: (element, cnt) => {
if (cnt > 0) {
element.parentElement.style.display = 'inline'
element.parentElement.nextElementSibling.style.display = 'none'
}
},
}
/**
* @description 皮肤脚本
* @static
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment