Commit 946fd727 authored by Van's avatar Van

💄 #46

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