Skip to content

Commit

Permalink
💄 🐛 Fixed the 51la widget not init error & format busuanzi value.
Browse files Browse the repository at this point in the history
  • Loading branch information
elkan1788 committed Sep 13, 2022
1 parent e0c4a0e commit 9bde077
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 4 deletions.
2 changes: 1 addition & 1 deletion assets/js/next-boot.js
Expand Up @@ -34,7 +34,7 @@ NexT.boot.registerEvents = function() {
NexT.boot.refresh = function() {

NexT.utils.calSiteInfo();

if (!NexT.CONFIG.page.isPage) return;

NexT.utils.registerSidebarTOC();
Expand Down
19 changes: 16 additions & 3 deletions assets/js/utils.js
Expand Up @@ -65,15 +65,28 @@ NexT.utils = {
lastPushDate.innerText = pushDateVal;
}

var statistic = document.querySelectorAll('#la-siteinfo-widget span');
if (statistic) {
const statisWidget = document.querySelectorAll('#la-siteinfo-widget span');
if (statisWidget.length > 0) {
const valIds = [0,2,4,6];
const domIds = ['today_site_pv', 'yesterday_site_pv', 'month_site_pv', 'total_site_pv']
for (var i in valIds) {
let pv = NexT.utils.numberFormat(statistic[valIds[i]].innerText);
let pv = NexT.utils.numberFormat(statisWidget[valIds[i]].innerText);
document.getElementById(domIds[i]).innerText = pv;
}
}

setTimeout(()=>{ NexT.utils.fmtBusuanzi(); }, 500);
},

fmtBusuanzi: function() {
const bszUV = document.getElementById('busuanzi_value_site_uv');
if (bszUV) {
bszUV.innerText = NexT.utils.numberFormat(bszUV.innerText);
}
const bszPV = document.getElementById('busuanzi_value_site_pv');
if (bszPV) {
bszPV.innerText = NexT.utils.numberFormat(bszPV.innerText);
}
},

numberFormat: function(number) {
Expand Down

0 comments on commit 9bde077

Please sign in to comment.